Bug 1244892 - fix unhandled promise rejection in debugger test browser_dbg_scripts-switching-03.js r=ejpbruel

This commit is contained in:
James Long 2016-02-03 09:41:59 -05:00
parent 8b8676204b
commit 9b752e46c8

View File

@ -17,24 +17,43 @@ function test() {
const gView = gDebugger.DebuggerView;
const gEditor = gDebugger.DebuggerView.editor;
const gL10N = gDebugger.L10N;
const require = gDebugger.require;
const actions = bindActionCreators(gPanel);
const constants = require("./content/constants");
const controller = gDebugger.DebuggerController;
function showBogusSource() {
let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_ERROR_SHOWN);
actions.newSource({ url: "http://example.com/fake.js", actor: "fake.actor" });
actions.selectSource({ actor: "fake.actor" });
return finished;
const source = { actor: "fake.actor", url: "http://fake.url/" };
actions.newSource(source);
controller.dispatch({
type: constants.LOAD_SOURCE_TEXT,
source: source,
status: "start"
});
controller.dispatch({
type: constants.SELECT_SOURCE,
source: source
});
controller.dispatch({
type: constants.LOAD_SOURCE_TEXT,
source: source,
status: "error",
error: "bogus actor"
});
}
function testDebuggerLoadingError() {
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText2", "No such actor for ID: fake.actor")),
ok(gEditor.getText().includes(gL10N.getFormatStr("errorLoadingText2", "")),
"The valid error loading message is displayed.");
}
Task.spawn(function*() {
yield waitForSourceShown(gPanel, "-01.js");
yield showBogusSource();
yield testDebuggerLoadingError();
showBogusSource();
testDebuggerLoadingError();
closeDebuggerAndFinish(gPanel);
});
});