Bug 1131572 - DetailsView.setAvailableViews should be a task, r=jsantell
--- a/browser/devtools/performance/views/details.js
+++ b/browser/devtools/performance/views/details.js
@@ -31,17 +31,17 @@ let DetailsView = {
this._onViewToggle = this._onViewToggle.bind(this);
this.setAvailableViews = this.setAvailableViews.bind(this);
for (let button of $$("toolbarbutton[data-view]", this.toolbar)) {
button.addEventListener("command", this._onViewToggle);
}
yield this.selectView(DEFAULT_DETAILS_SUBVIEW);
- this.setAvailableViews();
+ yield this.setAvailableViews();
PerformanceController.on(EVENTS.PREF_CHANGED, this.setAvailableViews);
}),
/**
* Unbinds events, destroys subviews.
*/
destroy: Task.async(function *() {
@@ -56,31 +56,31 @@ let DetailsView = {
PerformanceController.off(EVENTS.PREF_CHANGED, this.setAvailableViews);
}),
/**
* Sets the possible views based off of prefs by hiding/showing the
* buttons that select them and going to default view if currently selected.
* Called when a preference changes in `devtools.performance.ui.`.
*/
- setAvailableViews: function () {
+ setAvailableViews: Task.async(function* () {
for (let [name, { view, pref }] of Iterator(this.components)) {
if (!pref) {
continue;
}
let value = PerformanceController.getPref(pref);
$(`toolbarbutton[data-view=${name}]`).hidden = !value;
// If the view is currently selected and not enabled, go back to the
// default view.
if (!value && this.isViewSelected(view)) {
- this.selectView(DEFAULT_DETAILS_SUBVIEW);
+ yield this.selectView(DEFAULT_DETAILS_SUBVIEW);
}
}
- },
+ }),
/**
* Select one of the DetailView's subviews to be rendered,
* hiding the others.
*
* @param String viewName
* Name of the view to be shown.
*/