tor-browser

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

clearinterval-from-callback.any.js (471B)


      1 async_test((t) => {
      2  let wasPreviouslyCalled = false;
      3 
      4  const handle = setInterval(
      5    t.step_func(() => {
      6      if (!wasPreviouslyCalled) {
      7        wasPreviouslyCalled = true;
      8 
      9        clearInterval(handle);
     10 
     11        // Make the test succeed after the callback would've run next.
     12        setInterval(t.step_func_done(), 750);
     13      } else {
     14        assert_unreached();
     15      }
     16    }),
     17    500
     18  );
     19 }, "Clearing an interval from the callback should still clear it.");