зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1540665 - Propagate chrome flags to out-of-process iframes. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D26500 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a99e0c0dae
Коммит
b8e3697e3b
|
@ -10,6 +10,7 @@
|
|||
#include "nsFrameLoader.h"
|
||||
#include "nsFrameLoaderOwner.h"
|
||||
#include "nsQueryObject.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
|
@ -40,13 +41,36 @@ already_AddRefed<BrowserBridgeChild> BrowserBridgeChild::Create(
|
|||
RefPtr<TabChild> tabChild = TabChild::GetFrom(docShell);
|
||||
MOZ_DIAGNOSTIC_ASSERT(tabChild);
|
||||
|
||||
uint32_t chromeFlags = 0;
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
||||
if (docShell) {
|
||||
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
||||
}
|
||||
if (treeOwner) {
|
||||
nsCOMPtr<nsIWebBrowserChrome> wbc = do_GetInterface(treeOwner);
|
||||
if (wbc) {
|
||||
wbc->GetChromeFlags(&chromeFlags);
|
||||
}
|
||||
}
|
||||
|
||||
// Checking that this actually does something useful is
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1542710
|
||||
nsCOMPtr<nsILoadContext> loadContext = do_QueryInterface(docShell);
|
||||
if (loadContext && loadContext->UsePrivateBrowsing()) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW;
|
||||
}
|
||||
if (docShell->GetAffectPrivateSessionLifetime()) {
|
||||
chromeFlags |= nsIWebBrowserChrome::CHROME_PRIVATE_LIFETIME;
|
||||
}
|
||||
|
||||
RefPtr<BrowserBridgeChild> browserBridge =
|
||||
new BrowserBridgeChild(aFrameLoader, aBrowsingContext);
|
||||
// Reference is freed in TabChild::DeallocPBrowserBridgeChild.
|
||||
tabChild->SendPBrowserBridgeConstructor(
|
||||
do_AddRef(browserBridge).take(),
|
||||
PromiseFlatString(aContext.PresentationURL()), aRemoteType,
|
||||
aBrowsingContext);
|
||||
aBrowsingContext, chromeFlags);
|
||||
browserBridge->mIPCOpen = true;
|
||||
|
||||
return browserBridge.forget();
|
||||
|
|
|
@ -27,7 +27,8 @@ BrowserBridgeParent::~BrowserBridgeParent() {
|
|||
|
||||
nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
|
||||
const nsString& aRemoteType,
|
||||
CanonicalBrowsingContext* aBrowsingContext) {
|
||||
CanonicalBrowsingContext* aBrowsingContext,
|
||||
const uint32_t& aChromeFlags) {
|
||||
mIPCOpen = true;
|
||||
|
||||
// FIXME: This should actually use a non-bogus TabContext, probably inherited
|
||||
|
@ -63,15 +64,14 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
|
|||
constructorSender->ChildID());
|
||||
|
||||
// Construct the TabParent object for our subframe.
|
||||
uint32_t chromeFlags = 0;
|
||||
RefPtr<TabParent> tabParent(new TabParent(constructorSender, tabId,
|
||||
tabContext, aBrowsingContext,
|
||||
chromeFlags, this));
|
||||
aChromeFlags, this));
|
||||
|
||||
PBrowserParent* browser = constructorSender->SendPBrowserConstructor(
|
||||
// DeallocPBrowserParent() releases this ref.
|
||||
tabParent.forget().take(), tabId, TabId(0), tabContext.AsIPCTabContext(),
|
||||
chromeFlags, constructorSender->ChildID(), aBrowsingContext,
|
||||
aChromeFlags, constructorSender->ChildID(), aBrowsingContext,
|
||||
constructorSender->IsForBrowser());
|
||||
if (NS_WARN_IF(!browser)) {
|
||||
MOZ_ASSERT(false, "Browser Constructor Failed");
|
||||
|
|
|
@ -21,7 +21,8 @@ class BrowserBridgeParent : public PBrowserBridgeParent {
|
|||
|
||||
// Initialize this actor after performing startup.
|
||||
nsresult Init(const nsString& aPresentationURL, const nsString& aRemoteType,
|
||||
CanonicalBrowsingContext* aBrowsingContext);
|
||||
CanonicalBrowsingContext* aBrowsingContext,
|
||||
const uint32_t& aChromeFlags);
|
||||
|
||||
TabParent* GetTabParent() { return mTabParent; }
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ parent:
|
|||
* Construct a new Remote iframe actor.
|
||||
*/
|
||||
async PBrowserBridge(nsString aPresentationURL, nsString aRemoteType,
|
||||
BrowsingContext aBrowsingContext);
|
||||
BrowsingContext aBrowsingContext, uint32_t aChromeFlags);
|
||||
|
||||
/**
|
||||
* Sends an NS_NATIVE_CHILD_OF_SHAREABLE_WINDOW to be adopted by the
|
||||
|
|
|
@ -3206,7 +3206,8 @@ bool TabChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) {
|
|||
|
||||
PBrowserBridgeChild* TabChild::AllocPBrowserBridgeChild(const nsString&,
|
||||
const nsString&,
|
||||
BrowsingContext*) {
|
||||
BrowsingContext*,
|
||||
const uint32_t&) {
|
||||
MOZ_CRASH(
|
||||
"We should never be manually allocating PBrowserBridgeChild actors");
|
||||
return nullptr;
|
||||
|
|
|
@ -673,7 +673,7 @@ class TabChild final : public TabChildBase,
|
|||
|
||||
virtual PBrowserBridgeChild* AllocPBrowserBridgeChild(
|
||||
const nsString& aName, const nsString& aRemoteType,
|
||||
BrowsingContext* aBrowsingContext) override;
|
||||
BrowsingContext* aBrowsingContext, const uint32_t& aChromeFlags) override;
|
||||
|
||||
virtual bool DeallocPBrowserBridgeChild(PBrowserBridgeChild* aActor) override;
|
||||
|
||||
|
|
|
@ -1038,15 +1038,16 @@ bool TabParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) {
|
|||
|
||||
IPCResult TabParent::RecvPBrowserBridgeConstructor(
|
||||
PBrowserBridgeParent* aActor, const nsString& aName,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext) {
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext,
|
||||
const uint32_t& aChromeFlags) {
|
||||
static_cast<BrowserBridgeParent*>(aActor)->Init(
|
||||
aName, aRemoteType, CanonicalBrowsingContext::Cast(aBrowsingContext));
|
||||
aName, aRemoteType, CanonicalBrowsingContext::Cast(aBrowsingContext), aChromeFlags);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
PBrowserBridgeParent* TabParent::AllocPBrowserBridgeParent(
|
||||
const nsString& aName, const nsString& aRemoteType,
|
||||
BrowsingContext* aBrowsingContext) {
|
||||
BrowsingContext* aBrowsingContext, const uint32_t& aChromeFlags) {
|
||||
// Reference freed in DeallocPBrowserBridgeParent.
|
||||
return do_AddRef(new BrowserBridgeParent()).take();
|
||||
}
|
||||
|
|
|
@ -342,13 +342,14 @@ class TabParent final : public PBrowserParent,
|
|||
|
||||
PBrowserBridgeParent* AllocPBrowserBridgeParent(
|
||||
const nsString& aPresentationURL, const nsString& aRemoteType,
|
||||
BrowsingContext* aBrowsingContext);
|
||||
BrowsingContext* aBrowsingContext, const uint32_t& aChromeFlags);
|
||||
|
||||
bool DeallocPBrowserBridgeParent(PBrowserBridgeParent* aActor);
|
||||
|
||||
virtual mozilla::ipc::IPCResult RecvPBrowserBridgeConstructor(
|
||||
PBrowserBridgeParent* aActor, const nsString& aPresentationURL,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext) override;
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext,
|
||||
const uint32_t& aChromeFlags) override;
|
||||
|
||||
void LoadURL(nsIURI* aURI);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче