gecko/browser/devtools/debugger/test/browser_dbg_scripts-switching-03.js
Victor Porof 78ccde907d Bug 876277 - Cleanup debugger location changes, sources switching and sources cache tests, r=past
--HG--
rename : browser/devtools/debugger/test/browser_dbg_update-editor-mode.js => browser/devtools/debugger/test/browser_dbg_editor-mode.js
rename : browser/devtools/debugger/test/browser_dbg_location-changes.js => browser/devtools/debugger/test/browser_dbg_location-changes-01-simple.js
rename : browser/devtools/debugger/test/browser_dbg_location-changes-blank.js => browser/devtools/debugger/test/browser_dbg_location-changes-02-blank.js
rename : browser/devtools/debugger/test/browser_dbg_location-changes-new.js => browser/devtools/debugger/test/browser_dbg_location-changes-03-new.js
rename : browser/devtools/debugger/test/browser_dbg_location-changes-bp.js => browser/devtools/debugger/test/browser_dbg_location-changes-04-breakpoint.js
rename : browser/devtools/debugger/test/browser_dbg_scripts-switching.js => browser/devtools/debugger/test/browser_dbg_scripts-switching-01.js
rename : browser/devtools/debugger/test/browser_dbg_propertyview-01.js => browser/devtools/debugger/test/browser_dbg_sources-labels.js
rename : browser/devtools/debugger/test/browser_dbg_scripts-sorting.js => browser/devtools/debugger/test/browser_dbg_sources-sorting.js
2013-09-13 16:23:18 +03:00

53 lines
1.4 KiB
JavaScript

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