|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Check that promoting multiple pause-lifetime actors to thread-lifetime actors |
|
6 * works as expected. |
|
7 */ |
|
8 |
|
9 var gDebuggee; |
|
10 var gClient; |
|
11 var gThreadClient; |
|
12 |
|
13 function run_test() |
|
14 { |
|
15 initTestDebuggerServer(); |
|
16 gDebuggee = addTestGlobal("test-grips"); |
|
17 gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
|
18 gClient.connect(function() { |
|
19 attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { |
|
20 gThreadClient = aThreadClient; |
|
21 test_thread_lifetime(); |
|
22 }); |
|
23 }); |
|
24 do_test_pending(); |
|
25 } |
|
26 |
|
27 function test_thread_lifetime() |
|
28 { |
|
29 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
|
30 let actors = []; |
|
31 let last; |
|
32 for (let aGrip of aPacket.frame.arguments) { |
|
33 actors.push(aGrip.actor); |
|
34 last = aGrip.actor; |
|
35 } |
|
36 |
|
37 // Create thread-lifetime actors for these objects. |
|
38 gThreadClient.threadGrips(actors, function(aResponse) { |
|
39 // Successful promotion won't return an error. |
|
40 do_check_eq(aResponse.error, undefined); |
|
41 |
|
42 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
|
43 // Verify that the promoted actors are returned again. |
|
44 actors.forEach(function(actor, i) { |
|
45 do_check_eq(actor, aPacket.frame.arguments[i].actor); |
|
46 }); |
|
47 // Now that we've resumed, release the thread-lifetime grips. |
|
48 gThreadClient.releaseMany(actors, function(aResponse) { |
|
49 // Successful release won't return an error. |
|
50 do_check_eq(aResponse.error, undefined); |
|
51 |
|
52 gClient.request({ to: last, type: "bogusRequest" }, function(aResponse) { |
|
53 do_check_eq(aResponse.error, "noSuchActor"); |
|
54 gThreadClient.resume(function(aResponse) { |
|
55 finishClient(gClient); |
|
56 }); |
|
57 }); |
|
58 }); |
|
59 }); |
|
60 gThreadClient.resume(); |
|
61 }); |
|
62 }); |
|
63 |
|
64 gDebuggee.eval("(" + function() { |
|
65 function stopMe(arg1, arg2, arg3) { |
|
66 debugger; |
|
67 debugger; |
|
68 }; |
|
69 stopMe({obj: 1}, {obj: 2}, {obj: 3}); |
|
70 } + ")()"); |
|
71 } |