blob: 06e2ab2b5562b7e467f0b22e9c13124403d8fd3b [file] [log] [blame]
<!DOCTYPE html>
<title>Tests that removing an active cue does not crash the browser.</title>
<script src="../media-file.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<video></video>
<script>
async_test(function(t) {
var video = document.querySelector("video");
video.src = findMediaFile("video", "../content/test");
// Add a text track to the video element.
video.addTextTrack("captions", "regular captions track", "en");
// Add a cue to the track with enter event listener.
var cue = new VTTCue(0, 4, "Random");
cue.onenter = t.step_func_done(removeActiveCue);
var track = video.textTracks[0];
track.addCue(cue);
function removeActiveCue() {
assert_equals(track.activeCues.length, 1);
// Remove the cue while it is active.
track.removeCue(track.activeCues[0]);
// No crash. PASS.
}
// Play the video and remove cue when it becomes active.
video.play();
track.mode = "showing";
});
</script>