summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-find-03.js
blob: 3800e247d8fd0432c3c088e7f1d9230d8a7fed51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// env.find() finds nonenumerable properties in with statements.

var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var hits = 0;
g.h = function () {
    var frame = dbg.getNewestFrame();
    var target = frame.eval("obj").return;
    var env = frame.environment.find("PI");
    assertEq(env.object, target);
    hits++;
};

g.obj = g.Math;
g.eval("with (obj) h();");
g.eval("with (Math) { let x = 12; h(); }");
g.eval("obj = {};\n" +
       "Object.defineProperty(obj, 'PI', {enumerable: false, value: 'Marlowe'});\n" +
       "with (obj) h();\n");
assertEq(hits, 3);