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

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

Issue 2626243002: Add some <base> metrics to guide experimentation. (Closed)
Patch Set: One more. Created 3 years, 11 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/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
diff --git a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
index 6b7bbc7b4f277e446097753857aaaea1d56499ee..d3a63a2f37e0fb9940067aa4ac934e29f7825013 100644
--- a/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
+++ b/third_party/WebKit/Source/core/frame/csp/CSPDirectiveList.cpp
@@ -760,12 +760,20 @@ bool CSPDirectiveList::allowBaseURI(
const KURL& url,
ResourceRequest::RedirectStatus redirectStatus,
ContentSecurityPolicy::ReportingStatus reportingStatus) const {
- return reportingStatus == ContentSecurityPolicy::SendReport
- ? checkSourceAndReportViolation(
- m_baseURI.get(), url,
- ContentSecurityPolicy::DirectiveType::BaseURI,
- redirectStatus)
- : checkSource(m_baseURI.get(), url, redirectStatus);
+ bool result =
+ reportingStatus == ContentSecurityPolicy::SendReport
+ ? checkSourceAndReportViolation(
+ m_baseURI.get(), url,
+ ContentSecurityPolicy::DirectiveType::BaseURI, redirectStatus)
+ : checkSource(m_baseURI.get(), url, redirectStatus);
+
+ if (result &&
+ !checkSource(operativeDirective(m_baseURI.get()), url, redirectStatus)) {
+ UseCounter::count(m_policy->document(),
+ UseCounter::BaseWouldBeBlockedByDefaultSrc);
+ }
+
+ return result;
}
bool CSPDirectiveList::allowWorkerFromSource(
« no previous file with comments | « third_party/WebKit/Source/core/frame/UseCounter.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698