tor-browser

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

test_bug1255618.html (1072B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test sync XHR does not crash unlinked AudioContext</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
      7 </head>
      8 <body>
      9 <script>
     10 SimpleTest.waitForExplicitFinish();
     11 
     12 const filename = "test_bug1255618.html";
     13 
     14 function collect_and_fetch() {
     15    SpecialPowers.forceGC();
     16    SpecialPowers.forceCC();
     17 
     18    var xhr = new XMLHttpRequest();
     19    xhr.open("GET", filename, false);
     20    var ended = false;
     21    xhr.onloadend = function() { ended = true; }
     22    // Sync XHR will suspend timeouts, which involves any AudioContexts still
     23    // registered with the window.
     24    // See https://bugzilla.mozilla.org/show_bug.cgi?id=1255618#c0
     25    xhr.send(null);
     26 
     27    ok(ended, "No crash during fetch");
     28    SimpleTest.finish();
     29 }
     30 
     31 var ac = new AudioContext();
     32 
     33 ac.onstatechange = function () {
     34    ac.onstatechange = null;
     35    is(ac.state, "running", "statechange to running");
     36    ac = null;
     37    SimpleTest.executeSoon(collect_and_fetch);
     38 }
     39 
     40 </script>
     41 </body>