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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 /**
5 * Make sure that the DebuggerView error loading source text is correct.
6 */
8 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
10 let gTab, gDebuggee, gPanel, gDebugger;
11 let gView, gEditor, gL10N;
13 function test() {
14 initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
15 gTab = aTab;
16 gDebuggee = aDebuggee;
17 gPanel = aPanel;
18 gDebugger = gPanel.panelWin;
19 gView = gDebugger.DebuggerView;
20 gEditor = gDebugger.DebuggerView.editor;
21 gL10N = gDebugger.L10N;
23 waitForSourceShown(gPanel, "-01.js")
24 .then(showBogusSource)
25 .then(testDebuggerLoadingError)
26 .then(() => closeDebuggerAndFinish(gPanel))
27 .then(null, aError => {
28 ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
29 });
30 });
31 }
33 function showBogusSource() {
34 let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_ERROR_SHOWN);
35 gView._setEditorSource({ url: "http://example.com/fake.js", actor: "fake.actor" });
36 return finished;
37 }
39 function testDebuggerLoadingError() {
40 ok(gEditor.getText().contains(gL10N.getStr("errorLoadingText")),
41 "The valid error loading message is displayed.");
42 }
44 registerCleanupFunction(function() {
45 gTab = null;
46 gDebuggee = null;
47 gPanel = null;
48 gDebugger = null;
49 gView = null;
50 gEditor = null;
51 gL10N = null;
52 });