Bug 344808 (Canceling a [download whose link tries to open a new window] causes current tab to close, when browser.link.open_newwindow is 1) This fix does not mark the window returned by Open as new, if it is the same as the original window. r=cbiesinger,sr=darin

This commit is contained in:
marria%gmail.com 2006-08-03 06:22:49 +00:00
parent a4f11ce3f1
commit 5defba927b

View File

@ -6345,9 +6345,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(win, NS_ERROR_NOT_AVAILABLE);
isNewWindow = PR_TRUE;
aFlags |= INTERNAL_LOAD_FLAGS_NEW_WINDOW;
nsDependentString name(aWindowTarget);
nsCOMPtr<nsIDOMWindow> newWin;
rv = win->Open(EmptyString(), // URL to load
@ -6355,6 +6352,17 @@ nsDocShell::InternalLoad(nsIURI * aURI,
EmptyString(), // Features
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_NEW_WINDOW;
}
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(newWin);
targetDocShell = do_QueryInterface(webNav);