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

Unified Diff: third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp

Issue 2330353007: Add usage counters to XSSAuditor. (Closed)
Patch Set: Fixed Created 4 years, 3 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/html/parser/XSSAuditor.cpp
diff --git a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
index 37133201437ceb9d9055f0e861b4c03beb5efdd7..ef7d3de66e15f033cff2958743df17e5bdc67c79 100644
--- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
+++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
@@ -345,6 +345,17 @@ void XSSAuditor::init(Document* document, XSSAuditorDelegate* auditorDelegate)
// Process the X-XSS-Protection header, then mix in the CSP header's value.
ReflectedXSSDisposition xssProtectionHeader = parseXSSProtectionHeader(headerValue, errorDetails, errorPosition, reportURL);
+
+ if (xssProtectionHeader == AllowReflectedXSS)
+ UseCounter::count(*document, UseCounter::XSSAuditorDisabled);
+ else if (xssProtectionHeader == FilterReflectedXSS)
+ UseCounter::count(*document, UseCounter::XSSAuditorEnabledFilter);
+ else if (xssProtectionHeader == BlockReflectedXSS)
+ UseCounter::count(*document, UseCounter::XSSAuditorEnabledBlock);
+ else if (xssProtectionHeader == ReflectedXSSInvalid)
+ UseCounter::count(*document, UseCounter::XSSAuditorInvalid);
+
+
m_didSendValidXSSProtectionHeader = xssProtectionHeader != ReflectedXSSUnset && xssProtectionHeader != ReflectedXSSInvalid;
if ((xssProtectionHeader == FilterReflectedXSS || xssProtectionHeader == BlockReflectedXSS) && !reportURL.isEmpty()) {
xssProtectionReportURL = document->completeURL(reportURL);
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | third_party/WebKit/Source/core/html/parser/XSSAuditorDelegate.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698