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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 /**
michael@0 5 * Test that stackframes are scrollable.
michael@0 6 */
michael@0 7
michael@0 8 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
michael@0 9
michael@0 10 let gTab, gDebuggee, gPanel, gDebugger;
michael@0 11 let gFrames, gClassicFrames, gFramesScrollingInterval;
michael@0 12
michael@0 13 function test() {
michael@0 14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
michael@0 15 gTab = aTab;
michael@0 16 gDebuggee = aDebuggee;
michael@0 17 gPanel = aPanel;
michael@0 18 gDebugger = gPanel.panelWin;
michael@0 19 gFrames = gDebugger.DebuggerView.StackFrames;
michael@0 20 gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList;
michael@0 21
michael@0 22 waitForSourceAndCaretAndScopes(gPanel, ".html", 26).then(performTest);
michael@0 23
michael@0 24 gDebuggee.gRecurseLimit = (gDebugger.gCallStackPageSize * 2) + 1;
michael@0 25 gDebuggee.recurse();
michael@0 26 });
michael@0 27 }
michael@0 28
michael@0 29 function performTest() {
michael@0 30 is(gDebugger.gThreadClient.state, "paused",
michael@0 31 "Should only be getting stack frames while paused.");
michael@0 32 is(gFrames.itemCount, gDebugger.gCallStackPageSize,
michael@0 33 "Should have only the max limit of frames.");
michael@0 34 is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize,
michael@0 35 "Should have only the max limit of frames in the mirrored view as well.")
michael@0 36
michael@0 37 gDebugger.gThreadClient.addOneTimeListener("framesadded", () => {
michael@0 38 is(gFrames.itemCount, gDebugger.gCallStackPageSize * 2,
michael@0 39 "Should now have twice the max limit of frames.");
michael@0 40 is(gClassicFrames.itemCount, gDebugger.gCallStackPageSize * 2,
michael@0 41 "Should now have twice the max limit of frames in the mirrored view as well.");
michael@0 42
michael@0 43 gDebugger.gThreadClient.addOneTimeListener("framesadded", () => {
michael@0 44 is(gFrames.itemCount, gDebuggee.gRecurseLimit,
michael@0 45 "Should have reached the recurse limit.");
michael@0 46 is(gClassicFrames.itemCount, gDebuggee.gRecurseLimit,
michael@0 47 "Should have reached the recurse limit in the mirrored view as well.");
michael@0 48
michael@0 49 gDebugger.gThreadClient.resume(() => {
michael@0 50 window.clearInterval(gFramesScrollingInterval);
michael@0 51 closeDebuggerAndFinish(gPanel);
michael@0 52 });
michael@0 53 });
michael@0 54 });
michael@0 55
michael@0 56 gFramesScrollingInterval = window.setInterval(() => {
michael@0 57 gFrames.widget._list.scrollByIndex(-1);
michael@0 58 }, 100);
michael@0 59 }
michael@0 60
michael@0 61 registerCleanupFunction(function() {
michael@0 62 window.clearInterval(gFramesScrollingInterval);
michael@0 63 gFramesScrollingInterval = null;
michael@0 64
michael@0 65 gTab = null;
michael@0 66 gDebuggee = null;
michael@0 67 gPanel = null;
michael@0 68 gDebugger = null;
michael@0 69 gFrames = null;
michael@0 70 gClassicFrames = null;
michael@0 71 });

mercurial