tor-browser

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

test_stepping-09.js (1382B)


      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 step out stops at the end of the parent if it fails to stop
      8 * anywhere else. Bug 1504358.
      9 */
     10 
     11 add_task(
     12  threadFrontTest(async ({ threadFront, debuggee }) => {
     13    dumpn("Evaluating test code and waiting for first debugger statement");
     14    const dbgStmt = await executeOnNextTickAndWaitForPause(
     15      () => evaluateTestCode(debuggee),
     16      threadFront
     17    );
     18    equal(
     19      dbgStmt.frame.where.line,
     20      2,
     21      "Should be at debugger statement on line 2"
     22    );
     23 
     24    dumpn("Step out of inner and into outer");
     25    const step2 = await stepOut(threadFront);
     26    // The bug was that we'd step right past the end of the function and never pause.
     27    equal(step2.frame.where.line, 2);
     28    equal(step2.frame.where.column, 31);
     29    deepEqual(step2.why.frameFinished.return, { type: "undefined" });
     30  })
     31 );
     32 
     33 function evaluateTestCode(debuggee) {
     34  // By placing the inner and outer on the same line, this triggers the server's
     35  // logic to skip steps for these functions, meaning that onPop is the only
     36  // thing that will cause it to pop.
     37  Cu.evalInSandbox(
     38    `
     39    function outer(){ inner(); return 42; } function inner(){ debugger; }
     40    outer();
     41    `,
     42    debuggee,
     43    "1.8",
     44    "test_stepping-09-test-code.js",
     45    1
     46  );
     47 }