tor-browser

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

job-queue-04.js (1012B)


      1 // Bug 1527862: Don't assert that the Debugger drained its job queue unless we
      2 // actually saved the debuggee's queue.
      3 
      4 // Put a job in the queue.
      5 Promise.resolve(42).then(() => {});
      6 
      7 var g = newGlobal({ newCompartment: true });
      8 var dbg = new Debugger(g);
      9 dbg.onNewScript = script => {};
     10 
     11 // Cause an OOM while initializing the AutoDebuggerJobQueueInterruption, so that
     12 // the destructor is run on an uninitialized instance.
     13 //
     14 // A properly initialized AutoDebuggerJobQueueInterruption asserts that the
     15 // debugger left its job queue entry, before restoring the debuggee's job queue
     16 // that it saved when it was initialized. But if OOM interrupts initialization,
     17 // the job queue left on the JSContext is still the debuggee's, which we have no
     18 // reason to expect is empty, so we shouldn't make any assertions about its
     19 // state. The assertion must be conditional on proper initialization (and use
     20 // the correct condition).
     21 oomTest(() => {
     22    g.eval("(function() {})");
     23 }, {expectExceptionOnFailure: false});