browser/devtools/debugger/test/browser_dbg_stack-04.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:bc2296894752
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Test that stackframes are cleared after resume.
6 */
7
8 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
9
10 let gTab, gDebuggee, gPanel, gDebugger;
11 let gFrames, gClassicFrames;
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", 1).then(performTest);
23 gDebuggee.evalCall();
24 });
25 }
26
27 function performTest() {
28 is(gDebugger.gThreadClient.state, "paused",
29 "Should only be getting stack frames while paused.");
30 is(gFrames.itemCount, 2,
31 "Should have two frames.");
32 is(gClassicFrames.itemCount, 2,
33 "Should also have two frames in the mirrored view.");
34
35 gDebugger.once(gDebugger.EVENTS.AFTER_FRAMES_CLEARED, () => {
36 is(gFrames.itemCount, 0,
37 "Should have no frames after resume.");
38 is(gClassicFrames.itemCount, 0,
39 "Should also have no frames in the mirrored view after resume.");
40
41 closeDebuggerAndFinish(gPanel);
42 }, true);
43
44 gDebugger.gThreadClient.resume();
45 }
46
47 registerCleanupFunction(function() {
48 gTab = null;
49 gDebuggee = null;
50 gPanel = null;
51 gDebugger = null;
52 gFrames = null;
53 gClassicFrames = null;
54 });

mercurial