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

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

Issue 2745363004: PlzNavigate: send SourceLocation when mixed content is found (Closed)
Patch Set: Rebase Created 3 years, 9 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 0951587ae207c40d8b7a80a6833b48136048d978..58049c472e8546eb39e6f6eb869473130a435faa 100644
--- a/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
+++ b/third_party/WebKit/Source/core/loader/MixedContentChecker.cpp
@@ -221,7 +221,8 @@ void MixedContentChecker::logToConsoleAboutFetch(
const KURL& mainResourceUrl,
const KURL& url,
WebURLRequest::RequestContext requestContext,
- bool allowed) {
+ bool allowed,
+ std::unique_ptr<SourceLocation> sourceLocation) {
String message = String::format(
"Mixed Content: The page at '%s' was loaded over HTTPS, but requested an "
"insecure %s '%s'. %s",
@@ -231,8 +232,14 @@ void MixedContentChecker::logToConsoleAboutFetch(
: "This request has been blocked; the content must be served "
"over HTTPS.");
MessageLevel messageLevel = allowed ? WarningMessageLevel : ErrorMessageLevel;
- frame->document()->addConsoleMessage(
- ConsoleMessage::create(SecurityMessageSource, messageLevel, message));
+ if (sourceLocation) {
+ frame->document()->addConsoleMessage(
+ ConsoleMessage::create(SecurityMessageSource, messageLevel, message,
+ std::move(sourceLocation)));
+ } else {
+ frame->document()->addConsoleMessage(
+ ConsoleMessage::create(SecurityMessageSource, messageLevel, message));
+ }
}
// static
@@ -396,7 +403,7 @@ bool MixedContentChecker::shouldBlockFetch(
if (reportingPolicy == SecurityViolationReportingPolicy::Report) {
logToConsoleAboutFetch(frame, mainResourceUrlForFrame(mixedFrame), url,
- requestContext, allowed);
+ requestContext, allowed, nullptr);
}
return !allowed;
}
@@ -578,10 +585,11 @@ void MixedContentChecker::mixedContentFound(
const KURL& mixedContentUrl,
WebURLRequest::RequestContext requestContext,
bool wasAllowed,
- bool hadRedirect) {
+ bool hadRedirect,
+ std::unique_ptr<SourceLocation> sourceLocation) {
// Logs to the frame console.
logToConsoleAboutFetch(frame, mainResourceUrl, mixedContentUrl,
- requestContext, wasAllowed);
+ requestContext, wasAllowed, std::move(sourceLocation));
// Reports to the CSP policy.
ContentSecurityPolicy* policy =
frame->securityContext()->contentSecurityPolicy();
« no previous file with comments | « third_party/WebKit/Source/core/loader/MixedContentChecker.h ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698