/js/src/jit-test/tests/debug/Frame-script-01.js

http://github.com/zpao/v8monkey · JavaScript · 26 lines · 19 code · 3 blank · 4 comment · 1 complexity · 1da76e504cdc63d9a21ca18b726fe68d MD5 · raw file

  1. // |jit-test| debug
  2. // Frame.prototype.script for eval frames.
  3. var g = newGlobal('new-compartment');
  4. var dbg = new Debugger(g);
  5. // Apply |f| to each frame that is |skip| frames up from each frame that
  6. // executes a 'debugger' statement when evaluating |code| in the global g.
  7. function ApplyToFrameScript(code, skip, f) {
  8. dbg.onDebuggerStatement = function (frame) {
  9. while (skip-- > 0)
  10. frame = frame.older;
  11. assertEq(frame.type, "eval");
  12. f(frame.script);
  13. };
  14. g.eval(code);
  15. }
  16. ApplyToFrameScript('debugger;', 0,
  17. function (script) {
  18. assertEq(script instanceof Debugger.Script, true);
  19. });
  20. ApplyToFrameScript("(function () { eval('debugger;'); })();", 0,
  21. function (script) {
  22. assertEq(script instanceof Debugger.Script, true);
  23. });