tor-browser

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

test_setBreakpoint-on-line.js (1228B)


      1 "use strict";
      2 
      3 const SOURCE_URL = getFileUrl("setBreakpoint-on-line.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: 5 };
     14      setBreakpoint(threadFront, location);
     15 
     16      const packet = await executeOnNextTickAndWaitForPause(function () {
     17        Cu.evalInSandbox("f()", debuggee);
     18      }, threadFront);
     19      const environment = await packet.frame.getEnvironment();
     20      const why = packet.why;
     21      Assert.equal(why.type, "breakpoint");
     22      Assert.equal(why.actors.length, 1);
     23      const frame = packet.frame;
     24      const where = frame.where;
     25      Assert.equal(where.actor, source.actor);
     26      Assert.equal(where.line, location.line);
     27      const variables = environment.bindings.variables;
     28      Assert.equal(variables.a.value, 1);
     29      Assert.equal(variables.b.value.type, "undefined");
     30      Assert.equal(variables.c.value.type, "undefined");
     31 
     32      await resume(threadFront);
     33    },
     34    { doNotRunWorker: true }
     35  )
     36 );