/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. var g = newGlobal('new-compartment');
  3. var dbg = new Debugger(g);
  4. var scripts = [];
  5. var cs;
  6. dbg.onDebuggerStatement = function (frame) {
  7. scripts.push(frame.script);
  8. if (scripts.length === 1)
  9. cs = frame.script.getChildScripts();
  10. };
  11. g.eval("function f() { debugger; }\n" +
  12. "var g = function () { debugger; }\n" +
  13. "debugger; f(); g();");
  14. assertEq(scripts.length, 3);
  15. assertEq(cs.length, 2);
  16. assertEq(cs[0], scripts[1]);
  17. assertEq(cs[1], scripts[2]);