1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_location-changes-02-blank.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Make sure that changing the tab location URL to a page with no sources works. 1.9 + */ 1.10 + 1.11 +const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; 1.12 + 1.13 +let gTab, gDebuggee, gPanel, gDebugger; 1.14 +let gEditor, gSources, gFrames; 1.15 + 1.16 +function test() { 1.17 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.18 + gTab = aTab; 1.19 + gDebuggee = aDebuggee; 1.20 + gPanel = aPanel; 1.21 + gDebugger = gPanel.panelWin; 1.22 + gEditor = gDebugger.DebuggerView.editor; 1.23 + gSources = gDebugger.DebuggerView.Sources; 1.24 + gFrames = gDebugger.DebuggerView.StackFrames; 1.25 + 1.26 + waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange); 1.27 + gDebuggee.simpleCall(); 1.28 + }); 1.29 +} 1.30 + 1.31 +function testLocationChange() { 1.32 + navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => { 1.33 + isnot(gDebugger.gThreadClient.state, "paused", 1.34 + "Should not be paused after a tab navigation."); 1.35 + 1.36 + is(gFrames.itemCount, 0, 1.37 + "Should have no frames."); 1.38 + 1.39 + is(gSources.itemCount, 0, 1.40 + "Found no entries in the sources widget."); 1.41 + 1.42 + is(gSources.selectedValue, "", 1.43 + "There should be no selected source value."); 1.44 + is(gEditor.getText().length, 0, 1.45 + "The source editor should not have any text displayed."); 1.46 + 1.47 + is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 1, 1.48 + "The sources widget should now display a notice (1)."); 1.49 + is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text")[0].getAttribute("value"), 1.50 + gDebugger.L10N.getStr("noSourcesText"), 1.51 + "The sources widget should now display a notice (2)."); 1.52 + 1.53 + closeDebuggerAndFinish(gPanel); 1.54 + }); 1.55 +} 1.56 + 1.57 +registerCleanupFunction(function() { 1.58 + gTab = null; 1.59 + gDebuggee = null; 1.60 + gPanel = null; 1.61 + gDebugger = null; 1.62 + gEditor = null; 1.63 + gSources = null; 1.64 + gFrames = null; 1.65 +});