1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Object-apply-03.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,21 @@ 1.4 +// reentering the debugger several times via onDebuggerStatement and apply/call on a single stack 1.5 + 1.6 +var g = newGlobal(); 1.7 +var dbg = Debugger(g); 1.8 + 1.9 +function test(usingApply) { 1.10 + dbg.onDebuggerStatement = function (frame) { 1.11 + var n = frame.arguments[0]; 1.12 + if (n > 1) { 1.13 + var result = usingApply ? frame.callee.apply(null, [n - 1]) 1.14 + : frame.callee.call(null, n - 1); 1.15 + result.return *= n; 1.16 + return result; 1.17 + } 1.18 + }; 1.19 + g.eval("function fac(n) { debugger; return 1; }"); 1.20 + assertEq(g.fac(5), 5 * 4 * 3 * 2 * 1); 1.21 +} 1.22 + 1.23 +test(true); 1.24 +test(false);