Bug 1166066 - Fix opening new windows from a private window. r=jdm

--HG--
extra : rebase_source : 9a71b987e0cd23145e77f9cb28aa40e14b8e0a52
This commit is contained in:
Gijs Kruitbosch 2015-05-19 16:27:04 +01:00
parent 0185db0619
commit ca40918bd8

View File

@ -1481,14 +1481,22 @@ nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow* aParent,
bool aHasChromeParent,
bool aOpenedFromRemoteTab)
{
if (!aFeaturesSpecified || !aFeatures) {
uint32_t chromeFlags = 0;
bool isCallerChrome =
nsContentUtils::IsCallerChrome() && !aOpenedFromRemoteTab;
bool onlyPrivateFlag = aFeaturesSpecified && aFeatures && isCallerChrome &&
nsCRT::strcasecmp(aFeatures, "private") == 0;
if (!aFeaturesSpecified || !aFeatures || onlyPrivateFlag) {
chromeFlags = nsIWebBrowserChrome::CHROME_ALL;
if (aDialog) {
return nsIWebBrowserChrome::CHROME_ALL |
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
} else {
return nsIWebBrowserChrome::CHROME_ALL;
chromeFlags |= nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
nsIWebBrowserChrome::CHROME_OPENAS_CHROME;
}
if (onlyPrivateFlag) {
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
}
return chromeFlags;
}
/* This function has become complicated since browser windows and
@ -1499,7 +1507,6 @@ nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow* aParent,
"OS's choice," and also support an "all" flag explicitly disallowed
in the standards-compliant window.(normal)open. */
uint32_t chromeFlags = 0;
bool presenceFlag = false;
chromeFlags = nsIWebBrowserChrome::CHROME_WINDOW_BORDERS;
@ -1509,9 +1516,6 @@ nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow* aParent,
/* Next, allow explicitly named options to override the initial settings */
bool isCallerChrome =
nsContentUtils::IsCallerChrome() && !aOpenedFromRemoteTab;
// Determine whether the window is a private browsing window
if (isCallerChrome) {
chromeFlags |= WinHasOption(aFeatures, "private", 0, &presenceFlag) ?