tor-browser

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

Debugger-onEnterFrame-resumption-06.js (831B)


      1 // |jit-test| error:all-jobs-completed-successfully
      2 // Verifiy that onEnterFrame's force-return queues the promise microtask
      3 // to run in the debuggee's job queue, not the debugger's
      4 // AutoDebuggerJobQueueInterruption.
      5 
      6 let g = newGlobal({ newCompartment: true });
      7 g.eval(`
      8  async function asyncFn(x) {
      9    await Promise.resolve();
     10  }
     11  function enterDebuggee(){}
     12 `);
     13 const dbg = new Debugger(g);
     14 
     15 (async function() {
     16  let it = g.asyncFn();
     17 
     18  // Force-return when the await resumes.
     19  dbg.onEnterFrame = () => {
     20    dbg.onEnterFrame = undefined;
     21    return { return: "exit" };
     22  };
     23 
     24  const result = await it;
     25  assertEq(result, "exit");
     26  // If execution here is resumed from the debugger's queue, this call will
     27  // trigger DebuggeeWouldRun exception.
     28  g.enterDebuggee();
     29 
     30  throw "all-jobs-completed-successfully";
     31 })();