diff --git a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp index 164c6850669..099dbc0d2a9 100644 --- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp @@ -1442,8 +1442,8 @@ nsWindowWatcher::URIfromURL(const char *aURL, #define NS_CALCULATE_CHROME_FLAG_FOR(feature, flag) \ prefBranch->GetBoolPref(feature, &forceEnable); \ - if (forceEnable && !(aDialog && isChrome) && \ - !(isChrome && aHasChromeParent) && !aChromeURL) { \ + if (forceEnable && !(aDialog && isCallerChrome) && \ + !(isCallerChrome && aHasChromeParent) && !aChromeURL) { \ chromeFlags |= flag; \ } else { \ chromeFlags |= WinHasOption(aFeatures, feature, \ @@ -1494,26 +1494,18 @@ uint32_t nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow *aParent, /* Next, allow explicitly named options to override the initial settings */ - nsCOMPtr - securityManager(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID)); - - bool isChrome = false; - nsresult rv; - if (securityManager) { - rv = securityManager->SubjectPrincipalIsSystem(&isChrome); - if (NS_FAILED(rv)) { - isChrome = false; - } - } + bool isCallerChrome = nsContentUtils::IsCallerChrome(); // Determine whether the window is a private browsing window - if (isChrome) { + if (isCallerChrome) { chromeFlags |= WinHasOption(aFeatures, "private", 0, &presenceFlag) ? nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW : 0; chromeFlags |= WinHasOption(aFeatures, "non-private", 0, &presenceFlag) ? nsIWebBrowserChrome::CHROME_NON_PRIVATE_WINDOW : 0; } + nsresult rv; + nsCOMPtr prefBranch; nsCOMPtr prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); NS_ENSURE_SUCCESS(rv, true); @@ -1614,7 +1606,7 @@ uint32_t nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow *aParent, */ // Check security state for use in determing window dimensions - if (!nsContentUtils::IsCallerChrome() || (isChrome && !aHasChromeParent)) { + if (!isCallerChrome || !aHasChromeParent) { // If priv check fails (or if we're called from chrome, but the // parent is not a chrome window), set all elements to minimum // reqs., else leave them alone.