tor-browser

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

test_stepping-14.js (1285B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /*
      7 * Check that is possible to step into both the inner and outer function
      8 * calls.
      9 */
     10 
     11 add_task(
     12  threadFrontTest(async ({ commands, threadFront }) => {
     13    dumpn("Evaluating test code and waiting for first debugger statement");
     14 
     15    commands.scriptCommand.execute(`(function () {
     16        async function f() {
     17          const p = Promise.resolve(43);
     18          await p;
     19          return p;
     20        }
     21 
     22        function call_f() {
     23          Promise.resolve(42).then(forty_two => {
     24            return forty_two;
     25          });
     26 
     27          f().then(v => {
     28            return v;
     29          });
     30        }
     31        debugger;
     32        call_f();
     33      })()`);
     34 
     35    const packet = await waitForEvent(threadFront, "paused");
     36    const location = {
     37      sourceId: packet.frame.where.actor,
     38      line: 4,
     39      column: 10,
     40    };
     41 
     42    await threadFront.setBreakpoint(location, {});
     43 
     44    const packet2 = await resumeAndWaitForPause(threadFront);
     45    Assert.equal(packet2.frame.where.line, 4, "landed at await");
     46 
     47    const packet3 = await stepIn(threadFront);
     48    Assert.equal(packet3.frame.where.line, 5, "step to the next line");
     49 
     50    await threadFront.resume();
     51  })
     52 );