зеркало из https://github.com/mozilla/gecko-dev.git
Bug 921630 - Show progress indicator while pretty printing; r=vporof
This commit is contained in:
Родитель
f20ed7fb67
Коммит
3a0235c7d7
|
@ -1143,7 +1143,7 @@ SourceScripts.prototype = {
|
||||||
if (item) {
|
if (item) {
|
||||||
DebuggerView.Sources.callMethod("checkItem", item.target, !isBlackBoxed);
|
DebuggerView.Sources.callMethod("checkItem", item.target, !isBlackBoxed);
|
||||||
}
|
}
|
||||||
DebuggerView.Sources.maybeShowBlackBoxMessage();
|
DebuggerView.maybeShowBlackBoxMessage();
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,7 +50,6 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||||
this._cmPopup = document.getElementById("sourceEditorContextMenu");
|
this._cmPopup = document.getElementById("sourceEditorContextMenu");
|
||||||
this._cbPanel = document.getElementById("conditional-breakpoint-panel");
|
this._cbPanel = document.getElementById("conditional-breakpoint-panel");
|
||||||
this._cbTextbox = document.getElementById("conditional-breakpoint-panel-textbox");
|
this._cbTextbox = document.getElementById("conditional-breakpoint-panel-textbox");
|
||||||
this._editorDeck = document.getElementById("editor-deck");
|
|
||||||
this._stopBlackBoxButton = document.getElementById("black-boxed-message-button");
|
this._stopBlackBoxButton = document.getElementById("black-boxed-message-button");
|
||||||
this._prettyPrintButton = document.getElementById("pretty-print");
|
this._prettyPrintButton = document.getElementById("pretty-print");
|
||||||
|
|
||||||
|
@ -401,9 +400,11 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { source } = this.selectedItem.attachment;
|
DebuggerView.showProgressBar();
|
||||||
let prettyPrinted = DebuggerController.SourceScripts.prettyPrint(source);
|
const { source } = this.selectedItem.attachment;
|
||||||
prettyPrinted.then(resetEditor, printError);
|
DebuggerController.SourceScripts.prettyPrint(source)
|
||||||
|
.then(resetEditor, printError)
|
||||||
|
.then(DebuggerView.showEditor);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -694,7 +695,7 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||||
let script = sourceItem.value.split(" -> ").pop();
|
let script = sourceItem.value.split(" -> ").pop();
|
||||||
document.title = L10N.getFormatStr("DebuggerWindowScriptTitle", script);
|
document.title = L10N.getFormatStr("DebuggerWindowScriptTitle", script);
|
||||||
|
|
||||||
this.maybeShowBlackBoxMessage();
|
DebuggerView.maybeShowBlackBoxMessage();
|
||||||
this._updatePrettyPrintButtonState();
|
this._updatePrettyPrintButtonState();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -711,16 +712,6 @@ SourcesView.prototype = Heritage.extend(WidgetMethods, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Show or hide the black box message vs. source editor depending on if the
|
|
||||||
* selected source is black boxed or not.
|
|
||||||
*/
|
|
||||||
maybeShowBlackBoxMessage: function() {
|
|
||||||
let sourceForm = this.selectedItem.attachment.source;
|
|
||||||
let sourceClient = DebuggerController.activeThread.source(sourceForm);
|
|
||||||
this._editorDeck.selectedIndex = sourceClient.isBlackBoxed ? 1 : 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The click listener for the sources container.
|
* The click listener for the sources container.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -114,6 +114,12 @@ let DebuggerView = {
|
||||||
this._instrumentsPane = document.getElementById("instruments-pane");
|
this._instrumentsPane = document.getElementById("instruments-pane");
|
||||||
this._instrumentsPaneToggleButton = document.getElementById("instruments-pane-toggle");
|
this._instrumentsPaneToggleButton = document.getElementById("instruments-pane-toggle");
|
||||||
|
|
||||||
|
this.showEditor = this.showEditor.bind(this);
|
||||||
|
this.showBlackBoxMessage = this.showBlackBoxMessage.bind(this);
|
||||||
|
this.showProgressBar = this.showProgressBar.bind(this);
|
||||||
|
this.maybeShowBlackBoxMessage = this.maybeShowBlackBoxMessage.bind(this);
|
||||||
|
this._editorDeck = document.getElementById("editor-deck");
|
||||||
|
|
||||||
this._onTabSelect = this._onInstrumentsPaneTabSelect.bind(this);
|
this._onTabSelect = this._onInstrumentsPaneTabSelect.bind(this);
|
||||||
this._instrumentsPane.tabpanels.addEventListener("select", this._onTabSelect);
|
this._instrumentsPane.tabpanels.addEventListener("select", this._onTabSelect);
|
||||||
|
|
||||||
|
@ -221,6 +227,40 @@ let DebuggerView = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the source editor.
|
||||||
|
*/
|
||||||
|
showEditor: function() {
|
||||||
|
this._editorDeck.selectedIndex = 0;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the black box message.
|
||||||
|
*/
|
||||||
|
showBlackBoxMessage: function() {
|
||||||
|
this._editorDeck.selectedIndex = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the progress bar.
|
||||||
|
*/
|
||||||
|
showProgressBar: function() {
|
||||||
|
this._editorDeck.selectedIndex = 2;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show or hide the black box message vs. source editor depending on if the
|
||||||
|
* selected source is black boxed or not.
|
||||||
|
*/
|
||||||
|
maybeShowBlackBoxMessage: function() {
|
||||||
|
let { source } = DebuggerView.Sources.selectedItem.attachment;
|
||||||
|
if (gThreadClient.source(source).isBlackBoxed) {
|
||||||
|
this.showBlackBoxMessage();
|
||||||
|
} else {
|
||||||
|
this.showEditor();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the currently displayed text contents in the source editor.
|
* Sets the currently displayed text contents in the source editor.
|
||||||
* This resets the mode and undo stack.
|
* This resets the mode and undo stack.
|
||||||
|
@ -522,6 +562,7 @@ let DebuggerView = {
|
||||||
_instrumentsPaneToggleButton: null,
|
_instrumentsPaneToggleButton: null,
|
||||||
_collapsePaneString: "",
|
_collapsePaneString: "",
|
||||||
_expandPaneString: "",
|
_expandPaneString: "",
|
||||||
|
_editorDeck: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -345,6 +345,10 @@
|
||||||
image="chrome://browser/skin/devtools/blackBoxMessageEye.png"
|
image="chrome://browser/skin/devtools/blackBoxMessageEye.png"
|
||||||
command="unBlackBoxCommand"/>
|
command="unBlackBoxCommand"/>
|
||||||
</vbox>
|
</vbox>
|
||||||
|
<vbox id="source-progress-container" align="center" pack="center">
|
||||||
|
<progressmeter id="source-progress"
|
||||||
|
mode="undetermined"/>
|
||||||
|
</vbox>
|
||||||
</deck>
|
</deck>
|
||||||
<splitter class="devtools-side-splitter"/>
|
<splitter class="devtools-side-splitter"/>
|
||||||
<tabbox id="instruments-pane"
|
<tabbox id="instruments-pane"
|
||||||
|
|
|
@ -24,9 +24,11 @@ function test() {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const finished = waitForSourceShown(gPanel, "code_ugly.js");
|
const finished = waitForSourceShown(gPanel, "code_ugly.js");
|
||||||
clickPrettyPrintButton();
|
clickPrettyPrintButton();
|
||||||
|
testProgressBarShown();
|
||||||
return finished;
|
return finished;
|
||||||
})
|
})
|
||||||
.then(testSourceIsPretty)
|
.then(testSourceIsPretty)
|
||||||
|
.then(testEditorShown)
|
||||||
.then(testSourceIsStillPretty)
|
.then(testSourceIsStillPretty)
|
||||||
.then(() => closeDebuggerAndFinish(gPanel))
|
.then(() => closeDebuggerAndFinish(gPanel))
|
||||||
.then(null, aError => {
|
.then(null, aError => {
|
||||||
|
@ -46,11 +48,21 @@ function clickPrettyPrintButton() {
|
||||||
gDebugger);
|
gDebugger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testProgressBarShown() {
|
||||||
|
const deck = gDebugger.document.getElementById("editor-deck");
|
||||||
|
is(deck.selectedIndex, 2, "The progress bar should be shown");
|
||||||
|
}
|
||||||
|
|
||||||
function testSourceIsPretty() {
|
function testSourceIsPretty() {
|
||||||
ok(gEditor.getText().contains("\n "),
|
ok(gEditor.getText().contains("\n "),
|
||||||
"The source should be pretty printed.")
|
"The source should be pretty printed.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testEditorShown() {
|
||||||
|
const deck = gDebugger.document.getElementById("editor-deck");
|
||||||
|
is(deck.selectedIndex, 0, "The editor should be shown");
|
||||||
|
}
|
||||||
|
|
||||||
function testSourceIsStillPretty() {
|
function testSourceIsStillPretty() {
|
||||||
const deferred = promise.defer();
|
const deferred = promise.defer();
|
||||||
|
|
||||||
|
|
|
@ -66,9 +66,10 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Black box message */
|
/* Black box message and source progress meter */
|
||||||
|
|
||||||
#black-boxed-message {
|
#black-boxed-message,
|
||||||
|
#source-progress-container {
|
||||||
background: url(background-noise-toolbar.png) rgb(61,69,76);
|
background: url(background-noise-toolbar.png) rgb(61,69,76);
|
||||||
/* Prevent the container deck from aquiring the height from this message. */
|
/* Prevent the container deck from aquiring the height from this message. */
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
|
@ -76,6 +77,11 @@
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#source-progress {
|
||||||
|
min-height: 2em;
|
||||||
|
min-width: 40em;
|
||||||
|
}
|
||||||
|
|
||||||
#black-boxed-message-label,
|
#black-boxed-message-label,
|
||||||
#black-boxed-message-button {
|
#black-boxed-message-button {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -64,9 +64,10 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Black box message */
|
/* Black box message and source progress meter */
|
||||||
|
|
||||||
#black-boxed-message {
|
#black-boxed-message,
|
||||||
|
#source-progress-container {
|
||||||
background: url(background-noise-toolbar.png) rgb(61,69,76);
|
background: url(background-noise-toolbar.png) rgb(61,69,76);
|
||||||
/* Prevent the container deck from aquiring the height from this message. */
|
/* Prevent the container deck from aquiring the height from this message. */
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
|
@ -74,6 +75,11 @@
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#source-progress {
|
||||||
|
min-height: 2em;
|
||||||
|
min-width: 40em;
|
||||||
|
}
|
||||||
|
|
||||||
#black-boxed-message-label,
|
#black-boxed-message-label,
|
||||||
#black-boxed-message-button {
|
#black-boxed-message-button {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
|
@ -64,9 +64,10 @@
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Black box message */
|
/* Black box message and source progress meter */
|
||||||
|
|
||||||
#black-boxed-message {
|
#black-boxed-message,
|
||||||
|
#source-progress-container {
|
||||||
background: url(background-noise-toolbar.png) rgb(61,69,76);
|
background: url(background-noise-toolbar.png) rgb(61,69,76);
|
||||||
/* Prevent the container deck from aquiring the height from this message. */
|
/* Prevent the container deck from aquiring the height from this message. */
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
|
@ -74,6 +75,11 @@
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#source-progress {
|
||||||
|
min-height: 2em;
|
||||||
|
min-width: 40em;
|
||||||
|
}
|
||||||
|
|
||||||
#black-boxed-message-label,
|
#black-boxed-message-label,
|
||||||
#black-boxed-message-button {
|
#black-boxed-message-button {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче