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 stackframes are scrollable. michael@0: */ michael@0: michael@0: const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; michael@0: michael@0: let gTab, gDebuggee, gPanel, gDebugger; michael@0: let gFrames, gClassicFrames, gFramesScrollingInterval; 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: gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList; michael@0: michael@0: waitForSourceAndCaretAndScopes(gPanel, ".html", 26).then(performTest); michael@0: michael@0: gDebuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1; michael@0: gDebuggee.recurse(); michael@0: }); michael@0: } michael@0: michael@0: function performTest() { michael@0: is(gDebugger.gThreadClient.state, "paused", michael@0: "Should only be getting stack frames while paused."); michael@0: is(gFrames.itemCount, gDebugger.gCallStackPageSize, michael@0: "Should have only the max limit of frames."); michael@0: is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize, michael@0: "Should have only the max limit of frames in the mirrored view as well.") michael@0: michael@0: gDebugger.gThreadClient.addOneTimeListener("framesadded", () => { michael@0: is(gFrames.itemCount, gDebugger.gCallStackPageSize * 2, michael@0: "Should now have twice the max limit of frames."); michael@0: is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize * 2, michael@0: "Should now have twice the max limit of frames in the mirrored view as well."); michael@0: michael@0: gDebugger.gThreadClient.addOneTimeListener("framesadded", () => { michael@0: is(gFrames.itemCount, gDebuggee.gRecurseLimit, michael@0: "Should have reached the recurse limit."); michael@0: is(gClassicFrames.itemCount, gDebuggee.gRecurseLimit, michael@0: "Should have reached the recurse limit in the mirrored view as well."); michael@0: michael@0: gDebugger.gThreadClient.resume(() => { michael@0: window.clearInterval(gFramesScrollingInterval); michael@0: closeDebuggerAndFinish(gPanel); michael@0: }); michael@0: }); michael@0: }); michael@0: michael@0: gFramesScrollingInterval = window.setInterval(() => { michael@0: gFrames.widget._list.scrollByIndex(-1); michael@0: }, 100); michael@0: } michael@0: michael@0: registerCleanupFunction(function() { michael@0: window.clearInterval(gFramesScrollingInterval); michael@0: gFramesScrollingInterval = null; michael@0: michael@0: gTab = null; michael@0: gDebuggee = null; michael@0: gPanel = null; michael@0: gDebugger = null; michael@0: gFrames = null; michael@0: gClassicFrames = null; michael@0: });