tor-browser

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

test_basic.html (1382B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for Worklet</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      7  <script type="application/javascript" src="common.js"></script>
      8 </head>
      9 <body>
     10 
     11 <script type="application/javascript">
     12 // This function is called into an iframe.
     13 function runTestInIframe() {
     14  var audioContext = new AudioContext();
     15  ok(!!audioContext.audioWorklet, "audioContext.audioWorklet exists");
     16 
     17  // First loading
     18  audioContext.audioWorklet.addModule("common.js")
     19  .then(() => {
     20    ok(true, "Import should load a resource.");
     21  })
     22 
     23  // Second loading - same file
     24  .then(() => {
     25    return audioContext.audioWorklet.addModule("common.js")
     26  })
     27  .then(() => {
     28    ok(true, "Import should load a resource.");
     29  })
     30 
     31  // 3rd loading - a network error
     32  .then(() => {
     33    return audioContext.audioWorklet.addModule("404.js");
     34  })
     35  .then(() => {
     36    ok(false, "The loading should fail.");
     37  }, () => {
     38    ok(true, "The loading should fail.");
     39  })
     40 
     41  // 4th loading - a network error
     42  .then(() => {
     43    return audioContext.audioWorklet.addModule("404.js");
     44  })
     45  .then(() => {
     46    ok(false, "The loading should fail.");
     47  }, () => {
     48    ok(true, "The loading should fail.");
     49  })
     50 
     51  // done
     52  .then(() => {
     53    SimpleTest.finish();
     54  });
     55 }
     56 
     57 </script>
     58 </body>
     59 </html>