Commit 1c086040 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

Stop counting kWorkerAllowedByChildBlockedByScript

To reduce GetDocument() usage.
As https://github.com/w3c/webappsec-csp/issues/146 has already been
closed and the Blink implemetation has been changed,
this UseCounter is no longer needed.

Bug: 878274
Change-Id: Icb55058d369b29992436229a9b971bc6f0b8f2a6
Reviewed-on: https://chromium-review.googlesource.com/c/1192303Reviewed-by: default avatarMike West <mkwst@chromium.org>
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#614762}
parent 45be21a4
......@@ -155,8 +155,6 @@ enum WebFeature {
kFormAssociationByParser = 248,
kSVGSVGElementInDocument = 250,
kSVGDocumentRootElement = 251,
kWorkerSubjectToCSP = 257,
kWorkerAllowedByChildBlockedByScript = 258,
kDeprecatedWebKitGradient = 260,
kDeprecatedWebKitLinearGradient = 261,
kDeprecatedWebKitRepeatingLinearGradient = 262,
......
......@@ -1038,41 +1038,6 @@ bool ContentSecurityPolicy::AllowWorkerContextFromSource(
RedirectStatus redirect_status,
SecurityViolationReportingPolicy reporting_policy,
CheckHeaderType check_header_type) const {
// CSP 1.1 moves workers from 'script-src' to the new 'child-src'. Measure the
// impact of this backwards-incompatible change.
// TODO(mkwst): We reverted this.
if (Document* document = this->GetDocument()) {
UseCounter::Count(*document, WebFeature::kWorkerSubjectToCSP);
bool is_allowed_worker = true;
if (!ShouldBypassContentSecurityPolicy(url, execution_context_)) {
for (const auto& policy : policies_) {
if (!CheckHeaderTypeMatches(check_header_type, policy->HeaderType()))
continue;
is_allowed_worker &= policy->AllowWorkerFromSource(
url, redirect_status,
SecurityViolationReportingPolicy::kSuppressReporting);
}
}
bool is_allowed_script = true;
if (!ShouldBypassContentSecurityPolicy(url, execution_context_)) {
for (const auto& policy : policies_) {
if (!CheckHeaderTypeMatches(check_header_type, policy->HeaderType()))
continue;
is_allowed_script &= policy->AllowScriptFromSource(
url, AtomicString(), IntegrityMetadataSet(), kNotParserInserted,
redirect_status,
SecurityViolationReportingPolicy::kSuppressReporting);
}
}
if (is_allowed_worker && !is_allowed_script) {
UseCounter::Count(*document,
WebFeature::kWorkerAllowedByChildBlockedByScript);
}
}
if (ShouldBypassContentSecurityPolicy(url, execution_context_))
return true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment