tor-browser

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

test_objectgrips-22.js (1422B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
      7 registerCleanupFunction(() => {
      8  Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
      9 });
     10 
     11 add_task(
     12  threadFrontTest(async ({ threadFront, debuggee }) => {
     13    const packet = await executeOnNextTickAndWaitForPause(
     14      () => evalCode(debuggee),
     15      threadFront
     16    );
     17 
     18    const [grip] = packet.frame.arguments;
     19    const objClient = threadFront.pauseGrip(grip);
     20    const iterator = await objClient.enumSymbols();
     21    const { ownSymbols } = await iterator.slice(0, iterator.count);
     22 
     23    strictEqual(ownSymbols.length, 1, "There is 1 symbol property.");
     24    const { name, descriptor } = ownSymbols[0];
     25    strictEqual(name, "Symbol(sym)", "Got right symbol name.");
     26    deepEqual(
     27      descriptor,
     28      {
     29        configurable: false,
     30        enumerable: false,
     31        writable: false,
     32        value: 1,
     33      },
     34      "Got right property descriptor."
     35    );
     36 
     37    await threadFront.resume();
     38  })
     39 );
     40 
     41 function evalCode(debuggee) {
     42  debuggee.eval(
     43    // These arguments are tested.
     44    // eslint-disable-next-line no-unused-vars
     45    function stopMe(arg1) {
     46      debugger;
     47    }.toString()
     48  );
     49  debuggee.eval(
     50    `stopMe(Object.defineProperty({}, Symbol("sym"), {value: 1}));`
     51  );
     52 }