michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Make sure that changing the tab location URL to a page with other sources works. michael@0: */ michael@0: michael@0: const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html"; michael@0: const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html"; michael@0: michael@0: let gTab, gDebuggee, gPanel, gDebugger; michael@0: let gEditor, gSources, gFrames; michael@0: michael@0: function test() { michael@0: initDebugger(TAB_URL_1).then(([aTab, aDebuggee, aPanel]) => { michael@0: gTab = aTab; michael@0: gDebuggee = aDebuggee; michael@0: gPanel = aPanel; michael@0: gDebugger = gPanel.panelWin; michael@0: gEditor = gDebugger.DebuggerView.editor; michael@0: gSources = gDebugger.DebuggerView.Sources; michael@0: gFrames = gDebugger.DebuggerView.StackFrames; michael@0: michael@0: waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange); michael@0: gDebuggee.simpleCall(); michael@0: }); michael@0: } michael@0: michael@0: function testLocationChange() { michael@0: navigateActiveTabTo(gPanel, TAB_URL_2, gDebugger.EVENTS.SOURCES_ADDED).then(() => { michael@0: isnot(gDebugger.gThreadClient.state, "paused", michael@0: "Should not be paused after a tab navigation."); michael@0: michael@0: is(gFrames.itemCount, 0, michael@0: "Should have no frames."); michael@0: michael@0: is(gSources.itemCount, 1, michael@0: "Found the expected number of entries in the sources widget."); michael@0: michael@0: is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html", michael@0: "There should be a selected source value."); michael@0: isnot(gEditor.getText().length, 0, michael@0: "The source editor should have some text displayed."); michael@0: is(gEditor.getText(), gDebugger.L10N.getStr("loadingText"), michael@0: "The source editor text should not be 'Loading...'"); michael@0: michael@0: is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 0, michael@0: "The sources widget should not display any notice at this point."); michael@0: michael@0: closeDebuggerAndFinish(gPanel); michael@0: }); michael@0: } michael@0: michael@0: registerCleanupFunction(function() { michael@0: gTab = null; michael@0: gDebuggee = null; michael@0: gPanel = null; michael@0: gDebugger = null; michael@0: gEditor = null; michael@0: gSources = null; michael@0: gFrames = null; michael@0: });