test_pauselifetime-02.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Check that pause-lifetime grips go away correctly after a resume.
  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_pause_frame();
  18. });
  19. });
  20. do_test_pending();
  21. }
  22. function test_pause_frame()
  23. {
  24. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  25. let args = aPacket.frame.arguments;
  26. let objActor = args[0].actor;
  27. do_check_eq(args[0].class, "Object");
  28. do_check_true(!!objActor);
  29. // Make a bogus request to the grip actor. Should get
  30. // unrecognized-packet-type (and not no-such-actor).
  31. gClient.request({ to: objActor, type: "bogusRequest" }, function (aResponse) {
  32. do_check_eq(aResponse.error, "unrecognizedPacketType");
  33. gThreadClient.resume(function () {
  34. // Now that we've resumed, should get no-such-actor for the
  35. // same request.
  36. gClient.request({ to: objActor, type: "bogusRequest" }, function (aResponse) {
  37. do_check_eq(aResponse.error, "noSuchActor");
  38. finishClient(gClient);
  39. });
  40. });
  41. });
  42. });
  43. gDebuggee.eval("(" + function () {
  44. function stopMe(aObject) {
  45. debugger;
  46. }
  47. stopMe({ foo: "bar" });
  48. } + ")()");
  49. }