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