Bug 1814889: Ensure that opening private windows continues to display a private browsing icon on the Windows taskbar. r=bhearsum,mstange

Differential Revision: https://phabricator.services.mozilla.com/D168821
This commit is contained in:
Stephen A Pohl 2023-02-03 18:10:09 +00:00
parent 7cf616d209
commit c28258d54c

View File

@ -671,22 +671,21 @@ nsresult nsAppShellService::JustCreateTopWindow(
widgetInitData.mRTL = LocaleService::GetInstance()->IsAppLocaleRTL();
nsresult rv =
window->Initialize(parent, center ? aParent : nullptr, aInitialWidth,
aInitialHeight, aIsHiddenWindow, widgetInitData);
NS_ENSURE_SUCCESS(rv, rv);
// Enforce the Private Browsing autoStart pref first.
bool isPrivateBrowsingWindow =
StaticPrefs::browser_privatebrowsing_autostart();
if (aChromeMask & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW) {
// Caller requested a private window
isPrivateBrowsingWindow = true;
}
widgetInitData.mIsPrivate = isPrivateBrowsingWindow;
nsresult rv =
window->Initialize(parent, center ? aParent : nullptr, aInitialWidth,
aInitialHeight, aIsHiddenWindow, widgetInitData);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<mozIDOMWindowProxy> domWin = do_GetInterface(aParent);
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(domWin);
nsCOMPtr<nsILoadContext> parentContext = do_QueryInterface(webNav);