tor-browser

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

test_stepping-03.js (1127B)


      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 basic step-out functionality.
      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    const step1 = await stepOut(threadFront);
     19    equal(step1.frame.where.line, 8);
     20    equal(step1.why.type, "resumeLimit");
     21 
     22    equal(debuggee.a, 1);
     23    equal(debuggee.b, 2);
     24  })
     25 );
     26 
     27 function evaluateTestCode(debuggee) {
     28  // prettier-ignore
     29  Cu.evalInSandbox(
     30    `                                   // 1
     31    function f() {                      // 2
     32      debugger;                         // 3
     33      this.a = 1;                       // 4
     34      this.b = 2;                       // 5
     35    }                                   // 6
     36    f();                                // 7
     37    `,                                  // 8
     38    debuggee,
     39    "1.8",
     40    "test_stepping-01-test-code.js",
     41    1
     42  );
     43 }