tor-browser

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

autoplay-with-broken-track.html (1302B)


      1 <!DOCTYPE html>
      2 <link rel="help" href="https://html.spec.whatwg.org/multipage/media.html#text-track-model">
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/media.js"></script>
      6 <div id="log"></div>
      7 <script>
      8 // Media elements have a "list of pending text tracks" which should be populated
      9 // with text tracks with readyState "loading". When the text track src is
     10 // invalid or points to a non-existent resource, it shouldn't be possible to
     11 // block the media element's readyState indefinitely.
     12 function t(trackSrc) {
     13  const track = document.createElement('track');
     14  track.src = trackSrc;
     15  track.default = true;
     16  async_test(t => {
     17    const video = document.createElement('video');
     18    video.autoplay = true;
     19    video.controls = true; // for visual inspection, not part of test
     20    video.src = getVideoURI('/media/movie_5');
     21    video.appendChild(track);
     22    document.body.appendChild(video);
     23    // The playing event isn't used because it's fired in Safari even when the
     24    // playback doesn't actually start.
     25    video.ontimeupdate = t.step_func(() => {
     26      if (video.currentTime > 0)
     27        t.done();
     28    });
     29  }, `<video autoplay> with ${track.outerHTML} child`);
     30 }
     31 t("invalid://url");
     32 t("404");
     33 t("");
     34 </script>