зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1390428
(part 7) - Remove a tricky nsXPIDLCString variable. r=erahm.
The existing comment was very helpful here. --HG-- extra : rebase_source : c120df1e06051286e5ecfd765a1098d86c036622
This commit is contained in:
Родитель
9160e1cba8
Коммит
4b042e431f
|
@ -12810,10 +12810,10 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
const bool checkForPopup = !nsContentUtils::LegacyIsCallerChromeOrNativeCode() &&
|
const bool checkForPopup = !nsContentUtils::LegacyIsCallerChromeOrNativeCode() &&
|
||||||
!aDialog && !WindowExists(aName, forceNoOpener, !aCalledNoScript);
|
!aDialog && !WindowExists(aName, forceNoOpener, !aCalledNoScript);
|
||||||
|
|
||||||
// Note: it's very important that this be an nsXPIDLCString, since we want
|
// Note: the Void handling here is very important, because the window watcher
|
||||||
// .get() on it to return nullptr until we write stuff to it. The window
|
// expects a null URL string (not an empty string) if there is no URL to load.
|
||||||
// watcher expects a null URL string if there is no URL to load.
|
nsCString url;
|
||||||
nsXPIDLCString url;
|
url.SetIsVoid(true);
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
// It's important to do this security check before determining whether this
|
// It's important to do this security check before determining whether this
|
||||||
|
@ -12828,7 +12828,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
//
|
//
|
||||||
// If we're not navigating, we assume that whoever *does* navigate the
|
// If we're not navigating, we assume that whoever *does* navigate the
|
||||||
// window will do a security check of their own.
|
// window will do a security check of their own.
|
||||||
if (url.get() && !aDialog && aNavigate)
|
if (!url.IsVoid() && !aDialog && aNavigate)
|
||||||
rv = SecurityCheckURL(url.get());
|
rv = SecurityCheckURL(url.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12892,7 +12892,8 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
if (!aCalledNoScript) {
|
if (!aCalledNoScript) {
|
||||||
// We asserted at the top of this function that aNavigate is true for
|
// We asserted at the top of this function that aNavigate is true for
|
||||||
// !aCalledNoScript.
|
// !aCalledNoScript.
|
||||||
rv = pwwatch->OpenWindow2(AsOuter(), url.get(), name_ptr,
|
rv = pwwatch->OpenWindow2(AsOuter(), url.IsVoid() ? nullptr : url.get(),
|
||||||
|
name_ptr,
|
||||||
options_ptr, /* aCalledFromScript = */ true,
|
options_ptr, /* aCalledFromScript = */ true,
|
||||||
aDialog, aNavigate, argv,
|
aDialog, aNavigate, argv,
|
||||||
isPopupSpamWindow,
|
isPopupSpamWindow,
|
||||||
|
@ -12914,7 +12915,8 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||||
nojsapi.emplace();
|
nojsapi.emplace();
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = pwwatch->OpenWindow2(AsOuter(), url.get(), name_ptr,
|
rv = pwwatch->OpenWindow2(AsOuter(), url.IsVoid() ? nullptr : url.get(),
|
||||||
|
name_ptr,
|
||||||
options_ptr, /* aCalledFromScript = */ false,
|
options_ptr, /* aCalledFromScript = */ false,
|
||||||
aDialog, aNavigate, aExtraArgument,
|
aDialog, aNavigate, aExtraArgument,
|
||||||
isPopupSpamWindow,
|
isPopupSpamWindow,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче