1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Script-sourceStart-04.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,25 @@ 1.4 +/* 1.5 + * For eval and Function constructors, Script.prototype.sourceStart and 1.6 + * Script.prototype.sourceLength should comprise the entire script (excluding 1.7 + * arguments in the case of Function constructors) 1.8 + */ 1.9 +let g = newGlobal(); 1.10 +let dbg = new Debugger(g); 1.11 + 1.12 +var count = 0; 1.13 +function test(string, range) { 1.14 + dbg.onNewScript = function (script) { 1.15 + ++count; 1.16 + if (count % 2 == 0) { 1.17 + assertEq(script.sourceStart, range[0]); 1.18 + assertEq(script.sourceLength, range[1]); 1.19 + } 1.20 + } 1.21 + 1.22 + g.eval(string); 1.23 +} 1.24 + 1.25 +test("eval('2 * 3')", [0, 5]); 1.26 +test("new Function('2 * 3')", [0, 5]); 1.27 +test("new Function('x', 'x * x')", [0, 5]); 1.28 +assertEq(count, 6);