1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/debugger/test/browser_dbg_scripts-switching-03.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +/** 1.8 + * Make sure that the DebuggerView error loading source text is correct. 1.9 + */ 1.10 + 1.11 +const TAB_URL = EXAMPLE_URL + "doc_script-switching-01.html"; 1.12 + 1.13 +let gTab, gDebuggee, gPanel, gDebugger; 1.14 +let gView, gEditor, gL10N; 1.15 + 1.16 +function test() { 1.17 + initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => { 1.18 + gTab = aTab; 1.19 + gDebuggee = aDebuggee; 1.20 + gPanel = aPanel; 1.21 + gDebugger = gPanel.panelWin; 1.22 + gView = gDebugger.DebuggerView; 1.23 + gEditor = gDebugger.DebuggerView.editor; 1.24 + gL10N = gDebugger.L10N; 1.25 + 1.26 + waitForSourceShown(gPanel, "-01.js") 1.27 + .then(showBogusSource) 1.28 + .then(testDebuggerLoadingError) 1.29 + .then(() => closeDebuggerAndFinish(gPanel)) 1.30 + .then(null, aError => { 1.31 + ok(false, "Got an error: " + aError.message + "\n" + aError.stack); 1.32 + }); 1.33 + }); 1.34 +} 1.35 + 1.36 +function showBogusSource() { 1.37 + let finished = waitForDebuggerEvents(gPanel, gDebugger.EVENTS.SOURCE_ERROR_SHOWN); 1.38 + gView._setEditorSource({ url: "http://example.com/fake.js", actor: "fake.actor" }); 1.39 + return finished; 1.40 +} 1.41 + 1.42 +function testDebuggerLoadingError() { 1.43 + ok(gEditor.getText().contains(gL10N.getStr("errorLoadingText")), 1.44 + "The valid error loading message is displayed."); 1.45 +} 1.46 + 1.47 +registerCleanupFunction(function() { 1.48 + gTab = null; 1.49 + gDebuggee = null; 1.50 + gPanel = null; 1.51 + gDebugger = null; 1.52 + gView = null; 1.53 + gEditor = null; 1.54 + gL10N = null; 1.55 +});