1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Script-getChildScripts-04.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,15 @@ 1.4 +// script.getChildScripts() works correctly during the newScript hook. 1.5 +// (A bug had it including the script for the calling function.) 1.6 + 1.7 +var g = newGlobal(); 1.8 +g.eval("function h(a) { eval(a); }"); 1.9 + 1.10 +var dbg = Debugger(g); 1.11 +var arr, kscript; 1.12 +dbg.onNewScript = function (script) { arr = script.getChildScripts(); }; 1.13 +dbg.onDebuggerStatement = function (frame) { kscript = frame.callee.script; }; 1.14 + 1.15 +g.h("function k(a) { debugger; return a + 1; } k(-1);"); 1.16 +assertEq(kscript instanceof Debugger.Script, true); 1.17 +assertEq(arr.length, 1); 1.18 +assertEq(arr[0], kscript);