Debian Codegraph @

js/src/jit-test/tests/debug/Debugger-findObjects-classObj-nullProto.js

raw
1 const g = newGlobal({ newCompartment: true });
2
3 g.eval(`
4 var x1 = {};
5 var x2 = { __proto__: null };
6 `);
7
8 const dbg = new Debugger();
9 const gDO = dbg.addDebuggee(g);
10
11 const x1DO = gDO.makeDebuggeeValue(g.x1);
12 const x2DO = gDO.makeDebuggeeValue(g.x2);
13
14 // A plain object with default prototype should match `Object` query.
15 const ObjectDO = gDO.makeDebuggeeValue(g.Object);
16 assertEq(dbg.findObjects({ class: ObjectDO }).includes(x1DO), true);
17
18 // An object with null prototype shouldn't match `Object` query.
19 assertEq(dbg.findObjects({ class: ObjectDO }).includes(x2DO), false);