tor-browser

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

test_setInterval_uncatchable_exception.html (1391B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1252268
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1252268</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1252268">Mozilla Bug 1252268</a>
     14 
     15 <script type="text/javascript">
     16  function go() {
     17    SimpleTest.requestFlakyTimeout("I'm smarter than the test harness");
     18 
     19    var ranOnce = false;
     20    var finished = false;
     21 
     22    var interval = setInterval(function () {
     23      if (ranOnce) {
     24        ok(false, "Don't execute me again!");
     25        clearInterval(interval);
     26        if (!finished) {
     27          finished = true;
     28          SimpleTest.finish();
     29        }
     30      } else {
     31        ranOnce = true;
     32        ok(true, "Ran the first time");
     33        try {
     34          TestFunctions.throwUncatchableException();
     35          ok(false, "How did we get here!");
     36        } catch (e) {
     37          ok(false, "How did we get here!?");
     38        }
     39      }
     40    }, 100);
     41 
     42    setTimeout(function() {
     43      if (!finished) {
     44        finished = true;
     45        SimpleTest.finish();
     46      }
     47    }, 1000);
     48  }
     49 
     50  SimpleTest.waitForExplicitFinish();
     51  SpecialPowers.pushPrefEnv({set: [['dom.expose_test_interfaces', true]]}, go);
     52 </script>
     53 
     54 </body>
     55 </html>