js/src/jit-test/tests/debug/Script-source-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /*
     2  * Script.prototype.source should be an object. Moreover, it should be the
     3  * same object for each child script within the same debugger.
     4  */
     5 let g = newGlobal();
     6 let dbg = new Debugger(g);
     8 let count = 0;
     9 dbg.onNewScript = function (script) {
    10     assertEq(typeof script.source, "object");
    11     function traverse(script) {
    12         ++count;
    13         script.getChildScripts().forEach(function (child) {
    14             assertEq(child.source, script.source);
    15             traverse(child);
    16         });
    17     }
    18     traverse(script);
    19 }
    21 g.eval("2 * 3");
    22 g.eval("function f() {}");
    23 g.eval("function f() { function g() {} }");
    24 g.eval("eval('2 * 3')");
    25 g.eval("new Function('2 * 3')");
    26 assertEq(count, 10);

mercurial