test_eval-03.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Check syntax errors in an eval.
  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().then(function () {
  15. attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) {
  16. gThreadClient = aThreadClient;
  17. test_syntax_error_eval();
  18. });
  19. });
  20. do_test_pending();
  21. }
  22. function test_syntax_error_eval()
  23. {
  24. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  25. gThreadClient.eval(null, "%$@!@#", 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.type, "object");
  33. do_check_eq(aPacket.why.frameFinished.throw.class, "Error");
  34. gThreadClient.resume(function () {
  35. finishClient(gClient);
  36. });
  37. });
  38. });
  39. });
  40. gDebuggee.eval("(" + function () {
  41. function stopMe(arg1) { debugger; }
  42. stopMe({obj: true});
  43. } + ")()");
  44. }