Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Make sure that changing the tab location URL works. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | const TAB_URL = EXAMPLE_URL + "doc_recursion-stack.html"; |
michael@0 | 9 | |
michael@0 | 10 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 11 | let gEditor, gSources, gFrames; |
michael@0 | 12 | |
michael@0 | 13 | function test() { |
michael@0 | 14 | initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 15 | gTab = aTab; |
michael@0 | 16 | gDebuggee = aDebuggee; |
michael@0 | 17 | gPanel = aPanel; |
michael@0 | 18 | gDebugger = gPanel.panelWin; |
michael@0 | 19 | gEditor = gDebugger.DebuggerView.editor; |
michael@0 | 20 | gSources = gDebugger.DebuggerView.Sources; |
michael@0 | 21 | gFrames = gDebugger.DebuggerView.StackFrames; |
michael@0 | 22 | |
michael@0 | 23 | waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(performTest); |
michael@0 | 24 | gDebuggee.simpleCall(); |
michael@0 | 25 | }); |
michael@0 | 26 | } |
michael@0 | 27 | |
michael@0 | 28 | function performTest() { |
michael@0 | 29 | is(gDebugger.gThreadClient.state, "paused", |
michael@0 | 30 | "Should only be getting stack frames while paused."); |
michael@0 | 31 | |
michael@0 | 32 | is(gFrames.itemCount, 1, |
michael@0 | 33 | "Should have only one frame."); |
michael@0 | 34 | |
michael@0 | 35 | is(gSources.itemCount, 1, |
michael@0 | 36 | "Found the expected number of entries in the sources widget."); |
michael@0 | 37 | |
michael@0 | 38 | isnot(gSources.selectedValue, null, |
michael@0 | 39 | "There should be a selected source value."); |
michael@0 | 40 | isnot(gEditor.getText().length, 0, |
michael@0 | 41 | "The source editor should have some text displayed."); |
michael@0 | 42 | isnot(gEditor.getText(), gDebugger.L10N.getStr("loadingText"), |
michael@0 | 43 | "The source editor text should not be 'Loading...'"); |
michael@0 | 44 | |
michael@0 | 45 | is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice-container").length, 0, |
michael@0 | 46 | "The sources widget should not display any notice at this point (1)."); |
michael@0 | 47 | is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-notice").length, 0, |
michael@0 | 48 | "The sources widget should not display any notice at this point (2)."); |
michael@0 | 49 | is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-notice > label"), null, |
michael@0 | 50 | "The sources widget should not display a notice at this point (3)."); |
michael@0 | 51 | |
michael@0 | 52 | gDebugger.gThreadClient.resume(() => { |
michael@0 | 53 | testLocationChange(); |
michael@0 | 54 | }); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | function testLocationChange() { |
michael@0 | 58 | navigateActiveTabTo(gPanel, "about:blank", gDebugger.EVENTS.SOURCES_ADDED).then(() => { |
michael@0 | 59 | closeDebuggerAndFinish(gPanel); |
michael@0 | 60 | }); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | registerCleanupFunction(function() { |
michael@0 | 64 | gTab = null; |
michael@0 | 65 | gDebuggee = null; |
michael@0 | 66 | gPanel = null; |
michael@0 | 67 | gDebugger = null; |
michael@0 | 68 | gEditor = null; |
michael@0 | 69 | gSources = null; |
michael@0 | 70 | gFrames = null; |
michael@0 | 71 | }); |