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

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

Issue 2032793004: CSP: Add line numbers to reports whenever we have them. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7cdbb53cb8b237c09276f2d5dc9c28cf1efbbf3d 100644
--- a/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/ContentSecurityPolicy.cpp
@@ -895,11 +895,12 @@ void ContentSecurityPolicy::reportViolation(const String& directiveText, const S
cspReport->setString("effective-directive", violationData.effectiveDirective());
cspReport->setString("original-policy", violationData.originalPolicy());
cspReport->setString("blocked-uri", violationData.blockedURI());
- if (!violationData.sourceFile().isEmpty() && violationData.lineNumber()) {
- cspReport->setString("source-file", violationData.sourceFile());
+ if (violationData.lineNumber())
cspReport->setNumber("line-number", violationData.lineNumber());
+ if (violationData.columnNumber())
cspReport->setNumber("column-number", violationData.columnNumber());
- }
+ if (!violationData.sourceFile().isEmpty())
+ cspReport->setString("source-file", violationData.sourceFile());
cspReport->setNumber("status-code", violationData.statusCode());
RefPtr<JSONObject> reportObject = JSONObject::create();
« no previous file with comments | « third_party/WebKit/LayoutTests/http/tests/security/contentSecurityPolicy/report-uri-scheme-relative-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698