tor-browser

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

doc-audiocontext.html (1165B)


      1 <!-- Any copyright is dedicated to the Public Domain.
      2     http://creativecommons.org/publicdomain/zero/1.0/ -->
      3 <!doctype html>
      4 
      5 <html>
      6 <head>
      7 <meta charset="utf-8"/>
      8 <title>Debugger test page</title>
      9 </head>
     10 
     11 <body>
     12 <button id="start" onclick="myFunction()">start ac</button>
     13 <button id="suspend" onclick="suspendAC()">suspend ac</button>
     14 <button id="break" onclick="debuggerStatement()">break</button>
     15 <button id="check" onclick="checkACState()">check ac state</button>
     16 <script type="text/javascript">
     17 var ac = null;
     18 async function suspendAC() {
     19  await ac.suspend();
     20 }
     21 
     22 function debuggerStatement() {
     23  debugger;
     24 }
     25 
     26 function checkACState() {
     27  if (ac.state != "suspended") {
     28    throw "AudioContext should be suspended.";
     29  }
     30 }
     31 
     32 async function myFunction() {
     33  await new Promise((resolve) => {
     34    ac = new AudioContext();
     35    function statechange_suspend() {
     36      ac.onstatechange = statechange_fail;
     37    }
     38    function statechange_fail() {
     39      throw "No state change should occur when paused in the debugger.";
     40    }
     41    ac.onstatechange = function() {
     42      ac.onstatechange = statechange_suspend;
     43      resolve();
     44    }
     45  });
     46 }
     47 </script>
     48 </body>
     49 </html>