Bug 1595936: Part 3b - Don't force FrameLoader initialization on removal. r=smaug

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Maglione 2020-01-24 19:03:20 +00:00
parent e92365dba5
commit b0061d264f
2 changed files with 17 additions and 6 deletions

View File

@ -1949,7 +1949,7 @@ void nsFrameLoader::SetOwnerContent(Element* aContent) {
}
mOwnerContent = aContent;
if (RefPtr<BrowsingContext> browsingContext = GetBrowsingContext()) {
if (RefPtr<BrowsingContext> browsingContext = GetExtantBrowsingContext()) {
browsingContext->SetEmbedderElement(mOwnerContent);
}
@ -3198,12 +3198,22 @@ already_AddRefed<nsILoadContext> nsFrameLoader::LoadContext() {
already_AddRefed<BrowsingContext> nsFrameLoader::GetBrowsingContext() {
RefPtr<BrowsingContext> browsingContext;
if (IsRemoteFrame() && EnsureRemoteBrowser()) {
browsingContext = mRemoteBrowser->GetBrowsingContext();
} else if (GetDocShell(IgnoreErrors())) {
browsingContext = GetDocShell()->GetBrowsingContext();
if (IsRemoteFrame()) {
Unused << EnsureRemoteBrowser();
} else if (mOwnerContent) {
Unused << MaybeCreateDocShell();
}
return browsingContext.forget();
return GetExtantBrowsingContext();
}
already_AddRefed<BrowsingContext> nsFrameLoader::GetExtantBrowsingContext() {
if (mRemoteBrowser) {
return do_AddRef(mRemoteBrowser->GetBrowsingContext());
}
if (mDocShell) {
return do_AddRef(mDocShell->GetBrowsingContext());
}
return nullptr;
}
void nsFrameLoader::InitializeBrowserAPI() {

View File

@ -153,6 +153,7 @@ class nsFrameLoader final : public nsStubMutationObserver,
already_AddRefed<nsILoadContext> LoadContext();
already_AddRefed<mozilla::dom::BrowsingContext> GetBrowsingContext();
already_AddRefed<mozilla::dom::BrowsingContext> GetExtantBrowsingContext();
/**
* Start loading the frame. This method figures out what to load