/js/src/jit-test/tests/debug/Frame-onStep-10.js

http://github.com/zpao/v8monkey · JavaScript · 28 lines · 23 code · 3 blank · 2 comment · 0 complexity · a4cbc3f293ed54ce0cfa0b21b8f97002 MD5 · raw file

  1. // Throwing and catching an error in an onStep handler shouldn't interfere
  2. // with throwing and catching in the debuggee.
  3. var g = newGlobal('new-compartment');
  4. g.eval("function f() { debugger; throw 'mud'; }");
  5. var dbg = Debugger(g);
  6. var stepped = false;
  7. dbg.onDebuggerStatement = function (frame) {
  8. frame.older.onStep = function () {
  9. stepped = true;
  10. try {
  11. throw 'snow';
  12. } catch (x) {
  13. assertEq(x, 'snow');
  14. }
  15. };
  16. };
  17. stepped = false;
  18. g.eval("var caught;\n" +
  19. "try {\n" +
  20. " f();\n" +
  21. "} catch (x) {\n" +
  22. " caught = x;\n" +
  23. "}\n");
  24. assertEq(stepped, true);
  25. assertEq(g.caught, 'mud');