test_eval-02.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Check eval resume/re-pause with a throw.
  5. */
  6. var gDebuggee;
  7. var gClient;
  8. var gThreadClient;
  9. function run_test()
  10. {
  11. initTestDebuggerServer();
  12. gDebuggee = addTestGlobal("test-stack");
  13. gClient = new DebuggerClient(DebuggerServer.connectPipe());
  14. gClient.connect().then(function () {
  15. attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
  16. gThreadClient = aThreadClient;
  17. test_throw_eval();
  18. });
  19. });
  20. do_test_pending();
  21. }
  22. function test_throw_eval()
  23. {
  24. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  25. gThreadClient.eval(null, "throw 'failure'", function (aResponse) {
  26. do_check_eq(aResponse.type, "resumed");
  27. // Expect a pause notification immediately.
  28. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  29. // Check the return value...
  30. do_check_eq(aPacket.type, "paused");
  31. do_check_eq(aPacket.why.type, "clientEvaluated");
  32. do_check_eq(aPacket.why.frameFinished.throw, "failure");
  33. gThreadClient.resume(function () {
  34. finishClient(gClient);
  35. });
  36. });
  37. });
  38. });
  39. gDebuggee.eval("(" + function () {
  40. function stopMe(arg1) { debugger; }
  41. stopMe({obj: true});
  42. } + ")()");
  43. }