tor-browser

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

test_breakpoint-23.js (1165B)


      1 /* eslint-disable max-nested-callbacks */
      2 /* Any copyright is dedicated to the Public Domain.
      3   http://creativecommons.org/publicdomain/zero/1.0/ */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Bug 1552453 - Verify that breakpoints are hit for evaluated
      9 * scripts that contain a source url pragma.
     10 */
     11 add_task(
     12  threadFrontTest(async ({ commands, threadFront }) => {
     13    await threadFront.setBreakpoint(
     14      { sourceUrl: "http://example.com/code.js", line: 2, column: 1 },
     15      {}
     16    );
     17 
     18    info("Create a new script with the displayUrl code.js");
     19    const onNewSource = waitForEvent(threadFront, "newSource");
     20    await commands.scriptCommand.execute(
     21      "function f() {\n return 5; \n}\n//# sourceURL=http://example.com/code.js"
     22    );
     23    const sourcePacket = await onNewSource;
     24 
     25    equal(sourcePacket.source.url, "http://example.com/code.js");
     26 
     27    info("Evaluate f() and pause at line 2");
     28    const onExecutionDone = commands.scriptCommand.execute("f()");
     29    const pausedPacket = await waitForPause(threadFront);
     30    equal(pausedPacket.why.type, "breakpoint");
     31    equal(pausedPacket.frame.where.line, 2);
     32    resume(threadFront);
     33    await onExecutionDone;
     34  })
     35 );