1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Frame-onPop-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,29 @@ 1.4 +// When multiple frames have onPop handlers, they are called in the correct order. 1.5 +var g = newGlobal(); 1.6 +g.eval("function f() { debugger; }"); 1.7 +g.eval("function g() { f(); }"); 1.8 +g.eval("function h() { g(); }"); 1.9 +g.eval("function i() { h(); }"); 1.10 + 1.11 +var dbg = new Debugger(g); 1.12 +var log; 1.13 +function logger(frame, mark) { 1.14 + return function (completion) { 1.15 + assertEq(this, frame); 1.16 + assertEq('return' in completion, true); 1.17 + log += mark; 1.18 + }; 1.19 +} 1.20 +dbg.onEnterFrame = function handleEnter(f) { 1.21 + log += "(" + f.callee.name; 1.22 + // Note that this establishes a distinct function object as each 1.23 + // frame's onPop handler. Thus, a pass proves that each frame is 1.24 + // remembering its handler separately. 1.25 + f.onPop = logger(f, f.callee.name + ")"); 1.26 +}; 1.27 +dbg.onDebuggerStatement = function handleDebugger(f) { 1.28 + log += 'd'; 1.29 +}; 1.30 +log = ''; 1.31 +g.i(); 1.32 +assertEq(log, "(i(h(g(fdf)g)h)i)");