tor-browser

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

constructor-allowed-to-start.html (1125B)


      1 <!doctype html>
      2 <title>AudioContext state around "allowed to start" in constructor</title>
      3 <link rel=help href=https://webaudio.github.io/web-audio-api/#dom-audiocontext-audiocontext>
      4 <script src=/resources/testharness.js></script>
      5 <script src=/resources/testharnessreport.js></script>
      6 <script src=/resources/testdriver.js></script>
      7 <script src=/resources/testdriver-vendor.js></script>
      8 <script>
      9 setup({ single_test: true });
     10 test_driver.bless("audio playback", () => {
     11  const ctx = new AudioContext();
     12  // Immediately after the constructor the state is "suspended" because the
     13  // control message to start processing has just been sent, but the state
     14  // should change soon.
     15  assert_equals(ctx.state, "suspended", "initial state");
     16  ctx.onstatechange = () => {
     17    assert_equals(ctx.state, "running", "state after statechange event");
     18    // Now create another context and ensure it starts out in the "suspended"
     19    // state too, ensuring it's not synchronously "running".
     20    const ctx2 = new AudioContext();
     21    assert_equals(ctx2.state, "suspended", "initial state of 2nd context");
     22    done();
     23  };
     24 });
     25 </script>