tor-browser

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

Debugger-findObjects-classObj-ccwProto.js (889B)


      1 const g = newGlobal({ newCompartment: true });
      2 
      3 g.OtherObject = Object;
      4 
      5 g.eval(`
      6 var x1 = { __proto__: OtherObject.prototype };
      7 `);
      8 
      9 const dbg = new Debugger();
     10 const gDO = dbg.addDebuggee(g);
     11 
     12 const x1DO = gDO.makeDebuggeeValue(g.x1);
     13 
     14 // If the debuggee object has prototype from another global,
     15 // only the ctor/proto from that global should match.
     16 
     17 const ObjectDO = gDO.makeDebuggeeValue(g.Object);
     18 assertEq(dbg.findObjects({ class: ObjectDO }).includes(x1DO), false);
     19 const ObjectProtoDO = gDO.makeDebuggeeValue(g.Object.prototype);
     20 assertEq(dbg.findObjects({ class: ObjectProtoDO }).includes(x1DO), false);
     21 
     22 const OtherObjectDO = gDO.makeDebuggeeValue(Object);
     23 assertEq(dbg.findObjects({ class: OtherObjectDO }).includes(x1DO), true);
     24 const OtherObjectProtoDO = gDO.makeDebuggeeValue(Object.prototype);
     25 assertEq(dbg.findObjects({ class: OtherObjectProtoDO }).includes(x1DO), true);