1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Frame-script-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +// |jit-test| debug 1.5 +// Frame.prototype.script for eval 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, "eval"); 1.17 + f(frame.script); 1.18 + }; 1.19 + g.eval(code); 1.20 +} 1.21 + 1.22 +ApplyToFrameScript('debugger;', 0, 1.23 + function (script) { 1.24 + assertEq(script instanceof Debugger.Script, true); 1.25 + }); 1.26 +ApplyToFrameScript("(function () { eval('debugger;'); })();", 0, 1.27 + function (script) { 1.28 + assertEq(script instanceof Debugger.Script, true); 1.29 + });