summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Environment-find-02.js
blob: e6e0e80c9f078f6f089cc0792ec9268783d1b8cb (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();
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);