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.

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

mercurial