1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Script-source-01.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +/* 1.5 + * Script.prototype.source should be an object. Moreover, it should be the 1.6 + * same object for each child script within the same debugger. 1.7 + */ 1.8 +let g = newGlobal(); 1.9 +let dbg = new Debugger(g); 1.10 + 1.11 +let count = 0; 1.12 +dbg.onNewScript = function (script) { 1.13 + assertEq(typeof script.source, "object"); 1.14 + function traverse(script) { 1.15 + ++count; 1.16 + script.getChildScripts().forEach(function (child) { 1.17 + assertEq(child.source, script.source); 1.18 + traverse(child); 1.19 + }); 1.20 + } 1.21 + traverse(script); 1.22 +} 1.23 + 1.24 +g.eval("2 * 3"); 1.25 +g.eval("function f() {}"); 1.26 +g.eval("function f() { function g() {} }"); 1.27 +g.eval("eval('2 * 3')"); 1.28 +g.eval("new Function('2 * 3')"); 1.29 +assertEq(count, 10);