tor-browser

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

interrupt-2.js (663B)


      1 // |jit-test| exitstatus: 6;
      2 
      3 setInterruptCallback(function() {
      4  // Return false from the interrupt handler to stop execution.
      5  return false;
      6 });
      7 
      8 var iterator = {
      9  [Symbol.iterator]() {
     10    return this;
     11  },
     12  next() {
     13    return {value: null, done: false};
     14  },
     15  return() {
     16    // Intentionally use |crash| to cause an abrupt program termination.
     17    crash("unexpected call to return method");
     18  },
     19 };
     20 
     21 for (var v of iterator) {
     22  // Request an interrupt.
     23  interruptIf(true);
     24 
     25  // Exceptions normally run the iterator's "return" method. Ensure the method
     26  // isn't called when an interrupt was requested.
     27  throw new Error("exception in for-of loop");
     28 }