|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Test that stackframes are scrollable. |
|
6 */ |
|
7 |
|
8 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; |
|
9 |
|
10 let gTab, gDebuggee, gPanel, gDebugger; |
|
11 let gFrames, gClassicFrames, gFramesScrollingInterval; |
|
12 |
|
13 function test() { |
|
14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
|
15 gTab = aTab; |
|
16 gDebuggee = aDebuggee; |
|
17 gPanel = aPanel; |
|
18 gDebugger = gPanel.panelWin; |
|
19 gFrames = gDebugger.DebuggerView.StackFrames; |
|
20 gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; |
|
21 |
|
22 waitForSourceAndCaretAndScopes(gPanel, ".html", 26).then(performTest); |
|
23 |
|
24 gDebuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1; |
|
25 gDebuggee.recurse(); |
|
26 }); |
|
27 } |
|
28 |
|
29 function performTest() { |
|
30 is(gDebugger.gThreadClient.state, "paused", |
|
31 "Should only be getting stack frames while paused."); |
|
32 is(gFrames.itemCount, gDebugger.gCallStackPageSize, |
|
33 "Should have only the max limit of frames."); |
|
34 is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize, |
|
35 "Should have only the max limit of frames in the mirrored view as well.") |
|
36 |
|
37 gDebugger.gThreadClient.addOneTimeListener("framesadded", () => { |
|
38 is(gFrames.itemCount, gDebugger.gCallStackPageSize * 2, |
|
39 "Should now have twice the max limit of frames."); |
|
40 is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize * 2, |
|
41 "Should now have twice the max limit of frames in the mirrored view as well."); |
|
42 |
|
43 gDebugger.gThreadClient.addOneTimeListener("framesadded", () => { |
|
44 is(gFrames.itemCount, gDebuggee.gRecurseLimit, |
|
45 "Should have reached the recurse limit."); |
|
46 is(gClassicFrames.itemCount, gDebuggee.gRecurseLimit, |
|
47 "Should have reached the recurse limit in the mirrored view as well."); |
|
48 |
|
49 gDebugger.gThreadClient.resume(() => { |
|
50 window.clearInterval(gFramesScrollingInterval); |
|
51 closeDebuggerAndFinish(gPanel); |
|
52 }); |
|
53 }); |
|
54 }); |
|
55 |
|
56 gFramesScrollingInterval = window.setInterval(() => { |
|
57 gFrames.widget._list.scrollByIndex(-1); |
|
58 }, 100); |
|
59 } |
|
60 |
|
61 registerCleanupFunction(function() { |
|
62 window.clearInterval(gFramesScrollingInterval); |
|
63 gFramesScrollingInterval = null; |
|
64 |
|
65 gTab = null; |
|
66 gDebuggee = null; |
|
67 gPanel = null; |
|
68 gDebugger = null; |
|
69 gFrames = null; |
|
70 gClassicFrames = null; |
|
71 }); |