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 | * Tests if the preferred source is shown when a page is loaded and |
michael@0 | 6 | * the preferred source is specified before any other source was shown. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; |
michael@0 | 10 | const PREFERRED_URL = EXAMPLE_URL + "code_script-switching-02.js"; |
michael@0 | 11 | |
michael@0 | 12 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 13 | let gSources; |
michael@0 | 14 | |
michael@0 | 15 | function test() { |
michael@0 | 16 | initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { |
michael@0 | 17 | gTab = aTab; |
michael@0 | 18 | gDebuggee = aDebuggee; |
michael@0 | 19 | gPanel = aPanel; |
michael@0 | 20 | gDebugger = gPanel.panelWin; |
michael@0 | 21 | gSources = gDebugger.DebuggerView.Sources; |
michael@0 | 22 | |
michael@0 | 23 | waitForSourceShown(gPanel, PREFERRED_URL).then(finishTest); |
michael@0 | 24 | }); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function finishTest() { |
michael@0 | 28 | info("Currently preferred source: " + gSources.preferredValue); |
michael@0 | 29 | info("Currently selected source: " + gSources.selectedValue); |
michael@0 | 30 | |
michael@0 | 31 | is(gSources.preferredValue, PREFERRED_URL, |
michael@0 | 32 | "The preferred source url wasn't set correctly."); |
michael@0 | 33 | is(gSources.selectedValue, PREFERRED_URL, |
michael@0 | 34 | "The selected source isn't the correct one."); |
michael@0 | 35 | |
michael@0 | 36 | closeDebuggerAndFinish(gPanel); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function prepareDebugger(aPanel) { |
michael@0 | 40 | aPanel._view.Sources.preferredSource = PREFERRED_URL; |
michael@0 | 41 | } |
michael@0 | 42 | |
michael@0 | 43 | registerCleanupFunction(function() { |
michael@0 | 44 | gTab = null; |
michael@0 | 45 | gDebuggee = null; |
michael@0 | 46 | gPanel = null; |
michael@0 | 47 | gDebugger = null; |
michael@0 | 48 | gSources = null; |
michael@0 | 49 | }); |