1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_location-changes-03-new.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 other sources works. 1.9 + */ 1.10 + 1.11 +const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html"; 1.12 +const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html"; 1.13 + 1.14 +let gTab, gDebuggee, gPanel, gDebugger; 1.15 +let gEditor, gSources, gFrames; 1.16 + 1.17 +function test() { 1.18 + initDebugger(TAB_URL_1).then(([aTab, aDebuggee, aPanel]) => { 1.19 + gTab = aTab; 1.20 + gDebuggee = aDebuggee; 1.21 + gPanel = aPanel; 1.22 + gDebugger = gPanel.panelWin; 1.23 + gEditor = gDebugger.DebuggerView.editor; 1.24 + gSources = gDebugger.DebuggerView.Sources; 1.25 + gFrames = gDebugger.DebuggerView.StackFrames; 1.26 + 1.27 + waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange); 1.28 + gDebuggee.simpleCall(); 1.29 + }); 1.30 +} 1.31 + 1.32 +function testLocationChange() { 1.33 + navigateActiveTabTo(gPanel, TAB_URL_2, gDebugger.EVENTS.SOURCES_ADDED).then(() => { 1.34 + isnot(gDebugger.gThreadClient.state, "paused", 1.35 + "Should not be paused after a tab navigation."); 1.36 + 1.37 + is(gFrames.itemCount, 0, 1.38 + "Should have no frames."); 1.39 + 1.40 + is(gSources.itemCount, 1, 1.41 + "Found the expected number of entries in the sources widget."); 1.42 + 1.43 + is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html", 1.44 + "There should be a selected source value."); 1.45 + isnot(gEditor.getText().length, 0, 1.46 + "The source editor should have some text displayed."); 1.47 + is(gEditor.getText(), gDebugger.L10N.getStr("loadingText"), 1.48 + "The source editor text should not be 'Loading...'"); 1.49 + 1.50 + is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 0, 1.51 + "The sources widget should not display any notice at this point."); 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 +});