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 the DebuggerView error loading source text is correct. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; |
michael@0 | 9 | |
michael@0 | 10 | let gTab, gDebuggee, gPanel, gDebugger; |
michael@0 | 11 | let gView, gEditor, gL10N; |
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 | gView = gDebugger.DebuggerView; |
michael@0 | 20 | gEditor = gDebugger.DebuggerView.editor; |
michael@0 | 21 | gL10N = gDebugger.L10N; |
michael@0 | 22 | |
michael@0 | 23 | waitForSourceShown(gPanel, "-01.js") |
michael@0 | 24 | .then(showBogusSource) |
michael@0 | 25 | .then(testDebuggerLoadingError) |
michael@0 | 26 | .then(() => closeDebuggerAndFinish(gPanel)) |
michael@0 | 27 | .then(null, aError => { |
michael@0 | 28 | ok(false, "Got an error: " + aError.message + "\n" + aError.stack); |
michael@0 | 29 | }); |
michael@0 | 30 | }); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | function showBogusSource() { |
michael@0 | 34 | let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_ERROR_SHOWN); |
michael@0 | 35 | gView._setEditorSource({ url: "http://example.com/fake.js", actor: "fake.actor" }); |
michael@0 | 36 | return finished; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | function testDebuggerLoadingError() { |
michael@0 | 40 | ok(gEditor.getText().contains(gL10N.getStr("errorLoadingText")), |
michael@0 | 41 | "The valid error loading message is displayed."); |
michael@0 | 42 | } |
michael@0 | 43 | |
michael@0 | 44 | registerCleanupFunction(function() { |
michael@0 | 45 | gTab = null; |
michael@0 | 46 | gDebuggee = null; |
michael@0 | 47 | gPanel = null; |
michael@0 | 48 | gDebugger = null; |
michael@0 | 49 | gView = null; |
michael@0 | 50 | gEditor = null; |
michael@0 | 51 | gL10N = null; |
michael@0 | 52 | }); |