|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Check that thread-lifetime grips last past a resume. |
|
6 */ |
|
7 |
|
8 var gDebuggee; |
|
9 var gClient; |
|
10 var gThreadClient; |
|
11 |
|
12 function run_test() |
|
13 { |
|
14 initTestDebuggerServer(); |
|
15 gDebuggee = addTestGlobal("test-grips"); |
|
16 gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
|
17 gClient.connect(function() { |
|
18 attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { |
|
19 gThreadClient = aThreadClient; |
|
20 test_thread_lifetime(); |
|
21 }); |
|
22 }); |
|
23 do_test_pending(); |
|
24 } |
|
25 |
|
26 function test_thread_lifetime() |
|
27 { |
|
28 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
|
29 let pauseGrip = aPacket.frame.arguments[0]; |
|
30 |
|
31 // Create a thread-lifetime actor for this object. |
|
32 gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function(aResponse) { |
|
33 // Successful promotion won't return an error. |
|
34 do_check_eq(aResponse.error, undefined); |
|
35 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
|
36 // Verify that the promoted actor is returned again. |
|
37 do_check_eq(pauseGrip.actor, aPacket.frame.arguments[0].actor); |
|
38 // Now that we've resumed, release the thread-lifetime grip. |
|
39 gClient.release(pauseGrip.actor, function(aResponse) { |
|
40 gClient.request({ to: pauseGrip.actor, type: "bogusRequest" }, function(aResponse) { |
|
41 do_check_eq(aResponse.error, "noSuchActor"); |
|
42 gThreadClient.resume(function(aResponse) { |
|
43 finishClient(gClient); |
|
44 }); |
|
45 }); |
|
46 }); |
|
47 }); |
|
48 gThreadClient.resume(); |
|
49 }); |
|
50 }); |
|
51 |
|
52 gDebuggee.eval("(" + function() { |
|
53 function stopMe(arg1) { |
|
54 debugger; |
|
55 debugger; |
|
56 }; |
|
57 stopMe({obj: true}); |
|
58 } + ")()"); |
|
59 } |