tor-browser

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

test_setBreakpoint-on-line-in-gcd-script.js (1414B)


      1 "use strict";
      2 
      3 const SOURCE_URL = getFileUrl("setBreakpoint-on-line-in-gcd-script.js");
      4 
      5 add_task(
      6  threadFrontTest(
      7    async ({ threadFront, debuggee, targetFront }) => {
      8      const promise = waitForNewSource(threadFront, SOURCE_URL);
      9      loadSubScriptWithOptions(SOURCE_URL, {
     10        target: debuggee,
     11        ignoreCache: true,
     12      });
     13      Cu.forceGC();
     14      Cu.forceGC();
     15      Cu.forceGC();
     16 
     17      const { source } = await promise;
     18 
     19      const location = { sourceUrl: source.url, line: 7 };
     20      setBreakpoint(threadFront, location);
     21 
     22      const packet = await executeOnNextTickAndWaitForPause(function () {
     23        reload(targetFront).then(function () {
     24          loadSubScriptWithOptions(SOURCE_URL, {
     25            target: debuggee,
     26            ignoreCache: true,
     27          });
     28        });
     29      }, threadFront);
     30      const why = packet.why;
     31      const environment = await packet.frame.getEnvironment();
     32      Assert.equal(why.type, "breakpoint");
     33      Assert.equal(why.actors.length, 1);
     34      const frame = packet.frame;
     35      const where = frame.where;
     36      Assert.equal(where.line, location.line);
     37      const variables = environment.bindings.variables;
     38      Assert.equal(variables.a.value, 1);
     39      Assert.equal(variables.b.value.type, "undefined");
     40      Assert.equal(variables.c.value.type, "undefined");
     41      await resume(threadFront);
     42    },
     43    { doNotRunWorker: true }
     44  )
     45 );