Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Unified Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 2040133003: Replace SecurityContext::InsecureRequestsPolicy with WebInsecureRequestPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@combine-uir-block
Patch Set: Ugh. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentInit.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.h ('k') | third_party/WebKit/Source/core/dom/DocumentInit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698