PageRenderTime 17ms CodeModel.GetById 8ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/js/src/jit-test/tests/debug/Script-getChildScripts-02.js

http://github.com/zpao/v8monkey
JavaScript | 20 lines | 16 code | 3 blank | 1 comment | 1 complexity | c4b8a7d9e5129090a47b78f313c5e232 MD5 | raw file
 1// getChildScripts returns scripts in source order.
 2
 3var g = newGlobal('new-compartment');
 4var dbg = new Debugger(g);
 5var scripts = [];
 6var cs;
 7dbg.onDebuggerStatement = function (frame) {
 8    scripts.push(frame.script);
 9    if (scripts.length === 1)
10        cs = frame.script.getChildScripts();
11};
12
13g.eval("function f() { debugger; }\n" +
14       "var g = function () { debugger; }\n" +
15       "debugger; f(); g();");
16
17assertEq(scripts.length, 3);
18assertEq(cs.length, 2);
19assertEq(cs[0], scripts[1]);
20assertEq(cs[1], scripts[2]);