|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 /** |
|
5 * Make sure that the DebuggerView error loading source text is correct. |
|
6 */ |
|
7 |
|
8 const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; |
|
9 |
|
10 let gTab, gDebuggee, gPanel, gDebugger; |
|
11 let gView, gEditor, gL10N; |
|
12 |
|
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; |
|
22 |
|
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 } |
|
32 |
|
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 } |
|
38 |
|
39 function testDebuggerLoadingError() { |
|
40 ok(gEditor.getText().contains(gL10N.getStr("errorLoadingText")), |
|
41 "The valid error loading message is displayed."); |
|
42 } |
|
43 |
|
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 }); |