Bug 927673 - Fix forPage has no sources showing when debugger is loading. r=fitzgen

This commit is contained in:
Hubert B Manilla 2014-02-06 10:04:13 -05:00
parent 513a20c7ce
commit 37f5a906ad
6 changed files with 75 additions and 0 deletions

View File

@ -1188,6 +1188,12 @@ SourceScripts.prototype = {
return;
}
if (aResponse.sources.length === 0) {
DebuggerView.Sources.emptyText = L10N.getStr("noSourcesText");
window.emit(EVENTS.SOURCES_ADDED);
return;
}
// Add all the sources in the debugger view sources container.
for (let source of aResponse.sources) {
// Ignore bogus scripts, e.g. generated from 'clientEvaluate' packets.

View File

@ -637,6 +637,8 @@ let DebuggerView = {
this.editor.clearHistory();
this._editorSource = {};
}
this.Sources.emptyText = L10N.getStr("loadingSourcesText");
},
_startup: null,

View File

@ -52,6 +52,7 @@ support-files =
doc_large-array-buffer.html
doc_minified.html
doc_minified_bogus_map.html
doc_no-page-sources.html
doc_pause-exceptions.html
doc_pretty-print.html
doc_pretty-print-2.html
@ -131,6 +132,7 @@ support-files =
[browser_dbg_location-changes-04-breakpoint.js]
[browser_dbg_multiple-windows.js]
[browser_dbg_navigation.js]
[browser_dbg_no-page-sources.js]
[browser_dbg_on-pause-highlight.js]
[browser_dbg_panel-size.js]
[browser_dbg_parser-01.js]

View File

@ -0,0 +1,50 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure the right text shows when the page has no sources.
*/
const TAB_URL = EXAMPLE_URL + "doc_no-page-sources.html";
let gTab, gDebuggee, gPanel, gDebugger;
let gEditor, gSources;
function test() {
initDebugger(TAB_URL).then(([aTab, aDebuggee, aPanel]) => {
gTab = aTab;
gDebuggee = aDebuggee;
gPanel = aPanel;
gDebugger = gPanel.panelWin;
gEditor = gDebugger.DebuggerView.editor;
gSources = gDebugger.DebuggerView.Sources;
reloadActiveTab(gPanel, gDebugger.EVENTS.SOURCES_ADDED)
.then(testSourcesEmptyText)
.then(() => closeDebuggerAndFinish(gPanel))
.then(null, aError => {
ok(false, "Got an error: " + aError.message + "\n" + aError.stack);
});
});
}
function testSourcesEmptyText() {
is(gSources.itemCount, 0,
"Found no entries in the sources widget.");
is(gEditor.getText().length, 0,
"The source editor should not have any text displayed.");
is(gDebugger.document.querySelector("#sources .side-menu-widget-empty-text").getAttribute("value"),
gDebugger.L10N.getStr("noSourcesText"),
"The sources widget should now display 'This page has no sources'.");
}
registerCleanupFunction(function() {
gTab = null;
gDebuggee = null;
gPanel = null;
gDebugger = null;
gEditor = null;
gSources = null;
});

View File

@ -0,0 +1,11 @@
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>This page has no sources</title>
</head>
<body>
</body>
</html>

View File

@ -77,6 +77,10 @@ noGlobalsText=No globals
# when there are no scripts.
noSourcesText=This page has no sources.
# LOCALIZATION NOTE (loadingSourcesText): The text to display in the sources menu
# when waiting for scripts to load.
loadingSourcesText=Waiting for sources...
# LOCALIZATION NOTE (noEventListenersText): The text to display in the events tab
# when there are no events.
noEventListenersText=No event listeners to display