diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 16dcdac8a5f0..0d5ac971687a 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -341,6 +341,7 @@ already_AddRefed BrowsingContext::CreateIndependent( RefPtr bc( CreateDetached(nullptr, nullptr, EmptyString(), aType)); bc->mWindowless = bc->IsContent(); + bc->mEmbeddedByThisProcess = true; bc->EnsureAttached(); return bc.forget(); } @@ -2179,13 +2180,10 @@ bool BrowsingContext::CanSet(FieldIndex, } bool BrowsingContext::CheckOnlyEmbedderCanSet(ContentParent* aSource) { - if (aSource) { - // Set by a content process, verify that it's this BC's embedder. - MOZ_ASSERT(XRE_IsParentProcess()); - return Canonical()->IsEmbeddedInProcess(aSource->ChildID()); + if (XRE_IsParentProcess()) { + uint64_t childId = aSource ? aSource->ChildID() : 0; + return Canonical()->IsEmbeddedInProcess(childId); } - - // In-process case, verify that we've been embedded in this process. return mEmbeddedByThisProcess; }