From 895ebba7c174ed8001329f0721a6fab61051cfae Mon Sep 17 00:00:00 2001 From: Junior Hsu Date: Thu, 8 Aug 2019 18:56:30 +0000 Subject: [PATCH] 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 --- docshell/base/BrowsingContext.cpp | 4 ++-- docshell/base/BrowsingContextFieldList.h | 1 - netwerk/protocol/http/nsHttpChannel.cpp | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index bcfb39b5931f..2aa48409210c 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -134,12 +134,12 @@ already_AddRefed 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); diff --git a/docshell/base/BrowsingContextFieldList.h b/docshell/base/BrowsingContextFieldList.h index 73dd371fd256..890aec30ee34 100644 --- a/docshell/base/BrowsingContextFieldList.h +++ b/docshell/base/BrowsingContextFieldList.h @@ -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 diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index dfb24bcf8982..7b0aa4d93dfe 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -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; }