Bug 1166921 - Support storage inspector stores-cleared event. r=mratcliffe

This commit is contained in:
Tim Nguyen 2015-08-17 15:29:58 -07:00
Родитель 4cf5098ba9
Коммит 95170b2aa1
1 изменённых файлов: 18 добавлений и 0 удалений

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

@ -82,8 +82,11 @@ 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);
this.onCleared = this.onCleared.bind(this);
this.front.on("stores-cleared", this.onCleared);
this.handleKeypress = this.handleKeypress.bind(this);
this._panelDoc.addEventListener("keypress", this.handleKeypress);
@ -101,6 +104,7 @@ StorageUI.prototype = {
destroy: function() {
this.front.off("stores-update", this.onUpdate);
this.front.off("stores-cleared", this.onCleared);
this._panelDoc.removeEventListener("keypress", this.handleKeypress);
this._telemetry.toolClosed("storage");
},
@ -135,6 +139,20 @@ StorageUI.prototype = {
}
},
/**
* Event handler for "stores-cleared" event coming from the storage actor.
*
* @param {object} argument0
* An object containing which storage types were cleared
*/
onCleared: function(response) {
let [type, host, db, objectStore] = this.tree.selectedItem;
if (response.hasOwnProperty(type) && response[type].indexOf(host) > -1) {
this.table.clear();
this.hideSidebar();
}
},
/**
* Event handler for "stores-update" event coming from the storage actor.
*