tor-browser

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

audiocontext-getoutputtimestamp-cross-realm.html (1303B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>
      5      Testing AudioContext.getOutputTimestamp() method (cross-realm)
      6    </title>
      7    <script src="/resources/testharness.js"></script>
      8    <script src="/resources/testharnessreport.js"></script>
      9    <script src="/webaudio/resources/audit.js"></script>
     10  </head>
     11  <body>
     12    <script id="layout-test-code">
     13      const audit = Audit.createTaskRunner();
     14 
     15      audit.define("getoutputtimestamp-cross-realm", function(task, should) {
     16        const mainContext = new AudioContext();
     17        return task.timeout(() => {
     18          const iframe = document.createElement("iframe");
     19          document.body.append(iframe);
     20          const iframeContext = new iframe.contentWindow.AudioContext();
     21 
     22          should(mainContext.getOutputTimestamp().performanceTime, "mainContext's performanceTime")
     23            .beGreaterThan(iframeContext.getOutputTimestamp().performanceTime, "iframeContext's performanceTime");
     24          should(iframeContext.getOutputTimestamp.call(mainContext).performanceTime, "mainContext's performanceTime (via iframeContext's method)")
     25            .beCloseTo(mainContext.getOutputTimestamp().performanceTime, "mainContext's performanceTime", { threshold: 0.01 });
     26        }, 1000);
     27      });
     28 
     29      audit.run();
     30    </script>
     31  </body>
     32 </html>