Use a better way of detecting a newly-opened window. Bug 346404, r=biesi, sr=jst

This commit is contained in:
bzbarsky%mit.edu 2006-08-23 04:10:05 +00:00
Родитель ce07b58281
Коммит 412f72b084
1 изменённых файлов: 10 добавлений и 8 удалений

Просмотреть файл

@ -6411,15 +6411,17 @@ nsDocShell::InternalLoad(nsIURI * aURI,
getter_AddRefs(newWin));
// In some cases the Open call doesn't actually result in a new
// window being opened (i.e. browser.link.open_newwindow is set
// to 1, forcing us to reuse the current window). This will
// protect us against that use case but still isn't totally
// ideal since perhaps in some future use case newWin could be
// some other, already open window.
if (win != newWin) {
// window being opened. We can detect these cases by examining the
// document in |newWin|, if any.
nsCOMPtr<nsPIDOMWindow> piNewWin = do_QueryInterface(newWin);
if (piNewWin) {
nsCOMPtr<nsIDocument> newDoc =
do_QueryInterface(piNewWin->GetExtantDocument());
if (!newDoc || newDoc->IsInitialDocument()) {
isNewWindow = PR_TRUE;
aFlags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
}
}
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(newWin);
targetDocShell = do_QueryInterface(webNav);