Bug 1945643 - Update to mozilla-nimbus-schemas 2025.1.1 r=chumphreys
[gecko.git] / dom / media / webvtt / test / mochitest / test_bug1018933.html
blob0d1109d09c5c811bf698d4e4e00e78bb9cb04410
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1018933
5 -->
6 <head>
7 <meta charset='utf-8'>
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"/>
11 </head>
12 <body>
13 <p id="display"></p>
14 <div id="content">
15 </div>
16 <pre id="test">
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);
40 return;
43 is(video.textTracks.length, 1, "Video should have one TextTrack.");
44 SimpleTest.finish();
45 });
46 </script>
47 </pre>
48 </body>
49 </html>