Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1543068 - P1.5 Remove InheritedEmbedderPolicy r=nika
Browse files Browse the repository at this point in the history
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
  • Loading branch information
JuniorHsu committed Aug 8, 2019
1 parent eff5ad6 commit 174c146
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docshell/base/BrowsingContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion docshell/base/BrowsingContextFieldList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions netwerk/protocol/http/nsHttpChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7528,21 +7528,21 @@ nsresult nsHttpChannel::ProcessCrossOriginEmbedderPolicyHeader() {
}

nsILoadInfo::CrossOriginEmbedderPolicy documentPolicy =
ctx->GetInheritedEmbedderPolicy();
ctx->GetEmbedderPolicy();
nsILoadInfo::CrossOriginEmbedderPolicy resultPolicy =
nsILoadInfo::EMBEDDER_POLICY_NULL;
rv = GetResponseEmbedderPolicy(&resultPolicy);
if (NS_FAILED(rv)) {
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;
}

Expand Down

0 comments on commit 174c146

Please sign in to comment.