2013-09-05 09:10:12 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
2013-09-13 06:23:18 -07:00
|
|
|
* Make sure that the DebuggerView error loading source text is correct.
|
2013-09-05 09:10:12 -07:00
|
|
|
*/
|
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html";
|
2013-09-05 09:10:12 -07:00
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
let gTab, gDebuggee, gPanel, gDebugger;
|
|
|
|
let gView, gEditor, gL10N;
|
2013-09-05 09:10:12 -07:00
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
function test() {
|
|
|
|
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
|
2013-09-05 09:10:12 -07:00
|
|
|
gTab = aTab;
|
|
|
|
gDebuggee = aDebuggee;
|
2013-09-13 06:23:18 -07:00
|
|
|
gPanel = aPanel;
|
|
|
|
gDebugger = gPanel.panelWin;
|
2013-09-05 09:10:12 -07:00
|
|
|
gView = gDebugger.DebuggerView;
|
2013-09-13 06:23:18 -07:00
|
|
|
gEditor = gDebugger.DebuggerView.editor;
|
2013-09-05 09:10:12 -07:00
|
|
|
gL10N = gDebugger.L10N;
|
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
waitForSourceShown(gPanel, "-01.js")
|
|
|
|
.then(showBogusSource)
|
|
|
|
.then(testDebuggerLoadingError)
|
|
|
|
.then(() => closeDebuggerAndFinish(gPanel))
|
|
|
|
.then(null, aError => {
|
|
|
|
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
|
|
|
|
});
|
2013-09-05 09:10:12 -07:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
function showBogusSource() {
|
|
|
|
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_ERROR_SHOWN);
|
|
|
|
gView._setEditorSource({ url: "http://example.com/fake.js", actor: "fake.actor" });
|
|
|
|
return finished;
|
2013-09-05 09:10:12 -07:00
|
|
|
}
|
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
function testDebuggerLoadingError() {
|
|
|
|
ok(gEditor.getText().contains(gL10N.getStr("errorLoadingText")),
|
2013-09-05 09:10:12 -07:00
|
|
|
"The valid error loading message is displayed.");
|
|
|
|
}
|
|
|
|
|
2013-09-13 06:23:18 -07:00
|
|
|
registerCleanupFunction(function() {
|
2013-09-05 09:10:12 -07:00
|
|
|
gTab = null;
|
2013-09-13 06:23:18 -07:00
|
|
|
gDebuggee = null;
|
|
|
|
gPanel = null;
|
2013-09-05 09:10:12 -07:00
|
|
|
gDebugger = null;
|
|
|
|
gView = null;
|
2013-09-13 06:23:18 -07:00
|
|
|
gEditor = null;
|
2013-09-05 09:10:12 -07:00
|
|
|
gL10N = null;
|
|
|
|
});
|