tor-browser

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

test_setBreakpoint-on-line-with-multiple-offsets.js (1779B)


      1 "use strict";
      2 
      3 const SOURCE_URL = getFileUrl("setBreakpoint-on-line-with-multiple-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 = { sourceUrl: sourceFront.url, line: 4 };
     14      setBreakpoint(threadFront, location);
     15 
     16      let packet = await executeOnNextTickAndWaitForPause(function () {
     17        Cu.evalInSandbox("f()", debuggee);
     18      }, threadFront);
     19      let why = packet.why;
     20      let environment = await packet.frame.getEnvironment();
     21      Assert.equal(why.type, "breakpoint");
     22      Assert.equal(why.actors.length, 1);
     23      let frame = packet.frame;
     24      let where = frame.where;
     25      Assert.equal(where.actor, source.actor);
     26      Assert.equal(where.line, location.line);
     27      let variables = environment.bindings.variables;
     28      Assert.equal(variables.i.value.type, "undefined");
     29 
     30      const location2 = { sourceUrl: sourceFront.url, line: 7 };
     31      setBreakpoint(threadFront, location2);
     32 
     33      packet = await executeOnNextTickAndWaitForPause(
     34        () => resume(threadFront),
     35        threadFront
     36      );
     37      environment = await packet.frame.getEnvironment();
     38      why = packet.why;
     39      Assert.equal(why.type, "breakpoint");
     40      Assert.equal(why.actors.length, 1);
     41      frame = packet.frame;
     42      where = frame.where;
     43      Assert.equal(where.actor, source.actor);
     44      Assert.equal(where.line, location2.line);
     45      variables = environment.bindings.variables;
     46      Assert.equal(variables.i.value, 1);
     47 
     48      await resume(threadFront);
     49    },
     50    { doNotRunWorker: true }
     51  )
     52 );