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

Unified Diff: Source/core/loader/MixedContentChecker.cpp

Issue 811773002: Mixed Content: Implement strict mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Tests. Created 6 years 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 | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/MixedContentChecker.cpp
diff --git a/Source/core/loader/MixedContentChecker.cpp b/Source/core/loader/MixedContentChecker.cpp
index 00e80ada96be37a798c2b94e938c83ae22280f4a..61189883e9986ecaa0ec3787753200b06fe046c4 100644
--- a/Source/core/loader/MixedContentChecker.cpp
+++ b/Source/core/loader/MixedContentChecker.cpp
@@ -291,6 +291,10 @@ bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, const ResourceRequ
SecurityOrigin* securityOrigin = frame->document()->securityOrigin();
bool allowed = false;
+ // If we're in strict mode, we'll automagically fail everything, and intentionally skip
+ // the client checks in order to prevent degrading the site's security UI.
+ bool strictMode = frame->document()->shouldEnforceStrictMixedContentChecking();
+
ContextType contextType = contextTypeFromContext(resourceRequest.requestContext());
if (contextType == ContextTypeBlockableUnlessLax)
contextType = RuntimeEnabledFeatures::laxMixedContentCheckingEnabled() ? ContextTypeOptionallyBlockable : ContextTypeBlockable;
@@ -306,13 +310,13 @@ bool MixedContentChecker::shouldBlockFetch(LocalFrame* frame, const ResourceRequ
switch (contextType) {
case ContextTypeOptionallyBlockable:
- allowed = client->allowDisplayingInsecureContent(settings && settings->allowDisplayOfInsecureContent(), securityOrigin, url);
+ allowed = !strictMode && client->allowDisplayingInsecureContent(settings && settings->allowDisplayOfInsecureContent(), securityOrigin, url);
if (allowed)
client->didDisplayInsecureContent();
break;
case ContextTypeBlockable:
- allowed = client->allowRunningInsecureContent(settings && settings->allowRunningOfInsecureContent(), securityOrigin, url);
+ allowed = !strictMode && client->allowRunningInsecureContent(settings && settings->allowRunningOfInsecureContent(), securityOrigin, url);
if (allowed)
client->didRunInsecureContent(securityOrigin, url);
break;
« no previous file with comments | « Source/core/loader/FrameLoader.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698