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

git-svn-id: svn://10.0.0.236/trunk@208156 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-08-23 04:10:05 +00:00
parent 171d39f9c8
commit 72be990e3f

View File

@@ -6411,14 +6411,16 @@ 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) {
isNewWindow = PR_TRUE;
aFlags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
// 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);