1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_blackboxing-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 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 black boxed frames are compressed into a single frame on the stack 1.9 + * view. 1.10 + */ 1.11 + 1.12 +const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; 1.13 +const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js" 1.14 + 1.15 +let gTab, gDebuggee, gPanel, gDebugger; 1.16 +let gFrames; 1.17 + 1.18 +function test() { 1.19 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.20 + gTab = aTab; 1.21 + gDebuggee = aDebuggee; 1.22 + gPanel = aPanel; 1.23 + gDebugger = gPanel.panelWin; 1.24 + gFrames = gDebugger.DebuggerView.StackFrames; 1.25 + 1.26 + waitForSourceShown(gPanel, BLACKBOXME_URL) 1.27 + .then(testBlackBoxSource) 1.28 + .then(testBlackBoxStack) 1.29 + .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) 1.30 + .then(null, aError => { 1.31 + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); 1.32 + }); 1.33 + }); 1.34 +} 1.35 + 1.36 +function testBlackBoxSource() { 1.37 + return toggleBlackBoxing(gPanel).then(aSource => { 1.38 + ok(aSource.isBlackBoxed, "The source should be black boxed now."); 1.39 + }); 1.40 +} 1.41 + 1.42 +function testBlackBoxStack() { 1.43 + let finished = waitForSourceAndCaretAndScopes(gPanel, ".html", 21).then(() => { 1.44 + is(gFrames.itemCount, 3, 1.45 + "Should only get 3 frames."); 1.46 + is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1, 1.47 + "And one of them should be the combined black boxed frames."); 1.48 + }); 1.49 + 1.50 + // Spin the event loop before causing the debuggee to pause, to allow 1.51 + // this function to return first. 1.52 + executeSoon(() => gDebuggee.runTest()); 1.53 + return finished; 1.54 +} 1.55 + 1.56 +registerCleanupFunction(function() { 1.57 + gTab = null; 1.58 + gDebuggee = null; 1.59 + gPanel = null; 1.60 + gDebugger = null; 1.61 + gFrames = null; 1.62 +});