mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-12 06:52:25 +00:00
Bug 1202634 - Make sure TabParent LoadContext for pop-ups shares private browsing state of opener. r=billm
--HG-- extra : commitid : 1P8nGwBmyUj extra : rebase_source : e42c5d8e989e8f53c33cbdfd533e9c7d8e50be3a
This commit is contained in:
parent
8c818726fd
commit
79217d57a8
@ -128,9 +128,35 @@ nsIContentParent::AllocPBrowserParent(const TabId& aTabId,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const IPCTabAppBrowserContext& appBrowser = aContext.appBrowserContext();
|
||||
const PopupIPCTabContext& popupContext = appBrowser.get_PopupIPCTabContext();
|
||||
|
||||
uint32_t chromeFlags = aChromeFlags;
|
||||
|
||||
// CanOpenBrowser has ensured that the IPCTabContext is of
|
||||
// type PopupIPCTabContext, and that the opener TabParent is
|
||||
// reachable.
|
||||
auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
|
||||
// We must ensure that the private browsing and remoteness flags
|
||||
// match those of the opener.
|
||||
nsCOMPtr<nsILoadContext> loadContext = opener->GetLoadContext();
|
||||
if (!loadContext) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isPrivate;
|
||||
loadContext->GetUsePrivateBrowsing(&isPrivate);
|
||||
if (isPrivate) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||
}
|
||||
|
||||
// And because we're allocating a remote browser, of course the
|
||||
// window is remote.
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_REMOTE_WINDOW;
|
||||
|
||||
MaybeInvalidTabContext tc(aContext);
|
||||
MOZ_ASSERT(tc.IsValid());
|
||||
TabParent* parent = new TabParent(this, aTabId, tc.GetTabContext(), aChromeFlags);
|
||||
TabParent* parent = new TabParent(this, aTabId, tc.GetTabContext(), chromeFlags);
|
||||
|
||||
// We release this ref in DeallocPBrowserParent()
|
||||
NS_ADDREF(parent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user