tor-browser

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

test_objectgrips-14.js (1352B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 /**
      7 * Test out of scope objects with synchronous functions.
      8 */
      9 
     10 var gDebuggee;
     11 var gThreadFront;
     12 
     13 add_task(
     14  threadFrontTest(async ({ threadFront, debuggee }) => {
     15    gThreadFront = threadFront;
     16    gDebuggee = debuggee;
     17    await testObjectGroup();
     18  })
     19 );
     20 
     21 function evalCode() {
     22  evalCallback(gDebuggee, function runTest() {
     23    const ugh = [];
     24    let i = 0;
     25 
     26    (function () {
     27      (function () {
     28        ugh.push(i++);
     29        debugger;
     30      })();
     31    })();
     32 
     33    debugger;
     34  });
     35 }
     36 
     37 const testObjectGroup = async function () {
     38  let packet = await executeOnNextTickAndWaitForPause(evalCode, gThreadFront);
     39 
     40  const environment = await packet.frame.getEnvironment();
     41  const ugh = environment.parent.parent.bindings.variables.ugh;
     42  const ughClient = await gThreadFront.pauseGrip(ugh.value);
     43 
     44  packet = await getPrototypeAndProperties(ughClient);
     45  packet = await resumeAndWaitForPause(gThreadFront);
     46 
     47  const environment2 = await packet.frame.getEnvironment();
     48  const ugh2 = environment2.bindings.variables.ugh;
     49  const ugh2Client = gThreadFront.pauseGrip(ugh2.value);
     50 
     51  packet = await getPrototypeAndProperties(ugh2Client);
     52  Assert.equal(packet.ownProperties.length.value, 1);
     53 
     54  await resume(gThreadFront);
     55 };