| |
1 /* Any copyright is dedicated to the Public Domain. |
| |
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
| |
3 |
| |
4 /** |
| |
5 * Verify that frame actors retrieved with the frames request |
| |
6 * are included in the pause packet's popped-frames property. |
| |
7 */ |
| |
8 |
| |
9 var gDebuggee; |
| |
10 var gClient; |
| |
11 var gThreadClient; |
| |
12 |
| |
13 function run_test() |
| |
14 { |
| |
15 initTestDebuggerServer(); |
| |
16 gDebuggee = addTestGlobal("test-stack"); |
| |
17 gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
| |
18 gClient.connect(function() { |
| |
19 attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { |
| |
20 gThreadClient = aThreadClient; |
| |
21 test_pause_frame(); |
| |
22 }); |
| |
23 }); |
| |
24 do_test_pending(); |
| |
25 } |
| |
26 |
| |
27 function test_frame_slice() { |
| |
28 if (gSliceTests.length == 0) { |
| |
29 gThreadClient.resume(function() { finishClient(gClient); }); |
| |
30 return; |
| |
31 } |
| |
32 |
| |
33 let test = gSliceTests.shift(); |
| |
34 gThreadClient.getFrames(test.start, test.count, function(aResponse) { |
| |
35 var testFrames = gFrames.slice(test.start, test.count ? test.start + test.count : undefined); |
| |
36 do_check_eq(testFrames.length, aResponse.frames.length); |
| |
37 for (var i = 0; i < testFrames.length; i++) { |
| |
38 let expected = testFrames[i]; |
| |
39 let actual = aResponse.frames[i]; |
| |
40 |
| |
41 if (test.resetActors) { |
| |
42 expected.actor = actual.actor; |
| |
43 } |
| |
44 |
| |
45 for (var key in expected) { |
| |
46 do_check_eq(expected[key], actual[key]); |
| |
47 } |
| |
48 } |
| |
49 test_frame_slice(); |
| |
50 }); |
| |
51 } |
| |
52 |
| |
53 function test_pause_frame() |
| |
54 { |
| |
55 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket1) { |
| |
56 gThreadClient.getFrames(0, null, function(aFrameResponse) { |
| |
57 do_check_eq(aFrameResponse.frames.length, 5); |
| |
58 // Now wait for the next pause, after which the three |
| |
59 // youngest actors should be popped.. |
| |
60 let expectPopped = [frame.actor for each (frame in aFrameResponse.frames.slice(0, 3))]; |
| |
61 expectPopped.sort() |
| |
62 |
| |
63 gThreadClient.addOneTimeListener("paused", function(aEvent, aPausePacket) { |
| |
64 let popped = aPausePacket.poppedFrames.sort(); |
| |
65 do_check_eq(popped.length, 3); |
| |
66 for (let i = 0; i < 3; i++) { |
| |
67 do_check_eq(expectPopped[i], popped[i]); |
| |
68 } |
| |
69 |
| |
70 gThreadClient.resume(function() { finishClient(gClient); }); |
| |
71 }); |
| |
72 gThreadClient.resume(); |
| |
73 }); |
| |
74 }); |
| |
75 |
| |
76 gDebuggee.eval("(" + function() { |
| |
77 function depth3() { |
| |
78 debugger; |
| |
79 } |
| |
80 function depth2() { |
| |
81 depth3(); |
| |
82 } |
| |
83 function depth1() { |
| |
84 depth2(); |
| |
85 }; |
| |
86 depth1(); |
| |
87 debugger; |
| |
88 } + ")()"); |
| |
89 } |