tor-browser

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

test_reset_events_async.html (1862B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=975270
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug </title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script type="application/javascript" src="manifest.js"></script>
     12  <script type="application/javascript">
     13 
     14  /** Test for Bug 975270 */
     15  // Test that 'emptied' and 'abort' events are fired asynchronously when re-starting
     16  // media load.
     17  SimpleTest.waitForExplicitFinish();
     18 
     19  var a = document.createElement("audio");
     20  a._abort = 0;
     21  a._emptied = 0;
     22  a.preload = "metadata"; // On B2G we default to preload:none.
     23 
     24  is(a.networkState, HTMLMediaElement.NETWORK_EMPTY, "Shouldn't be loading");
     25 
     26  a.addEventListener("abort", function() { a._abort++; });
     27  a.addEventListener("emptied", function() { a._emptied++; });
     28  a.addEventListener("loadedmetadata",
     29    function() {
     30      is(a._abort, 0, "Should not have received 'abort' before 'loadedmetadata");
     31      is(a._emptied, 0, "Should not have received 'emptied' before 'loadedmetadata");
     32 
     33      a.addEventListener("loadstart",
     34        function() {
     35          is(a._abort, 1, "Should have received 'abort' before 'loadstart");
     36          is(a._emptied, 1, "Should  have received 'emptied' before 'loadstart");
     37          SimpleTest.finish();
     38        });
     39 
     40      a.src = "";
     41      is(a._abort, 0, "Should not have received 'abort' during setting a.src=''");
     42      is(a._emptied, 0, "Should not have received 'emptied' during setting a.src=''");
     43    });
     44 
     45  a.src = getPlayableAudio(gSmallTests).name;
     46 
     47  </script>
     48 </head>
     49 <body>
     50 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
     51 <p id="display"></p>
     52 <div id="content" style="display: none">
     53 
     54 </div>
     55 <pre id="test">
     56 </pre>
     57 </body>
     58 </html>