js/src/jit-test/tests/debug/Script-getChildScripts-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/Script-getChildScripts-02.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,20 @@
     1.4 +// getChildScripts returns scripts in source order.
     1.5 +
     1.6 +var g = newGlobal();
     1.7 +var dbg = new Debugger(g);
     1.8 +var scripts = [];
     1.9 +var cs;
    1.10 +dbg.onDebuggerStatement = function (frame) {
    1.11 +    scripts.push(frame.script);
    1.12 +    if (scripts.length === 1)
    1.13 +        cs = frame.script.getChildScripts();
    1.14 +};
    1.15 +
    1.16 +g.eval("function f() { debugger; }\n" +
    1.17 +       "var g = function () { debugger; }\n" +
    1.18 +       "debugger; f(); g();");
    1.19 +
    1.20 +assertEq(scripts.length, 3);
    1.21 +assertEq(cs.length, 2);
    1.22 +assertEq(cs[0], scripts[1]);
    1.23 +assertEq(cs[1], scripts[2]);

mercurial