Backed out changeset 585e0230b2d5 (bug 1580766) as requested. CLOSED TREE

This commit is contained in:
Razvan Maries
2020-06-16 21:01:26 +03:00
parent c0d27ed94e
commit 490fef059b
16 changed files with 22 additions and 268 deletions

View File

@@ -30,7 +30,6 @@
#include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/dom/WindowProxyHolder.h"
#include "mozilla/dom/SyncedContextInlines.h"
#include "mozilla/dom/XULFrameElement.h"
#include "mozilla/net/DocumentLoadListener.h"
#include "mozilla/net/RequestContextService.h"
#include "mozilla/Assertions.h"
@@ -51,7 +50,6 @@
#include "nsGlobalWindowOuter.h"
#include "nsIObserverService.h"
#include "nsContentUtils.h"
#include "nsQueryObject.h"
#include "nsSandboxFlags.h"
#include "nsScriptError.h"
#include "nsThreadUtils.h"
@@ -189,14 +187,10 @@ bool BrowsingContext::SameOriginWithTop() {
/* static */
already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
nsGlobalWindowInner* aParent, BrowsingContext* aOpener,
const nsAString& aName, Type aType, uint64_t aBrowserId) {
if (aParent) {
MOZ_DIAGNOSTIC_ASSERT(aParent->GetWindowContext());
MOZ_DIAGNOSTIC_ASSERT(aParent->GetBrowsingContext()->mType == aType);
MOZ_DIAGNOSTIC_ASSERT(aParent->GetBrowsingContext()->GetBrowserId() == 0 ||
aParent->GetBrowsingContext()->GetBrowserId() ==
aBrowserId);
}
const nsAString& aName, Type aType) {
MOZ_DIAGNOSTIC_ASSERT(!aParent ||
aParent->GetBrowsingContext()->mType == aType);
MOZ_DIAGNOSTIC_ASSERT(!aParent || aParent->GetWindowContext());
MOZ_DIAGNOSTIC_ASSERT(aType != Type::Chrome || XRE_IsParentProcess());
@@ -238,7 +232,6 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
context->mFields.SetWithoutSyncing<IDX_OpenerId>(aOpener->Id());
context->mFields.SetWithoutSyncing<IDX_HadOriginalOpener>(true);
}
if (aParent) {
MOZ_DIAGNOSTIC_ASSERT(parentBC->Group() == context->Group());
MOZ_DIAGNOSTIC_ASSERT(parentBC->mType == context->mType);
@@ -251,8 +244,6 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
context->mFields.SetWithoutSyncing<IDX_OpenerPolicy>(
nsILoadInfo::OPENER_POLICY_UNSAFE_NONE);
context->mFields.SetWithoutSyncing<IDX_BrowserId>(aBrowserId);
if (aOpener && aOpener->SameOriginWithTop()) {
// We inherit the opener policy if there is a creator and if the creator's
// origin is same origin with the creator's top-level origin.
@@ -336,10 +327,8 @@ already_AddRefed<BrowsingContext> BrowsingContext::CreateDetached(
already_AddRefed<BrowsingContext> BrowsingContext::CreateIndependent(
Type aType) {
uint64_t browserId =
aType == Type::Content ? nsContentUtils::GenerateBrowserId() : 0;
RefPtr<BrowsingContext> bc(
CreateDetached(nullptr, nullptr, EmptyString(), aType, browserId));
CreateDetached(nullptr, nullptr, EmptyString(), aType));
bc->mWindowless = bc->IsContent();
bc->EnsureAttached();
return bc.forget();
@@ -511,29 +500,6 @@ static bool OwnerAllowsFullscreen(const Element& aEmbedder) {
void BrowsingContext::SetEmbedderElement(Element* aEmbedder) {
mEmbeddedByThisProcess = true;
// Update the browser ID on the embedder if necessary. We currently don't care
// about browser IDs for chrome-type BrowsingContexts.
if (RefPtr<nsFrameLoaderOwner> owner = do_QueryObject(aEmbedder);
owner && !IsChrome()) {
uint64_t browserId = GetBrowserId();
uint64_t frameBrowserId = owner->GetBrowserId();
MOZ_DIAGNOSTIC_ASSERT(browserId != 0);
if (frameBrowserId == 0) {
// We'll arrive here if we're a top-level BrowsingContext for a window
// or tab that was opened in a content process. There should be no
// children to update at this point. This ID was generated in
// ContentChild::ProvideWindowCommon.
MOZ_DIAGNOSTIC_ASSERT(IsTopContent());
MOZ_DIAGNOSTIC_ASSERT(Children().IsEmpty());
owner->SetBrowserId(browserId);
} else {
// We would've inherited or generated an ID in CreateBrowsingContext.
MOZ_DIAGNOSTIC_ASSERT(browserId == frameBrowserId);
}
}
// Update embedder-element-specific fields in a shared transaction.
// Don't do this when clearing our embedder, as we're being destroyed either
// way.
@@ -2436,13 +2402,6 @@ void BrowsingContext::DidSet(FieldIndex<IDX_HasSessionHistory>,
CreateChildSHistory();
}
bool BrowsingContext::CanSet(FieldIndex<IDX_BrowserId>, const uint32_t& aValue,
ContentParent* aSource) {
// We should only be able to set this for toplevel contexts which don't have
// an ID yet.
return GetBrowserId() == 0 && IsTop() && Children().IsEmpty();
}
} // namespace dom
namespace ipc {