tor-browser

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

test_objectgrips-02.js (1172B)


      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 args = packet.frame.arguments;
     19 
     20    Assert.equal(args[0].class, "Object");
     21 
     22    const objectFront = threadFront.pauseGrip(args[0]);
     23    const response = await objectFront.getPrototype();
     24    Assert.notEqual(response.prototype, undefined);
     25 
     26    await threadFront.resume();
     27  })
     28 );
     29 
     30 function evalCode(debuggee) {
     31  debuggee.eval(
     32    // These arguments are tested.
     33    // eslint-disable-next-line no-unused-vars
     34    function stopMe(arg1) {
     35      debugger;
     36    }.toString()
     37  );
     38  debuggee.eval(
     39    function Constr() {
     40      this.a = 1;
     41    }.toString()
     42  );
     43  debuggee.eval(
     44    "Constr.prototype = { b: true, c: 'foo' }; var o = new Constr(); stopMe(o)"
     45  );
     46 }