tor-browser

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

pause-remove-from-document-different-load.html (1355B)


      1 <!doctype html>
      2 <title>paused state when removing from a document</title>
      3 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1583052">
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="/common/media.js"></script>
      7 <div id="log"></div>
      8 <div>
      9  <video hidden></video>
     10 </div>
     11 <script>
     12 function afterStableState(func) {
     13  var a = new Audio();
     14  a.volume = 0;
     15  a.addEventListener('volumechange', func);
     16 }
     17 
     18 async_test(function(t) {
     19  var v = document.querySelector('video');
     20 
     21  // Much like pause-remove-from-document.html, modulo this call.
     22  document.body.appendChild(v);
     23 
     24  v.src = getVideoURI('/media/movie_300');
     25  v.play();
     26  v.onplaying = t.step_func(function() {
     27    assert_false(v.paused, 'paused after playing');
     28    v.parentNode.removeChild(v);
     29    assert_false(v.paused, 'paused after removing');
     30    afterStableState(t.step_func(function() {
     31      assert_true(v.paused, 'paused after stable state');
     32      v.onpause = t.step_func(function() {
     33        assert_true(v.paused, 'paused in pause event');
     34        // re-insert and verify that it stays paused
     35        document.body.appendChild(v);
     36        t.step_timeout(function() {
     37          assert_true(v.paused, 'paused after re-inserting');
     38          t.done();
     39        }, 0);
     40      });
     41    }));
     42  });
     43 });
     44 </script>