1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Environment-parent-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,18 @@ 1.4 +// The objects on the environment chain are all Debugger.Environment objects. 1.5 +// The environment chain ends in null. 1.6 + 1.7 +var g = newGlobal() 1.8 +g.eval("function f(a) { return function (b) { return function (c) { h(); return a + b + c; }; }; }"); 1.9 +var dbg = Debugger(g); 1.10 +var hits = 0; 1.11 +g.h = function () { 1.12 + var n = 0; 1.13 + for (var env = dbg.getNewestFrame().environment; env !== null; env = env.parent) { 1.14 + n++; 1.15 + assertEq(env instanceof Debugger.Environment, true); 1.16 + } 1.17 + assertEq(n >= 4, true); 1.18 + hits++; 1.19 +}; 1.20 +assertEq(g.f(5)(7)(9), 21); 1.21 +assertEq(hits, 1);