Commit 180f3cc0 authored by Joey Arhar's avatar Joey Arhar Committed by Chromium LUCI CQ

Add UseCounter for embed element src changed

When modifying the src property of an embed element, the contents are
not currently changed unless there is also a type property/attribute on
the embed element.
crbug.com/1035330 suggests that embed elements should load the new src
when it is changed regardless of the type attribute, and this UseCounter
will be used to determine the impact of this change in behavior.

Bug: 1035330
Change-Id: I011abbf5e2aa8e9a7f5065d6c401c95a3c0b12fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2616722Reviewed-by: default avatarMason Freed <masonfreed@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841288}
parent 99afdb38
...@@ -3064,6 +3064,7 @@ enum WebFeature { ...@@ -3064,6 +3064,7 @@ enum WebFeature {
kCrossOriginSubframeWithoutEmbeddingControl = 3742, kCrossOriginSubframeWithoutEmbeddingControl = 3742,
kReadableStreamWithByteSource = 3743, kReadableStreamWithByteSource = 3743,
kReadableStreamBYOBReader = 3744, kReadableStreamBYOBReader = 3744,
kEmbedElementWithoutTypeSrcChanged = 3745,
// 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.
......
...@@ -126,6 +126,9 @@ void HTMLEmbedElement::ParseAttribute( ...@@ -126,6 +126,9 @@ void HTMLEmbedElement::ParseAttribute(
if (FastHasAttribute(html_names::kTypeAttr)) { if (FastHasAttribute(html_names::kTypeAttr)) {
SetNeedsPluginUpdate(true); SetNeedsPluginUpdate(true);
ReattachOnPluginChangeIfNeeded(); ReattachOnPluginChangeIfNeeded();
} else {
UseCounter::Count(GetDocument(),
WebFeature::kEmbedElementWithoutTypeSrcChanged);
} }
} }
} else { } else {
......
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<embed id=embedid src="../http/tests/resources/test.mp4">
<script>
test(() => {
embedid.src = '../http/tests/resources/test.webm';
assert_true(internals.isUseCounted(document, 3745));
}, 'Verifies that changing embed src gets use counted.');
</script>
...@@ -30755,6 +30755,7 @@ Called by update_use_counter_feature_enum.py.--> ...@@ -30755,6 +30755,7 @@ Called by update_use_counter_feature_enum.py.-->
<int value="3742" label="CrossOriginSubframeWithoutEmbeddingControl"/> <int value="3742" label="CrossOriginSubframeWithoutEmbeddingControl"/>
<int value="3743" label="ReadableStreamWithByteSource"/> <int value="3743" label="ReadableStreamWithByteSource"/>
<int value="3744" label="ReadableStreamBYOBReader"/> <int value="3744" label="ReadableStreamBYOBReader"/>
<int value="3745" label="EmbedElementWithoutTypeSrcChanged"/>
</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