michael@0: /* michael@0: * Debugger.Source.prototype.text should return a string. Moreover, it michael@0: * should be the same string for each child script sharing that michael@0: * Debugger.Source. michael@0: */ michael@0: let g = newGlobal(); michael@0: let dbg = new Debugger(g); michael@0: michael@0: var count = 0; michael@0: dbg.onNewScript = function (script) { michael@0: var text = script.source.text; michael@0: assertEq(typeof text, "string"); michael@0: function traverse(script) { michael@0: ++count; michael@0: script.getChildScripts().forEach(function (script) { michael@0: assertEq(script.source.text, text); michael@0: traverse(script); michael@0: }); michael@0: }; michael@0: traverse(script); michael@0: } michael@0: michael@0: g.eval("2 * 3"); michael@0: g.eval("function f() {}"); michael@0: g.eval("function f() { function g() {} }"); michael@0: assertEq(count, 6);