tor-browser

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

test_bug1027864.html (1556B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test bug 1027864</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 <pre id="test">
     10 <script class="testbody" type="text/javascript">
     11 
     12 SimpleTest.waitForExplicitFinish();
     13 
     14 function observer(subject, topic, data) {
     15  var id = parseInt(data);
     16  var index = ids.indexOf(id);
     17  if (index != -1) {
     18    ok(true, "Dropping id " + id + " at index " + index);
     19    ids.splice(index, 1);
     20    if (!ids.length) {
     21      SimpleTest.executeSoon(function() {
     22        SimpleTest.finish();
     23      });
     24    }
     25  }
     26 }
     27 
     28 function id(node) {
     29  return SpecialPowers.getPrivilegedProps(node, "id");
     30 }
     31 
     32 SpecialPowers.addAsyncObserver(observer, "webaudio-node-demise", false);
     33 
     34 SimpleTest.registerCleanupFunction(function() {
     35  SpecialPowers.removeAsyncObserver(observer, "webaudio-node-demise");
     36 });
     37 
     38 var ac = new AudioContext();
     39 var ids;
     40 
     41 (function() {
     42  var delay = ac.createDelay();
     43  delay.delayTime.value = 0.03;
     44 
     45  var gain = ac.createGain();
     46  gain.gain.value = 0.6;
     47 
     48  delay.connect(gain);
     49  gain.connect(delay);
     50 
     51  gain.connect(ac.destination);
     52 
     53  var source = ac.createOscillator();
     54 
     55  source.connect(gain);
     56  source.start(ac.currentTime);
     57  source.stop(ac.currentTime + 0.1);
     58 
     59  ids = [ id(delay), id(gain), id(source) ];
     60 })();
     61 
     62 setInterval(function() {
     63  forceCC();
     64 }, 200);
     65 
     66 function forceCC() {
     67  SpecialPowers.DOMWindowUtils.cycleCollect();
     68  SpecialPowers.DOMWindowUtils.garbageCollect();
     69 }
     70 
     71 </script>
     72 </pre>
     73 </body>
     74 </html>