| Index: third_party/WebKit/Source/core/dom/Document.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
|
| index 1256acbaee442e17b19106510084da3412ddbce9..2739e154526087a983ebc08df5c3998177235ce9 100644
|
| --- a/third_party/WebKit/Source/core/dom/Document.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/Document.cpp
|
| @@ -4904,9 +4904,7 @@ void Document::initSecurityContext(const DocumentInit& initializer)
|
| // In the common case, create the security context from the currently
|
| // loading URL with a fresh content security policy.
|
| enforceSandboxFlags(initializer.getSandboxFlags());
|
| - if (initializer.shouldEnforceStrictMixedContentChecking())
|
| - enforceStrictMixedContentChecking();
|
| - setInsecureRequestsPolicy(initializer.getInsecureRequestsPolicy());
|
| + setInsecureRequestPolicy(initializer.getInsecureRequestPolicy());
|
| if (initializer.insecureNavigationsToUpgrade()) {
|
| for (auto toUpgrade : *initializer.insecureNavigationsToUpgrade())
|
| addInsecureNavigationUpgrade(toUpgrade);
|
| @@ -5862,10 +5860,16 @@ WebTaskRunner* Document::timerTaskRunner() const
|
| return Platform::current()->currentThread()->scheduler()->timerTaskRunner();
|
| }
|
|
|
| -void Document::enforceStrictMixedContentChecking()
|
| +void Document::enforceInsecureRequestPolicy(WebInsecureRequestPolicy policy)
|
| {
|
| - securityContext().setShouldEnforceStrictMixedContentChecking(true);
|
| - if (frame())
|
| + // Combine the new policy with the existing policy, as a base policy may be
|
| + // inherited from a remote parent before this page's policy is set. In other
|
| + // words, insecure requests should be upgraded or blocked if _either_ the
|
| + // existing policy or the newly enforced policy triggers upgrades or
|
| + // blockage.
|
| + setInsecureRequestPolicy(getInsecureRequestPolicy() | policy);
|
| +
|
| + if (frame() && policy & kBlockAllMixedContent)
|
| frame()->loader().client()->didEnforceStrictMixedContentChecking();
|
| }
|
|
|
|
|