tor-browser

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

resource-selection-invoke-remove-from-document-networkState.html (976B)


      1 <!doctype html>
      2 <title>NOT invoking resource selection with implicit pause() when networkState is not NETWORK_EMPTY</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id=log></div>
      6 <video></video>
      7 <script>
      8 var v;
      9 var t = async_test(function(t) {
     10  v = document.querySelector('video');
     11  v.src = 'data:,';
     12  document.body.appendChild(v);
     13  assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState after setting src');
     14  var errorCount = 0;
     15  v.onerror = t.step_func(function() {
     16    errorCount++;
     17    if (errorCount == 1) {
     18      assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState in onerror');
     19      document.body.removeChild(v); // invokes pause() which should not invoke RSA. if it does, error will be fired again.
     20    } else {
     21      assert_unreached();
     22    }
     23  });
     24  onload = t.step_func(function() {
     25    assert_equals(errorCount, 1, 'errorCount');
     26    t.done();
     27  });
     28 });
     29 </script>