js/src/jit-test/tests/debug/Environment-find-02.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Environment-find-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,18 @@
     1.4 +// env.find() finds nonenumerable names in the global environment.
     1.5 +
     1.6 +var g = newGlobal();
     1.7 +var dbg = Debugger(g);
     1.8 +var hits = 0;
     1.9 +g.h = function () {
    1.10 +    var env = dbg.getNewestFrame().environment;
    1.11 +    var last = env;
    1.12 +    while (last.parent)
    1.13 +        last = last.parent;
    1.14 +
    1.15 +    assertEq(env.find("Array"), last);
    1.16 +    hits++;
    1.17 +};
    1.18 +
    1.19 +g.eval("h();");
    1.20 +g.eval("(function () { let (x = 1, y = 2) h(); })();");
    1.21 +assertEq(hits, 2);

mercurial