Commit 9ed18b4e authored by Ian Clelland's avatar Ian Clelland Committed by Commit Bot

Add use counter for comma as separator in allow attribute.

Bug: 1062400
Change-Id: I787f4996c76946b53e67122672ef085036ee33c0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2323821Reviewed-by: default avatarYoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Ian Clelland <iclelland@chromium.org>
Cr-Commit-Position: refs/heads/master@{#792348}
parent e2dc9772
...@@ -2687,6 +2687,7 @@ enum WebFeature { ...@@ -2687,6 +2687,7 @@ enum WebFeature {
kV8PointerEvent_AltitudeAngle_AttributeGetter = 3352, kV8PointerEvent_AltitudeAngle_AttributeGetter = 3352,
kCrossBrowsingContextGroupMainFrameNulledNonEmptyNameAccessed = 3353, kCrossBrowsingContextGroupMainFrameNulledNonEmptyNameAccessed = 3353,
kPositionSticky = 3354, kPositionSticky = 3354,
kCommaSeparatorInAllowAttribute = 3355,
// Add new features immediately above this line. Don't change assigned // Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots. // numbers of any item, and don't reuse removed slots.
......
...@@ -253,6 +253,10 @@ void HTMLIFrameElement::ParseAttribute( ...@@ -253,6 +253,10 @@ void HTMLIFrameElement::ParseAttribute(
UseCounter::Count(GetDocument(), UseCounter::Count(GetDocument(),
WebFeature::kFeaturePolicyAllowAttribute); WebFeature::kFeaturePolicyAllowAttribute);
} }
if (value.Contains(',')) {
UseCounter::Count(GetDocument(),
WebFeature::kCommaSeparatorInAllowAttribute);
}
} }
} else if (name == html_names::kDisallowdocumentaccessAttr && } else if (name == html_names::kDisallowdocumentaccessAttr &&
RuntimeEnabledFeatures::DisallowDocumentAccessEnabled()) { RuntimeEnabledFeatures::DisallowDocumentAccessEnabled()) {
......
...@@ -403,4 +403,20 @@ TEST_F(HTMLIFrameElementSimTest, AllowAttributeParsingError) { ...@@ -403,4 +403,20 @@ TEST_F(HTMLIFrameElementSimTest, AllowAttributeParsingError) {
<< ConsoleMessages().front(); << ConsoleMessages().front();
} }
TEST_F(HTMLIFrameElementSimTest, CommaSeparatorIsCounted) {
EXPECT_FALSE(
GetDocument().Loader()->GetUseCounterHelper().HasRecordedMeasurement(
WebFeature::kCommaSeparatorInAllowAttribute));
SimRequest main_resource("https://example.com", "text/html");
LoadURL("https://example.com");
main_resource.Complete(R"(
<iframe
allow="fullscreen, geolocation"></iframe>
)");
EXPECT_TRUE(
GetDocument().Loader()->GetUseCounterHelper().HasRecordedMeasurement(
WebFeature::kCommaSeparatorInAllowAttribute));
}
} // namespace blink } // namespace blink
...@@ -28553,6 +28553,7 @@ Called by update_use_counter_feature_enum.py.--> ...@@ -28553,6 +28553,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3353" <int value="3353"
label="CrossBrowsingContextGroupMainFrameNulledNonEmptyNameAccessed"/> label="CrossBrowsingContextGroupMainFrameNulledNonEmptyNameAccessed"/>
<int value="3354" label="PositionSticky"/> <int value="3354" label="PositionSticky"/>
<int value="3355" label="CommaSeparatorInAllowAttribute"/>
</enum> </enum>
<enum name="FeaturePolicyAllowlistType"> <enum name="FeaturePolicyAllowlistType">
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