Bug 1118806 - Handle uncaught promise rejections in the storage inspector;r=pbrosset

This commit is contained in:
Eddy Bruël 2015-01-13 10:05:20 +01:00
Родитель f428537ae6
Коммит 3004465c29
2 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -81,7 +81,7 @@ this.StorageUI = function StorageUI(front, target, panelWin) {
this.front.listStores().then(storageTypes => {
this.populateStorageTree(storageTypes);
});
}).then(null, Cu.reportError);
this.onUpdate = this.onUpdate.bind(this);
this.front.on("stores-update", this.onUpdate);
@ -275,7 +275,7 @@ StorageUI.prototype = {
}
this.populateTable(data, reason);
this.emit("store-objects-updated");
});
}, Cu.reportError);
},
/**

Просмотреть файл

@ -183,7 +183,14 @@ HighlightersOverlay.prototype = {
_hideCurrent: function() {
if (this.highlighterShown) {
this._getHighlighter(this.highlighterShown).then(highlighter => {
highlighter.hide();
// For some reason, the call to highlighter.hide doesn't always return a
// promise. This causes some tests to fail when trying to install a
// rejection handler on the result of the call. To avoid this, check
// whether the result is truthy before installing the handler.
let promise = highlighter.hide();
if (promise) {
promise.then(null, Cu.reportError);
}
this.highlighterShown = null;
});
}