4 https://bugzilla.mozilla.org/show_bug.cgi?id=1018933
8 <title>Regression test for bug
1018933 - HTMLTrackElement should create only one TextTrack
</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
17 <script class=
"testbody" type=
"text/javascript">
18 SimpleTest.waitForExplicitFinish();
20 var video = document.createElement(
"video");
21 video.src =
"seek.webm";
22 video.preload =
"auto";
24 var trackElement = document.createElement(
"track");
25 trackElement.src =
"basic.vtt";
26 trackElement.kind =
"subtitles";
28 document.getElementById(
"content").appendChild(video);
29 video.appendChild(trackElement);
31 // Accessing the track now would have caused the bug as the track element
32 // shouldn't have had time to bind to the tree yet.
33 trackElement.track.mode = 'showing';
35 video.addEventListener(
"loadedmetadata", function run_tests() {
36 // Re-que run_tests() at the end of the event loop until the track
37 // element has loaded its data.
38 if (trackElement.readyState ==
1) {
39 setTimeout(run_tests,
0);
43 is(video.textTracks.length,
1,
"Video should have one TextTrack.");