Skip to content

Commit

Permalink
Setting "" as <track> 'src' should fail the first time
Browse files Browse the repository at this point in the history
When setting a track .src to "", we would resolve the URL to a null URL,
which matched the default initialized HTMLTrackElement::url_, meaning
that readyState was not advanced and no 'error' event fired in this
case.

Extend the "url == url_" check with a check for readyState differing from
'none'. Also rewrite HTMLTrackElement::getReadyState to avoid using
EnsureTrack().

Bug: 811713
Change-Id: Icd190492639c53e09a7e018202b69ac6e919a94c
Reviewed-on: https://chromium-review.googlesource.com/916004
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Reviewed-by: srirama chandra sekhar <srirama.m@samsung.com>
Cr-Commit-Position: refs/heads/master@{#536685}
  • Loading branch information
Fredrik Söderquist authored and chromium-wpt-export-bot committed Feb 14, 2018
1 parent 783faf5 commit ca76cf8
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<title>Setting HTMLTrackElement.src to the empty string fires 'error' and sets readyState to ERROR</title>
<link rel="help" href="https://html.spec.whatwg.org/multipage/media.html#sourcing-out-of-band-text-tracks">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(t => {
let track = document.createElement("track");
track.src = '';
track.default = true;
track.onerror = t.step_func_done(() => {
assert_equals(track.readyState, HTMLTrackElement.ERROR);
});
track.onload = t.unreached_func('fired load');

assert_equals(track.readyState, HTMLTrackElement.NONE);

document.querySelector('video').appendChild(track);
});
</script>

0 comments on commit ca76cf8

Please sign in to comment.