tor-browser

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

test_setBreakpoint-on-line-with-no-offsets.js (1501B)


      1 "use strict";
      2 
      3 const SOURCE_URL = getFileUrl("setBreakpoint-on-line-with-no-offsets.js");
      4 
      5 add_task(
      6  threadFrontTest(
      7    async ({ threadFront, debuggee }) => {
      8      const promise = waitForNewSource(threadFront, SOURCE_URL);
      9      loadSubScript(SOURCE_URL, debuggee);
     10      const { source } = await promise;
     11      const sourceFront = threadFront.source(source);
     12 
     13      const location = { line: 5 };
     14      let [packet, breakpointClient] = await setBreakpoint(
     15        sourceFront,
     16        location
     17      );
     18      Assert.ok(!packet.isPending);
     19      Assert.ok("actualLocation" in packet);
     20      const actualLocation = packet.actualLocation;
     21      Assert.equal(actualLocation.line, 6);
     22 
     23      packet = await executeOnNextTickAndWaitForPause(function () {
     24        Cu.evalInSandbox("f()", debuggee);
     25      }, threadFront);
     26      const environment = await packet.frame.getEnvironment();
     27      Assert.equal(packet.type, "paused");
     28      const why = packet.why;
     29      Assert.equal(why.type, "breakpoint");
     30      Assert.equal(why.actors.length, 1);
     31      Assert.equal(why.actors[0], breakpointClient.actor);
     32      const frame = packet.frame;
     33      const where = frame.where;
     34      Assert.equal(where.actor, source.actor);
     35      Assert.equal(where.line, actualLocation.line);
     36      const variables = environment.bindings.variables;
     37      Assert.equal(variables.a.value, 1);
     38      Assert.equal(variables.c.value.type, "undefined");
     39 
     40      await resume(threadFront);
     41    },
     42    { doNotRunWorker: true }
     43  )
     44 );