test_threadlifetime-04.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /* Any copyright is dedicated to the Public Domain.
  2. http://creativecommons.org/publicdomain/zero/1.0/ */
  3. /**
  4. * Check that requesting a thread-lifetime actor twice for the same
  5. * value returns the same actor.
  6. */
  7. var gDebuggee;
  8. var gClient;
  9. var gThreadClient;
  10. function run_test()
  11. {
  12. initTestDebuggerServer();
  13. gDebuggee = addTestGlobal("test-grips");
  14. gClient = new DebuggerClient(DebuggerServer.connectPipe());
  15. gClient.connect().then(function () {
  16. attachTestTabAndResume(gClient, "test-grips", function (aResponse, aTabClient, aThreadClient) {
  17. gThreadClient = aThreadClient;
  18. test_thread_lifetime();
  19. });
  20. });
  21. do_test_pending();
  22. }
  23. function test_thread_lifetime()
  24. {
  25. gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) {
  26. let pauseGrip = aPacket.frame.arguments[0];
  27. gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function (aResponse) {
  28. // Successful promotion won't return an error.
  29. do_check_eq(aResponse.error, undefined);
  30. let threadGrip1 = aResponse.from;
  31. gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function (aResponse) {
  32. do_check_eq(threadGrip1, aResponse.from);
  33. gThreadClient.resume(function () {
  34. finishClient(gClient);
  35. });
  36. });
  37. });
  38. });
  39. gDebuggee.eval("(" + function () {
  40. function stopMe(arg1) {
  41. debugger;
  42. }
  43. stopMe({obj: true});
  44. } + ")()");
  45. }