browser/devtools/debugger/test/browser_dbg_stack-06.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  * Make sure that selecting a stack frame loads the right source in the editor
     6  * pane and highlights the proper line.
     7  */
     9 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
    11 let gTab, gDebuggee, gPanel, gDebugger;
    12 let gEditor, gSources, gFrames, gClassicFrames;
    14 function test() {
    15   initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
    16     gTab = aTab;
    17     gDebuggee = aDebuggee;
    18     gPanel = aPanel;
    19     gDebugger = gPanel.panelWin;
    20     gEditor = gDebugger.DebuggerView.editor;
    21     gSources = gDebugger.DebuggerView.Sources;
    22     gFrames = gDebugger.DebuggerView.StackFrames;
    23     gClassicFrames = gDebugger.DebuggerView.StackFramesClassicList;
    25     waitForSourceAndCaretAndScopes(gPanel, "-02.js", 1).then(performTest);
    26     gDebuggee.firstCall();
    27   });
    28 }
    30 function performTest() {
    31   is(gFrames.selectedIndex, 3,
    32     "Newest frame should be selected by default.");
    33   is(gClassicFrames.selectedIndex, 0,
    34     "Newest frame should also be selected in the mirrored view.");
    35   is(gSources.selectedIndex, 1,
    36     "The second source is selected in the widget.");
    37   is(gEditor.getText().search(/firstCall/), -1,
    38     "The first source is not displayed.");
    39   is(gEditor.getText().search(/debugger/), 172,
    40     "The second source is displayed.");
    42   waitForSourceAndCaret(gPanel, "-01.js", 1).then(waitForTick).then(() => {
    43     is(gFrames.selectedIndex, 0,
    44       "Oldest frame should be selected after click.");
    45     is(gClassicFrames.selectedIndex, 3,
    46       "Oldest frame should also be selected in the mirrored view.");
    47     is(gSources.selectedIndex, 0,
    48       "The first source is now selected in the widget.");
    49     is(gEditor.getText().search(/firstCall/), 118,
    50       "The first source is displayed.");
    51     is(gEditor.getText().search(/debugger/), -1,
    52       "The second source is not displayed.");
    54     waitForSourceAndCaret(gPanel, "-02.js", 1).then(waitForTick).then(() => {
    55       is(gFrames.selectedIndex, 3,
    56         "Newest frame should be selected again after click.");
    57       is(gClassicFrames.selectedIndex, 0,
    58         "Newest frame should also be selected again in the mirrored view.");
    59       is(gSources.selectedIndex, 1,
    60         "The second source is selected in the widget.");
    61       is(gEditor.getText().search(/firstCall/), -1,
    62         "The first source is not displayed.");
    63       is(gEditor.getText().search(/debugger/), 172,
    64         "The second source is displayed.");
    66       resumeDebuggerThenCloseAndFinish(gPanel);
    67     });
    69     EventUtils.sendMouseEvent({ type: "mousedown" },
    70       gDebugger.document.querySelector("#classic-stackframe-0"),
    71       gDebugger);
    72   });
    74   EventUtils.sendMouseEvent({ type: "mousedown" },
    75     gDebugger.document.querySelector("#stackframe-3"),
    76     gDebugger);
    77 }
    79 registerCleanupFunction(function() {
    80   gTab = null;
    81   gDebuggee = null;
    82   gPanel = null;
    83   gDebugger = null;
    84   gEditor = null;
    85   gSources = null;
    86   gFrames = null;
    87   gClassicFrames = null;
    88 });

mercurial