mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1202634 - Make sure TabParent LoadContext for pop-ups shares private browsing state of opener. r=billm
This commit is contained in:
parent
3ce252bdb7
commit
dcb768bf20
@ -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…
Reference in New Issue
Block a user