toolkit/devtools/server/tests/unit/test_threadlifetime-04.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:e7c5fa9c8bd2
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Check that requesting a thread-lifetime actor twice for the same
6 * value returns the same actor.
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 pauseGrip = aPacket.frame.arguments[0];
31
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
36 let threadGrip1 = aResponse.from;
37
38 gClient.request({ to: pauseGrip.actor, type: "threadGrip" }, function (aResponse) {
39 do_check_eq(threadGrip1, aResponse.from);
40 gThreadClient.resume(function() {
41 finishClient(gClient);
42 });
43 });
44 });
45 });
46
47 gDebuggee.eval("(" + function() {
48 function stopMe(arg1) {
49 debugger;
50 };
51 stopMe({obj: true});
52 } + ")()");
53 }

mercurial