Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /html/semantics/embedded-content/media-elements/loading-the-media-resource/resource-selection-candidate-remove-onerror.html - WPT Dashboard Interop Dashboard
<!doctype html>
<title>removing the candidate source, onerror</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id=log></div>
<script>
function createSource(src) {
const source = document.createElement('source');
source.src = src;
return source;
}
promise_test(async t => {
const v = document.createElement('video');
const s = createSource('resources/delayed-broken-video.py');
v.appendChild(s); // invokes resource selection
const s2 = createSource('resources/delayed-broken-video.py?second');
v.appendChild(s2);
s.onerror = t.unreached_func('error fired on removed source');
const s2Error = new Promise(resolve => s2.addEventListener('error', resolve));
await t.step_wait(() => v.currentSrc == s.src, 'candidate selected', 3000, 5);
assert_equals(v.networkState, v.NETWORK_LOADING, 'networkState');
v.removeChild(s);
await s2Error;
});
</script>