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

Unified Diff: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp

Issue 2035263002: Extract SourceLocation for ConsoleMessages on call sites. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2037593004
Patch Set: 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
Index: third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
index 45a274056be1cfd24fb2b7ad848dd124e8c9e181..1a8d6524d0872f075a088f43d2f38b14da2bfc9e 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -1049,13 +1049,11 @@ void ContentSecurityPolicy::reportMissingReportURI(const String& policy)
logToConsole("The Content Security Policy '" + policy + "' was delivered in report-only mode, but does not specify a 'report-uri'; the policy will have no effect. Please either add a 'report-uri' directive, or deliver the policy via the 'Content-Security-Policy' header.");
}
-void ContentSecurityPolicy::logToConsole(const String& message, MessageLevel level)
-{
- logToConsole(ConsoleMessage::create(SecurityMessageSource, level, message));
-}
-
-void ContentSecurityPolicy::logToConsole(ConsoleMessage* consoleMessage, LocalFrame* frame)
+void ContentSecurityPolicy::logToConsole(const String& message, MessageLevel level, PassOwnPtr<SourceLocation> location, LocalFrame* frame)
{
+ if (!location)
+ location = SourceLocation::capture(m_executionContext);
+ ConsoleMessage* consoleMessage = ConsoleMessage::create(SecurityMessageSource, level, message, std::move(location));
if (frame)
frame->document()->addConsoleMessage(consoleMessage);
else if (m_executionContext)

Powered by Google App Engine
This is Rietveld 408576698