1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Environment-callee-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,25 @@ 1.4 +// Debugger.Environment.prototype.callee gets the right closure. 1.5 + 1.6 +var g = newGlobal(); 1.7 +var dbg = new Debugger; 1.8 +var gw = dbg.addDebuggee(g); 1.9 + 1.10 +g.eval('function f(x) { return function (y) { debugger; return x + y; } }'); 1.11 +g.eval('var g = f(2);'); 1.12 +g.eval('var h = f(3);'); 1.13 + 1.14 +function check(fun, label) { 1.15 + print("check(" + label + ")"); 1.16 + var hits; 1.17 + dbg.onDebuggerStatement = function (frame) { 1.18 + hits++; 1.19 + var env = frame.environment; 1.20 + assertEq(env.callee, gw.makeDebuggeeValue(fun)); 1.21 + }; 1.22 + hits = 0; 1.23 + fun(); 1.24 + assertEq(hits, 1); 1.25 +} 1.26 + 1.27 +check(g.g, 'g.g'); 1.28 +check(g.h, 'g.h');