michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Test that black boxed frames are compressed into a single frame on the stack michael@0: * view when we are already paused. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_blackboxing.html"; michael@0: const BLACKBOXME_URL = EXAMPLE_URL + "code_blackboxing_blackboxme.js" michael@0: michael@0: let gTab, gDebuggee, gPanel, gDebugger; michael@0: let gFrames; michael@0: michael@0: function test() { michael@0: initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { michael@0: gTab = aTab; michael@0: gDebuggee = aDebuggee; michael@0: gPanel = aPanel; michael@0: gDebugger = gPanel.panelWin; michael@0: gFrames = gDebugger.DebuggerView.StackFrames; michael@0: michael@0: waitForSourceAndCaretAndScopes(gPanel, ".html", 21) michael@0: .then(testBlackBoxStack) michael@0: .then(testBlackBoxSource) michael@0: .then(() => resumeDebuggerThenCloseAndFinish(gPanel)) michael@0: .then(null, aError => { michael@0: ok(false, "Got an error: " + aError.message + "\n" + aError.stack); michael@0: }); michael@0: michael@0: gDebuggee.runTest(); michael@0: }); michael@0: } michael@0: michael@0: function testBlackBoxStack() { michael@0: is(gFrames.itemCount, 6, michael@0: "Should get 6 frames."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 0, michael@0: "And none of them are black boxed."); michael@0: } michael@0: michael@0: function testBlackBoxSource() { michael@0: return toggleBlackBoxing(gPanel, BLACKBOXME_URL).then(aSource => { michael@0: ok(aSource.isBlackBoxed, "The source should be black boxed now."); michael@0: michael@0: is(gFrames.itemCount, 3, michael@0: "Should only get 3 frames."); michael@0: is(gDebugger.document.querySelectorAll(".dbg-stackframe-black-boxed").length, 1, michael@0: "And one of them should be the combined black boxed frames."); michael@0: }); michael@0: } michael@0: michael@0: registerCleanupFunction(function() { michael@0: gTab = null; michael@0: gDebuggee = null; michael@0: gPanel = null; michael@0: gDebugger = null; michael@0: gFrames = null; michael@0: });