tor-browser

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

test_objectgrips-23.js (1043B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Test that ES6 classes grip have the expected properties.
      5 
      6 "use strict";
      7 
      8 Services.prefs.setBoolPref("security.allow_eval_with_system_principal", true);
      9 registerCleanupFunction(() => {
     10  Services.prefs.clearUserPref("security.allow_eval_with_system_principal");
     11 });
     12 
     13 add_task(
     14  threadFrontTest(async ({ threadFront, debuggee }) => {
     15    const packet = await executeOnNextTickAndWaitForPause(
     16      () => evalCode(debuggee),
     17      threadFront
     18    );
     19 
     20    const [grip] = packet.frame.arguments;
     21    strictEqual(
     22      grip.class,
     23      "Function",
     24      `Grip has expected value for "class" property`
     25    );
     26    strictEqual(
     27      grip.isClassConstructor,
     28      true,
     29      `Grip has expected value for "isClassConstructor" property`
     30    );
     31 
     32    await threadFront.resume();
     33  })
     34 );
     35 
     36 function evalCode(debuggee) {
     37  debuggee.eval(`
     38    class MyClass {};
     39    stopMe(MyClass);
     40 
     41    function stopMe(arg1) {
     42      debugger;
     43    }
     44  `);
     45 }