Bug 1543068 - P1.5 Remove InheritedEmbedderPolicy r=nika

I believe it's the right thing to do.
COEP inherits opener's COEP and is overwritten if COEP by response is stricter.
i.e., we no more need the inherited one.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Junior Hsu 2019-08-08 18:56:30 +00:00
parent 2247427ef2
commit 895ebba7c1
3 changed files with 5 additions and 6 deletions

View File

@ -134,12 +134,12 @@ already_AddRefed<BrowsingContext> BrowsingContext::Create(
context->mName = aName;
context->mOpenerId = aOpener ? aOpener->Id() : 0;
context->mEmbedderPolicy = nsILoadInfo::EMBEDDER_POLICY_NULL;
context->mInheritedEmbedderPolicy = nsILoadInfo::EMBEDDER_POLICY_NULL;
BrowsingContext* inherit = aParent ? aParent : aOpener;
if (inherit) {
context->mOpenerPolicy = inherit->mOpenerPolicy;
context->mInheritedEmbedderPolicy = inherit->mEmbedderPolicy;
// CORPP 3.1.3 https://mikewest.github.io/corpp/#integration-html
context->mEmbedderPolicy = inherit->mEmbedderPolicy;
}
Register(context);

View File

@ -13,7 +13,6 @@
MOZ_BC_FIELD(Name, nsString)
MOZ_BC_FIELD(Closed, bool)
MOZ_BC_FIELD(EmbedderPolicy, nsILoadInfo::CrossOriginEmbedderPolicy)
MOZ_BC_FIELD(InheritedEmbedderPolicy, nsILoadInfo::CrossOriginEmbedderPolicy)
MOZ_BC_FIELD(OpenerPolicy, nsILoadInfo::CrossOriginOpenerPolicy)
// The current opener for this BrowsingContext. This is a weak reference, and

View File

@ -7528,7 +7528,7 @@ nsresult nsHttpChannel::ProcessCrossOriginEmbedderPolicyHeader() {
}
nsILoadInfo::CrossOriginEmbedderPolicy documentPolicy =
ctx->GetInheritedEmbedderPolicy();
ctx->GetEmbedderPolicy();
nsILoadInfo::CrossOriginEmbedderPolicy resultPolicy =
nsILoadInfo::EMBEDDER_POLICY_NULL;
rv = GetResponseEmbedderPolicy(&resultPolicy);
@ -7536,13 +7536,13 @@ nsresult nsHttpChannel::ProcessCrossOriginEmbedderPolicyHeader() {
return NS_OK;
}
ctx->SetEmbedderPolicy(resultPolicy);
if (documentPolicy != nsILoadInfo::EMBEDDER_POLICY_NULL &&
resultPolicy == nsILoadInfo::EMBEDDER_POLICY_NULL) {
return NS_ERROR_BLOCKED_BY_POLICY;
}
ctx->SetEmbedderPolicy(resultPolicy);
return NS_OK;
}