test_eval-01.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Check basic eval resume/re-pause
  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_simple_eval();
  18. });
  19. });
  20. do_test_pending();
  21. }
  22. function test_simple_eval()
  23. {
  24. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  25. let arg1Actor = aPacket.frame.arguments[0].actor;
  26. gThreadClient.eval(null, "({ obj: true })", function (aResponse) {
  27. do_check_eq(aResponse.type, "resumed");
  28. // Expect a pause notification immediately.
  29. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  30. // Check the return value...
  31. do_check_eq(aPacket.type, "paused");
  32. do_check_eq(aPacket.why.type, "clientEvaluated");
  33. do_check_eq(aPacket.why.frameFinished.return.type, "object");
  34. do_check_eq(aPacket.why.frameFinished.return.class, "Object");
  35. // Make sure the previous pause lifetime was correctly dropped.
  36. gClient.request({ to: arg1Actor, type: "bogusRequest" }, function (aResponse) {
  37. do_check_eq(aResponse.error, "noSuchActor");
  38. gThreadClient.resume(function () {
  39. finishClient(gClient);
  40. });
  41. });
  42. });
  43. });
  44. });
  45. gDebuggee.eval("(" + function () {
  46. function stopMe(arg1) { debugger; }
  47. stopMe({obj: true});
  48. } + ")()");
  49. }