1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Test that stackframes are added when debugger is paused in eval calls.
*/
const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
let gTab, gPanel, gDebugger;
let gFrames, gClassicFrames;
function test() {
initDebugger(TAB_URL).then(([aTab,, aPanel]) => {
gTab = aTab;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gFrames = gDebugger.DebuggerView.StackFrames;
gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList;
waitForSourceAndCaretAndScopes(gPanel, ".html", 1).then(performTest);
callInTab(gTab, "evalCall");
});
}
function performTest() {
is(gDebugger.gThreadClient.state, "paused",
"Should only be getting stack frames while paused.");
is(gFrames.itemCount, 2,
"Should have two frames.");
is(gClassicFrames.itemCount, 2,
"Should also have only two in the mirrored view.");
is(gFrames.getItemAtIndex(0).attachment.title,
"evalCall", "Oldest frame name should be correct.");
is(gFrames.getItemAtIndex(0).attachment.url,
TAB_URL, "Oldest frame url should be correct.");
is(gClassicFrames.getItemAtIndex(0).attachment.depth,
0, "Oldest frame name is mirrored correctly.");
is(gFrames.getItemAtIndex(1).attachment.title,
"(eval)", "Newest frame name should be correct.");
is(gFrames.getItemAtIndex(1).attachment.url,
TAB_URL, "Newest frame url should be correct.");
is(gClassicFrames.getItemAtIndex(1).attachment.depth,
1, "Newest frame name is mirrored correctly.");
is(gFrames.selectedIndex, 1,
"Newest frame should be selected by default.");
is(gClassicFrames.selectedIndex, 0,
"Newest frame should be selected by default in the mirrored view.");
isnot(gFrames.selectedIndex, 0,
"Oldest frame should not be selected.");
isnot(gClassicFrames.selectedIndex, 1,
"Oldest frame should not be selected in the mirrored view.");
EventUtils.sendMouseEvent({ type: "mousedown" },
gFrames.getItemAtIndex(0).target,
gDebugger);
isnot(gFrames.selectedIndex, 1,
"Newest frame should not be selected after click.");
isnot(gClassicFrames.selectedIndex, 0,
"Newest frame in the mirrored view should not be selected.");
is(gFrames.selectedIndex, 0,
"Oldest frame should be selected after click.");
is(gClassicFrames.selectedIndex, 1,
"Oldest frame in the mirrored view should be selected.");
EventUtils.sendMouseEvent({ type: "mousedown" },
gFrames.getItemAtIndex(1).target.querySelector(".dbg-stackframe-title"),
gDebugger);
is(gFrames.selectedIndex, 1,
"Newest frame should be selected after click inside the newest frame.");
is(gClassicFrames.selectedIndex, 0,
"Newest frame in the mirrored view should be selected.");
isnot(gFrames.selectedIndex, 0,
"Oldest frame should not be selected after click inside the newest frame.");
isnot(gClassicFrames.selectedIndex, 1,
"Oldest frame in the mirrored view should not be selected.");
EventUtils.sendMouseEvent({ type: "mousedown" },
gFrames.getItemAtIndex(0).target.querySelector(".dbg-stackframe-details"),
gDebugger);
isnot(gFrames.selectedIndex, 1,
"Newest frame should not be selected after click inside the oldest frame.");
isnot(gClassicFrames.selectedIndex, 0,
"Newest frame in the mirrored view should not be selected.");
is(gFrames.selectedIndex, 0,
"Oldest frame should be selected after click inside the oldest frame.");
is(gClassicFrames.selectedIndex, 1,
"Oldest frame in the mirrored view should be selected.");
resumeDebuggerThenCloseAndFinish(gPanel);
}
registerCleanupFunction(function() {
gTab = null;
gPanel = null;
gDebugger = null;
gFrames = null;
gClassicFrames = null;
});
|