tor-browser

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

Frame-olderSavedFrame-02.js (900B)


      1 // An explicit async stack should be available via olderSavedFrame.
      2 // This test makes sure that "main" shows up as an async saved frame properly
      3 // when the promise is resumed normally outside "main()".
      4 
      5 var g = newGlobal({ newCompartment: true });
      6 var dbg = new Debugger(g);
      7 let done = false;
      8 dbg.onDebuggerStatement = function (frame) {
      9  // This frame has an "olderSavedFrame" because "run()" is an async function
     10  // and those have explicit async stacks attached to them.
     11  const parent = frame.olderSavedFrame;
     12  assertEq(typeof parent.source, "string");
     13  assertEq(parent.line, 9);
     14  assertEq(parent.column, 3);
     15  assertEq(parent.asyncCause, "async");
     16  assertEq(parent.functionDisplayName, "main");
     17  done = true;
     18 };
     19 
     20 g.eval(`
     21 let draining = false;
     22 async function run() {
     23  await Promise.resolve();
     24  debugger;
     25 }
     26 
     27 (function main() {
     28  run();
     29 })();
     30 drainJobQueue();
     31 `);
     32 assertEq(done, true);