Changeset 133325 in webkit
- Timestamp:
- Nov 2, 2012, 11:54:46 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r133324 r133325 1 2012-11-02 Mike West <mkwst@chromium.org> 2 3 Measure the usage of the various CSP headers. 4 https://bugs.webkit.org/show_bug.cgi?id=100974 5 6 Reviewed by Adam Barth. 7 8 Currently, we're collecting metrics regarding usage of the 9 'X-WebKit-CSP' and 'X-WebKit-CSP-Report-Only' HTTP headers. We've 10 recently added support for the canonical 'Content-Security-Policy' 11 and 'Content-Security-Policy-Report-Only' headers. This patch adds 12 those headers explicitly into the metrics, giving insight into uptake 13 of the unprefixed header, and into usage of pure reporting vs. 14 enforcement. 15 16 No visible functionality should change; all Content Security Policy 17 tests should continue to pass. 18 19 * page/ContentSecurityPolicy.cpp: 20 (WebCore::ContentSecurityPolicy::didReceiveHeader): 21 Convert the CSP header type into a FeatureObserver::Feature, and 22 observe it. 23 * page/FeatureObserver.h: 24 Add three new values to the enum to cover the new header types. 25 1 26 2012-11-02 Ojan Vafai <ojan@chromium.org> 2 27 -
trunk/Source/WebCore/page/ContentSecurityPolicy.cpp
r133323 r133325 141 141 #endif 142 142 ); 143 } 144 145 FeatureObserver::Feature getFeatureObserverType(ContentSecurityPolicy::HeaderType type) 146 { 147 switch (type) { 148 case ContentSecurityPolicy::EnforceAllDirectives: 149 return FeatureObserver::PrefixedContentSecurityPolicy; 150 case ContentSecurityPolicy::EnforceStableDirectives: 151 return FeatureObserver::ContentSecurityPolicy; 152 case ContentSecurityPolicy::ReportAllDirectives: 153 return FeatureObserver::PrefixedContentSecurityPolicyReportOnly; 154 case ContentSecurityPolicy::ReportStableDirectives: 155 return FeatureObserver::ContentSecurityPolicyReportOnly; 156 } 157 ASSERT_NOT_REACHED(); 158 return FeatureObserver::NumberOfFeatures; 143 159 } 144 160 … … 1330 1346 Document* document = static_cast<Document*>(m_scriptExecutionContext); 1331 1347 if (document->domWindow()) 1332 FeatureObserver::observe(document->domWindow(), FeatureObserver::PrefixedContentSecurityPolicy);1348 FeatureObserver::observe(document->domWindow(), getFeatureObserverType(type)); 1333 1349 } 1334 1350 -
trunk/Source/WebCore/page/FeatureObserver.h
r132125 r133325 55 55 UnprefixedRequestAnimationFrame, 56 56 PrefixedRequestAnimationFrame, 57 ContentSecurityPolicy, 58 ContentSecurityPolicyReportOnly, 59 PrefixedContentSecurityPolicyReportOnly, 57 60 // Add new features above this line. 58 61 NumberOfFeatures, // This enum value must be last.
Note:
See TracChangeset
for help on using the changeset viewer.