summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-find-02.js
blob: c8ab45b786eb98195e348c1e307d5fe99be16b47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// env.find() finds nonenumerable names in the global environment.

var g = newGlobal({newCompartment: true});
var dbg = Debugger(g);
var hits = 0;
g.h = function () {
    var env = dbg.getNewestFrame().environment;
    var last = env;
    while (last.parent)
        last = last.parent;

    assertEq(env.find("Array"), last);
    hits++;
};

g.eval("h();");
g.eval("(function () { h(); })();");
assertEq(hits, 2);