Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 to a page with other sources works. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | const TAB_URL_1 = EXAMPLE_URL + "doc_recursion-stack.html"; |
michael@0 | 9 | const TAB_URL_2 = EXAMPLE_URL + "doc_iframes.html"; |
michael@0 | 10 | |
michael@0 | 11 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 12 | let gEditor, gSources, gFrames; |
michael@0 | 13 | |
michael@0 | 14 | function test() { |
michael@0 | 15 | initDebugger(TAB_URL_1).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 16 | gTab = aTab; |
michael@0 | 17 | gDebuggee = aDebuggee; |
michael@0 | 18 | gPanel = aPanel; |
michael@0 | 19 | gDebugger = gPanel.panelWin; |
michael@0 | 20 | gEditor = gDebugger.DebuggerView.editor; |
michael@0 | 21 | gSources = gDebugger.DebuggerView.Sources; |
michael@0 | 22 | gFrames = gDebugger.DebuggerView.StackFrames; |
michael@0 | 23 | |
michael@0 | 24 | waitForSourceAndCaretAndScopes(gPanel, ".html", 14).then(testLocationChange); |
michael@0 | 25 | gDebuggee.simpleCall(); |
michael@0 | 26 | }); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | function testLocationChange() { |
michael@0 | 30 | navigateActiveTabTo(gPanel, TAB_URL_2, gDebugger.EVENTS.SOURCES_ADDED).then(() => { |
michael@0 | 31 | isnot(gDebugger.gThreadClient.state, "paused", |
michael@0 | 32 | "Should not be paused after a tab navigation."); |
michael@0 | 33 | |
michael@0 | 34 | is(gFrames.itemCount, 0, |
michael@0 | 35 | "Should have no frames."); |
michael@0 | 36 | |
michael@0 | 37 | is(gSources.itemCount, 1, |
michael@0 | 38 | "Found the expected number of entries in the sources widget."); |
michael@0 | 39 | |
michael@0 | 40 | is(gSources.selectedValue, EXAMPLE_URL + "doc_inline-debugger-statement.html", |
michael@0 | 41 | "There should be a selected source value."); |
michael@0 | 42 | isnot(gEditor.getText().length, 0, |
michael@0 | 43 | "The source editor should have some text displayed."); |
michael@0 | 44 | is(gEditor.getText(), gDebugger.L10N.getStr("loadingText"), |
michael@0 | 45 | "The source editor text should not be 'Loading...'"); |
michael@0 | 46 | |
michael@0 | 47 | is(gDebugger.document.querySelectorAll("#sources .side-menu-widget-empty-text").length, 0, |
michael@0 | 48 | "The sources widget should not display any notice at this point."); |
michael@0 | 49 | |
michael@0 | 50 | closeDebuggerAndFinish(gPanel); |
michael@0 | 51 | }); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | registerCleanupFunction(function() { |
michael@0 | 55 | gTab = null; |
michael@0 | 56 | gDebuggee = null; |
michael@0 | 57 | gPanel = null; |
michael@0 | 58 | gDebugger = null; |
michael@0 | 59 | gEditor = null; |
michael@0 | 60 | gSources = null; |
michael@0 | 61 | gFrames = null; |
michael@0 | 62 | }); |