forked from firefox-devtools/debugger
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbrowser_dbg-call-stack.js
More file actions
54 lines (41 loc) · 1.79 KB
/
Copy pathbrowser_dbg-call-stack.js
File metadata and controls
54 lines (41 loc) · 1.79 KB
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
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// checks to see if the frame is selected and the title is correct
function isFrameSelected(dbg, index, title) {
const $frame = findElement(dbg, "frame", index);
const frame = dbg.selectors.getSelectedFrame(dbg.getState());
const elSelected = $frame.classList.contains("selected");
const titleSelected = frame.displayName == title;
return elSelected && titleSelected;
}
function toggleButton(dbg) {
const callStackBody = findElement(dbg, "callStackBody");
return callStackBody.querySelector(".show-more");
}
add_task(async function() {
const dbg = await initDebugger("doc-script-switching.html");
const found = findElement(dbg, "callStackBody");
is(found, null, "Call stack is hidden");
invokeInTab("firstCall");
await waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "secondCall"), "the first frame is selected");
let button = toggleButton(dbg);
ok(!button, "toggle button shouldn't be there");
});
add_task(async function() {
const dbg = await initDebugger("doc-frames.html");
invokeInTab("startRecursion");
await waitForPaused(dbg);
ok(isFrameSelected(dbg, 1, "recurseA"), "the first frame is selected");
// check to make sure that the toggle button isn't there
let button = toggleButton(dbg);
let frames = findAllElements(dbg, "frames");
is(button.innerText, "Expand rows", "toggle button should be 'expand'");
is(frames.length, 7, "There should be at most seven frames");
button.click();
button = toggleButton(dbg);
frames = findAllElements(dbg, "frames");
is(button.innerText, "Collapse rows", "toggle button should be collapsed");
is(frames.length, 22, "All of the frames should be shown");
await waitForSelectedSource(dbg, "frames.js");
});