tor-browser

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

event_pause_noautoplay.html (1496B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4  <title>{audio,video} events - pause</title>
      5  <script src="/resources/testharness.js"></script>
      6  <script src="/resources/testharnessreport.js"></script>
      7  <script src="/common/media.js"></script>
      8 </head>
      9 <body>
     10  <p><a href="https://html.spec.whatwg.org/multipage/#mediaevents">spec reference</a></p>
     11  <audio id="a" controls>
     12  </audio>
     13  <video id="v" controls>
     14  </video>
     15  <div id="log"></div>
     16  <script>
     17 promise_test(function(t) {
     18  var async_t = async_test("calling play() then pause() on non-autoplay audio should trigger pause event");
     19  var a = document.getElementById("a");
     20  a.addEventListener("pause", function() {
     21    async_t.done();
     22  }, false);
     23  a.src = getAudioURI("/media/sound_5") + "?" + new Date() + Math.random();
     24  var play_promise = a.play();
     25  a.pause();
     26  return promise_rejects_dom(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
     27 }, "audio events - pause");
     28 
     29 promise_test(function(t) {
     30  var async_t = async_test("calling play() then pause() on non-autoplay video should trigger pause event");
     31  var v = document.getElementById("v");
     32  v.addEventListener("pause", function() {
     33    async_t.done();
     34  }, false);
     35  v.src = getVideoURI("/media/movie_5") + "?" + new Date() + Math.random();
     36  var play_promise = v.play()
     37  v.pause();
     38  return promise_rejects_dom(t, "AbortError", play_promise, "pause() should reject all pending play Promises");
     39 }, "video events - pause");
     40  </script>
     41 </body>
     42 </html>