1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Frame-script-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,28 @@ 1.4 +// |jit-test| debug 1.5 +// Frame.prototype.script for call frames. 1.6 + 1.7 +var g = newGlobal(); 1.8 +var dbg = new Debugger(g); 1.9 + 1.10 +// Apply |f| to each frame that is |skip| frames up from each frame that 1.11 +// executes a 'debugger' statement when evaluating |code| in the global g. 1.12 +function ApplyToFrameScript(code, skip, f) { 1.13 + dbg.onDebuggerStatement = function (frame) { 1.14 + while (skip-- > 0) 1.15 + frame = frame.older; 1.16 + assertEq(frame.type, "call"); 1.17 + f(frame.script); 1.18 + }; 1.19 + g.eval(code); 1.20 +} 1.21 + 1.22 +ApplyToFrameScript('(function () { debugger; })();', 0, 1.23 + function (script) { 1.24 + assertEq(script instanceof Debugger.Script, true); 1.25 + }); 1.26 + 1.27 +// This would be nice, once we can get host call frames: 1.28 +// ApplyToFrameScript("(function () { debugger; }).call(null);", 1, 1.29 +// function (script) { 1.30 +// assertEq(script, null); 1.31 +// });