tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug1018933.html (1365B)


      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();
     19 
     20 var video = document.createElement("video");
     21 video.src = "seek.webm";
     22 video.preload = "auto";
     23 
     24 var trackElement = document.createElement("track");
     25 trackElement.src = "basic.vtt";
     26 trackElement.kind = "subtitles";
     27 
     28 document.getElementById("content").appendChild(video);
     29 video.appendChild(trackElement);
     30 
     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';
     34 
     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;
     41  }
     42 
     43  is(video.textTracks.length, 1, "Video should have one TextTrack.");
     44  SimpleTest.finish();
     45 });
     46 </script>
     47 </pre>
     48 </body>
     49 </html>