tor-browser

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

test_breakpoint-26.js (1606B)


      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 925269 - Verify that debugger statements are skipped
      9 * if there is a falsey conditional breakpoint at the same location.
     10 */
     11 add_task(
     12  threadFrontTest(async props => {
     13    await testBreakpointsAndDebuggerStatements(props);
     14  })
     15 );
     16 
     17 async function testBreakpointsAndDebuggerStatements({ commands, threadFront }) {
     18  commands.scriptCommand.execute(
     19    `function foo(stop) {
     20      debugger;
     21      debugger;
     22      debugger;
     23    }
     24    foo();
     25    //# sourceURL=http://example.com/testBreakpointsAndDebuggerStatements.js`
     26  );
     27 
     28  threadFront.setBreakpoint(
     29    {
     30      sourceUrl: "http://example.com/testBreakpointsAndDebuggerStatements.js",
     31      line: 3,
     32      column: 6,
     33    },
     34    { condition: "false" }
     35  );
     36 
     37  await performActions(threadFront, [
     38    [
     39      "paused at first debugger statement",
     40      { line: 2, type: "debuggerStatement" },
     41      "resume",
     42    ],
     43    [
     44      "pause at the third debugger statement",
     45      { line: 4, type: "debuggerStatement" },
     46      "resume",
     47    ],
     48  ]);
     49 }
     50 
     51 async function performActions(threadFront, actions) {
     52  for (const action of actions) {
     53    await performAction(threadFront, action);
     54  }
     55 }
     56 
     57 async function performAction(threadFront, [description, result, action]) {
     58  info(description);
     59  const packet = await waitForEvent(threadFront, "paused");
     60  Assert.equal(packet.frame.where.line, result.line);
     61  Assert.equal(packet.why.type, result.type);
     62  await threadFront[action]();
     63 }