Bug 769254 - Part 2: Modify nsPIWindowWatcher::OpenWindowJS (renamed to OpenWindow2) so we can pass in the URL for target=_blank links without navigating the opened window to that URL. r=bz

This commit is contained in:
Justin Lebar
2012-07-23 10:44:13 -04:00
parent 06c5be6bcf
commit 36da060acf
8 changed files with 250 additions and 162 deletions

View File

@@ -8274,16 +8274,19 @@ nsDocShell::InternalLoad(nsIURI * aURI,
bool isNewWindow = false;
if (!targetDocShell) {
nsCOMPtr<nsIDOMWindow> win =
nsCOMPtr<nsPIDOMWindow> win =
do_GetInterface(GetAsSupports(this));
NS_ENSURE_TRUE(win, NS_ERROR_NOT_AVAILABLE);
nsDependentString name(aWindowTarget);
nsCOMPtr<nsIDOMWindow> newWin;
rv = win->Open(EmptyString(), // URL to load
name, // window name
EmptyString(), // Features
getter_AddRefs(newWin));
nsCAutoString spec;
if (aURI)
aURI->GetSpec(spec);
rv = win->OpenNoNavigate(NS_ConvertUTF8toUTF16(spec),
name, // window name
EmptyString(), // Features
getter_AddRefs(newWin));
// In some cases the Open call doesn't actually result in a new
// window being opened. We can detect these cases by examining the