blob: 3f29809d64619c3581921181ae09f58d493d099b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
// reentering the debugger several times via onDebuggerStatement and apply/call on a single stack
var g = newGlobal();
var dbg = Debugger(g);
function test(usingApply) {
dbg.onDebuggerStatement = function (frame) {
var n = frame.arguments[0];
if (n > 1) {
var result = usingApply ? frame.callee.apply(null, [n - 1])
: frame.callee.call(null, n - 1);
result.return *= n;
return result;
}
};
g.eval("function fac(n) { debugger; return 1; }");
assertEq(g.fac(5), 5 * 4 * 3 * 2 * 1);
}
test(true);
test(false);
|