Bug 1560399 - Propagate remote type selection into subframes with Fission, r=farre

Differential Revision: https://phabricator.services.mozilla.com/D35451

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-06-21 16:24:55 +00:00
Родитель 20a702d1e1
Коммит e3eb05b9c9
4 изменённых файлов: 21 добавлений и 11 удалений

Просмотреть файл

@ -175,6 +175,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
mDetachedSubdocFrame(nullptr),
mPendingSwitchID(0),
mChildID(0),
mRemoteType(VoidString()),
mDepthTooGreat(false),
mIsTopLevelContent(false),
mDestroyCalled(false),
@ -191,6 +192,11 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
mIsRemoteFrame = ShouldUseRemoteProcess();
MOZ_ASSERT(!mIsRemoteFrame || !mBrowsingContext->HasOpener(),
"Cannot pass aOpener for a remote frame!");
if (mIsRemoteFrame &&
!aOwner->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType, mRemoteType)) {
mRemoteType.AssignLiteral(DEFAULT_REMOTE_TYPE);
}
}
nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
@ -200,6 +206,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
mDetachedSubdocFrame(nullptr),
mPendingSwitchID(0),
mChildID(0),
mRemoteType(VoidString()),
mDepthTooGreat(false),
mIsTopLevelContent(false),
mDestroyCalled(false),
@ -216,6 +223,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, BrowsingContext* aBrowsingContext,
if (aOptions.mRemoteType.WasPassed() &&
(!aOptions.mRemoteType.Value().IsVoid())) {
mIsRemoteFrame = true;
mRemoteType = aOptions.mRemoteType.Value();
}
}
@ -2661,14 +2669,13 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
if (XRE_IsContentProcess()) {
mBrowsingContext->SetEmbedderElement(mOwnerContent);
mRemoteBrowser = ContentChild::CreateBrowser(
this, context, NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE),
mRemoteBrowser = ContentChild::CreateBrowser(this, context, mRemoteType,
mBrowsingContext);
return !!mRemoteBrowser;
}
mRemoteBrowser = ContentParent::CreateBrowser(
context, ownerElement, mBrowsingContext, openerContentParent,
context, ownerElement, mRemoteType, mBrowsingContext, openerContentParent,
sameTabGroupAs, nextRemoteTabId);
if (!mRemoteBrowser) {
return false;

Просмотреть файл

@ -512,6 +512,8 @@ class nsFrameLoader final : public nsStubMutationObserver,
RefPtr<mozilla::dom::TabListener> mSessionStoreListener;
nsString mRemoteType;
bool mDepthTooGreat : 1;
bool mIsTopLevelContent : 1;
bool mDestroyCalled : 1;

Просмотреть файл

@ -1097,17 +1097,17 @@ mozilla::ipc::IPCResult ContentParent::RecvLaunchRDDProcess(
/*static*/
already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
const TabContext& aContext, Element* aFrameElement,
BrowsingContext* aBrowsingContext, ContentParent* aOpenerContentParent,
BrowserParent* aSameTabGroupAs, uint64_t aNextRemoteTabId) {
const nsAString& aRemoteType, BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent, BrowserParent* aSameTabGroupAs,
uint64_t aNextRemoteTabId) {
AUTO_PROFILER_LABEL("ContentParent::CreateBrowser", OTHER);
if (!sCanLaunchSubprocesses) {
return nullptr;
}
nsAutoString remoteType;
if (!aFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::RemoteType,
remoteType)) {
nsAutoString remoteType(aRemoteType);
if (remoteType.IsEmpty()) {
remoteType.AssignLiteral(DEFAULT_REMOTE_TYPE);
}

Просмотреть файл

@ -212,8 +212,9 @@ class ContentParent final : public PContentParent,
*/
static already_AddRefed<RemoteBrowser> CreateBrowser(
const TabContext& aContext, Element* aFrameElement,
BrowsingContext* aBrowsingContext, ContentParent* aOpenerContentParent,
BrowserParent* aSameTabGroupAs, uint64_t aNextRemoteTabId);
const nsAString& aRemoteType, BrowsingContext* aBrowsingContext,
ContentParent* aOpenerContentParent, BrowserParent* aSameTabGroupAs,
uint64_t aNextRemoteTabId);
static void GetAll(nsTArray<ContentParent*>& aArray);