Bug 1854761 [wpt PR 42106] - Fix <source> version of the media-src-7_2_2.sub.html test., a=testonly

Automatic update from web-platform-tests
Fix <source> version of the media-src-7_2_2.sub.html test.

<source> elements can't be changed retroactively like the test was
doing. The media element would sometimes start the load and fail
since the source had no content. Instead add the <source> node in
one go.

Fixed: 1484341
Change-Id: I0e2c53fedcee121d59563d140d4d82793fcba5d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4883970
Reviewed-by: Jonathan Hao <phao@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1200339}

--

wpt-commits: f3b2a3dbd7052b19a8bed15eea85e4b768364cee
wpt-pr: 42106
This commit is contained in:
Dale Curtis 2023-09-27 12:17:12 +00:00 коммит произвёл moz-wptsync-bot
Родитель 7764362d11
Коммит bc999e3e4f
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -40,16 +40,17 @@
<audio id="audioObject" width="320" height="240" controls
onloadeddata="media_loaded(source_test)">
<source id="audioSourceObject"
type="audio/ogg"
onerror="media_error_handler(source_test)">
</audio>
<audio id="audioObject2" width="320" height="240" controls
onerror="media_error_handler(src_test)"
onloadeddata="media_loaded(src_test)">
</audio>
<script>
document.getElementById("audioSourceObject").src = mediaURL;
let source = document.createElement("source");
source.src = mediaURL;
source.type = "audio/ogg";
source.onerror = _ => { media_error_handler(source_test); }
document.getElementById("audioObject").appendChild(source);
document.getElementById("audioObject2").src = mediaURL;
</script>