tor-browser

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

test_stepping-04.js (1431B)


      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 stepping over a function call does not pause inside the function.
      8 */
      9 
     10 add_task(
     11  threadFrontTest(async ({ threadFront, debuggee }) => {
     12    dumpn("Evaluating test code and waiting for first debugger statement");
     13    await executeOnNextTickAndWaitForPause(
     14      () => evaluateTestCode(debuggee),
     15      threadFront
     16    );
     17 
     18    dumpn("Step Over to f()");
     19    const step1 = await stepOver(threadFront);
     20    equal(step1.why.type, "resumeLimit");
     21    equal(step1.frame.where.line, 6);
     22    equal(debuggee.a, undefined);
     23    equal(debuggee.b, undefined);
     24 
     25    dumpn("Step Over f()");
     26    const step2 = await stepOver(threadFront);
     27    equal(step2.frame.where.line, 7);
     28    equal(step2.why.type, "resumeLimit");
     29    equal(debuggee.a, 1);
     30    equal(debuggee.b, undefined);
     31  })
     32 );
     33 
     34 function evaluateTestCode(debuggee) {
     35  // prettier-ignore
     36  Cu.evalInSandbox(
     37    `                                   // 1
     38    function f() {                      // 2
     39      this.a = 1;                       // 3
     40    }                                   // 4
     41    debugger;                           // 5
     42    f();                                // 6
     43    let b = 2;                          // 7
     44    `,                                  // 8
     45    debuggee,
     46    "1.8",
     47    "test_stepping-01-test-code.js",
     48    1
     49  );
     50 }