1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_stack-04.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,54 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Test that stackframes are cleared after resume. 1.9 + */ 1.10 + 1.11 +const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; 1.12 + 1.13 +let gTab, gDebuggee, gPanel, gDebugger; 1.14 +let gFrames, gClassicFrames; 1.15 + 1.16 +function test() { 1.17 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.18 + gTab = aTab; 1.19 + gDebuggee = aDebuggee; 1.20 + gPanel = aPanel; 1.21 + gDebugger = gPanel.panelWin; 1.22 + gFrames = gDebugger.DebuggerView.StackFrames; 1.23 + gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; 1.24 + 1.25 + waitForSourceAndCaretAndScopes(gPanel, ".html", 1).then(performTest); 1.26 + gDebuggee.evalCall(); 1.27 + }); 1.28 +} 1.29 + 1.30 +function performTest() { 1.31 + is(gDebugger.gThreadClient.state, "paused", 1.32 + "Should only be getting stack frames while paused."); 1.33 + is(gFrames.itemCount, 2, 1.34 + "Should have two frames."); 1.35 + is(gClassicFrames.itemCount, 2, 1.36 + "Should also have two frames in the mirrored view."); 1.37 + 1.38 + gDebugger.once(gDebugger.EVENTS.AFTER_FRAMES_CLEARED, () => { 1.39 + is(gFrames.itemCount, 0, 1.40 + "Should have no frames after resume."); 1.41 + is(gClassicFrames.itemCount, 0, 1.42 + "Should also have no frames in the mirrored view after resume."); 1.43 + 1.44 + closeDebuggerAndFinish(gPanel); 1.45 + }, true); 1.46 + 1.47 + gDebugger.gThreadClient.resume(); 1.48 +} 1.49 + 1.50 +registerCleanupFunction(function() { 1.51 + gTab = null; 1.52 + gDebuggee = null; 1.53 + gPanel = null; 1.54 + gDebugger = null; 1.55 + gFrames = null; 1.56 + gClassicFrames = null; 1.57 +});