Chromium Code Reviews| 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..530ad6a5fe180d8d9fa3f1160ed0447664d4f209 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) { |
|
Nate Chapin
2017/03/16 19:54:12
Nit: invert this if() so it doesn't have the '!',
clamy
2017/03/17 13:17:34
Done.
|
| + frame->document()->addConsoleMessage( |
| + ConsoleMessage::create(SecurityMessageSource, messageLevel, message)); |
| + } else { |
| + frame->document()->addConsoleMessage( |
| + ConsoleMessage::create(SecurityMessageSource, messageLevel, message, |
| + std::move(sourceLocation))); |
| + } |
| } |
| // 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(); |