browser/devtools/debugger/test/browser_dbg_location-changes-01-simple.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 /**
     5  * Make sure that changing the tab location URL works.
     6  */
     8 const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html";
    10 let gTab, gDebuggee, gPanel, gDebugger;
    11 let gEditor, gSources, gFrames;
    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     gEditor = gDebugger.DebuggerView.editor;
    20     gSources = gDebugger.DebuggerView.Sources;
    21     gFrames = gDebugger.DebuggerView.StackFrames;
    23     waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest);
    24     gDebuggee.simpleCall();
    25   });
    26 }
    28 function performTest() {
    29   is(gDebugger.gThreadClient.state, "paused",
    30     "Should only be getting stack frames while paused.");
    32   is(gFrames.itemCount, 1,
    33     "Should have only one frame.");
    35   is(gSources.itemCount, 1,
    36     "Found the expected number of entries in the sources widget.");
    38   isnot(gSources.selectedValue, null,
    39     "There should be a selected source value.");
    40   isnot(gEditor.getText().length, 0,
    41     "The source editor should have some text displayed.");
    42   isnot(gEditor.getText(), gDebugger.L10N.getStr("loadingText"),
    43     "The source editor text should not be 'Loading...'");
    45   is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice-container").length, 0,
    46     "The sources widget should not display any notice at this point (1).");
    47   is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice").length, 0,
    48     "The sources widget should not display any notice at this point (2).");
    49   is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-notice > label"), null,
    50     "The sources widget should not display a notice at this point (3).");
    52   gDebugger.gThreadClient.resume(() => {
    53     testLocationChange();
    54   });
    55 }
    57 function testLocationChange() {
    58   navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => {
    59     closeDebuggerAndFinish(gPanel);
    60   });
    61 }
    63 registerCleanupFunction(function() {
    64   gTab = null;
    65   gDebuggee = null;
    66   gPanel = null;
    67   gDebugger = null;
    68   gEditor = null;
    69   gSources = null;
    70   gFrames = null;
    71 });

mercurial