js/src/jit-test/tests/debug/Source-text-02.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Source-text-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,19 @@
     1.4 +// Nested compilation units (say, an eval with in an eval) should have the
     1.5 +// correct sources attributed to them.
     1.6 +let g = newGlobal();
     1.7 +let dbg = new Debugger(g);
     1.8 +
     1.9 +var count = 0;
    1.10 +dbg.onNewScript = function (script) {
    1.11 +    ++count;
    1.12 +    if (count % 2 == 0)
    1.13 +        assertEq(script.source.text, text);
    1.14 +}
    1.15 +
    1.16 +g.eval("eval('" + (text = "") + "')");
    1.17 +g.eval("eval('" + (text = "2 * 3") + "')");
    1.18 +g.eval("new Function('" + (text = "") + "')");
    1.19 +g.eval("new Function('" + (text = "2 * 3") + "')");
    1.20 +evaluate("", { global: g });
    1.21 +evaluate("2 * 3", { global: g });
    1.22 +assertEq(count, 10);

mercurial