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

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

Issue 1905033002: PlzNavigate: Move navigation-level mixed content checks to the browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@console-security-message
Patch Set: Moved methods from ContentBrowserClient to WebContentsDelegate; all caps constant names. Created 3 years, 11 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
Index: third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
diff --git a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
index 51dfb21fc44a42e3c0a98e64b2da0780c1ed4dd3..d36172f5edefea929dd3782a8b803eb300a4f329 100644
--- a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
+++ b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
@@ -294,6 +294,13 @@ bool MixedContentChecker::shouldBlockFetch(
ResourceRequest::RedirectStatus redirectStatus,
const KURL& url,
MixedContentChecker::ReportingStatus reportingStatus) {
+ // Frame-level loads are checked by the browser if PlzNavigate is enabled. No
+ // need to check them again here.
+ if (frame->settings()->getBrowserSideNavigationEnabled() &&
+ frameType != WebURLRequest::FrameTypeNone) {
+ return false;
+ }
+
Frame* effectiveFrame = effectiveFrameForFrameType(frame, frameType);
Frame* mixedFrame =
inWhichFrameIsContentMixed(effectiveFrame, frameType, url);
@@ -563,6 +570,26 @@ void MixedContentChecker::handleCertificateError(
}
}
+// static
+void MixedContentChecker::mixedContentFoundByTheBrowser(
+ LocalFrame* frame,
+ const KURL& mainResourceUrl,
+ const KURL& mixedContentUrl,
+ WebURLRequest::RequestContext requestContext,
+ bool wasAllowed,
+ bool hadRedirect) {
+ logToConsoleAboutFetch(frame, mainResourceUrl, mixedContentUrl,
+ requestContext, wasAllowed);
+ ContentSecurityPolicy* policy =
+ frame->securityContext()->contentSecurityPolicy();
+ if (policy) {
+ policy->reportMixedContent(
+ mixedContentUrl, hadRedirect
+ ? ResourceRequest::RedirectStatus::FollowedRedirect
+ : ResourceRequest::RedirectStatus::NoRedirect);
+ }
+}
+
WebMixedContentContextType MixedContentChecker::contextTypeForInspector(
LocalFrame* frame,
const ResourceRequest& request) {

Powered by Google App Engine
This is Rietveld 408576698