michael@0: /* michael@0: * For eval and Function constructors, Script.prototype.sourceStart and michael@0: * Script.prototype.sourceLength should comprise the entire script (excluding michael@0: * arguments in the case of Function constructors) michael@0: */ michael@0: let g = newGlobal(); michael@0: let dbg = new Debugger(g); michael@0: michael@0: var count = 0; michael@0: function test(string, range) { michael@0: dbg.onNewScript = function (script) { michael@0: ++count; michael@0: if (count % 2 == 0) { michael@0: assertEq(script.sourceStart, range[0]); michael@0: assertEq(script.sourceLength, range[1]); michael@0: } michael@0: } michael@0: michael@0: g.eval(string); michael@0: } michael@0: michael@0: test("eval('2 * 3')", [0, 5]); michael@0: test("new Function('2 * 3')", [0, 5]); michael@0: test("new Function('x', 'x * x')", [0, 5]); michael@0: assertEq(count, 6);