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

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

Issue 2330353007: Add usage counters to XSSAuditor. (Closed)
Patch Set: 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..852b5cbabe41e12ff96cdb76b81350269e7de2dc 100644
--- a/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
+++ b/third_party/WebKit/Source/core/html/parser/XSSAuditor.cpp
@@ -345,6 +345,14 @@ 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);
+
m_didSendValidXSSProtectionHeader = xssProtectionHeader != ReflectedXSSUnset && xssProtectionHeader != ReflectedXSSInvalid;
if ((xssProtectionHeader == FilterReflectedXSS || xssProtectionHeader == BlockReflectedXSS) && !reportURL.isEmpty()) {
xssProtectionReportURL = document->completeURL(reportURL);

Powered by Google App Engine
This is Rietveld 408576698