Bug 1003860 - Various tweaks to the storage inspector. r=mratcliffe
☠☠ backed out by c0a8a74faf03 ☠ ☠
authorAlexandre Poirot <poirot.alex@gmail.com>
Wed, 20 Jan 2016 14:09:25 -0800
changeset 303138 8737105685f1b5feeb592791aa4ea498f491da96
parent 303137 8d93e84979b502359d728845813f13224378a201
child 303139 ca345be438249e308318379eca7eec7d6013ae93
push id8978
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 14:05:32 +0000
treeherdermozilla-aurora@b9a803752a2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmratcliffe
bugs1003860
milestone46.0a1
Bug 1003860 - Various tweaks to the storage inspector. r=mratcliffe
devtools/client/storage/panel.js
devtools/client/storage/test/head.js
devtools/client/storage/ui.js
--- a/devtools/client/storage/panel.js
+++ b/devtools/client/storage/panel.js
@@ -52,17 +52,20 @@ StoragePanel.prototype = {
       this.target.on("close", this.destroy);
       this._front = new StorageFront(this.target.client, this.target.form);
 
       this.UI = new StorageUI(this._front, this._target, this._panelWin);
       this.isReady = true;
       this.emit("ready");
 
       return this;
-    }).catch(this.destroy);
+    }).catch(e => {
+      console.log("error while opening storage panel", e);
+      this.destroy();
+    });
   },
 
   /**
    * Destroy the storage inspector.
    */
   destroy: function() {
     if (!this._destroyed) {
       this.UI.destroy();
--- a/devtools/client/storage/test/head.js
+++ b/devtools/client/storage/test/head.js
@@ -482,32 +482,34 @@ function matchVariablesViewProperty(aPro
  */
 function* selectTreeItem(ids) {
   // Expand tree as some/all items could be collapsed leading to click on an
   // incorrect tree item
   gUI.tree.expandAll();
 
   let selector = "[data-id='" + JSON.stringify(ids) + "'] > .tree-widget-item";
   let target = gPanelWindow.document.querySelector(selector);
+  ok(target, "tree item found with ids " + JSON.stringify(ids));
 
   let updated = gUI.once("store-objects-updated");
 
   yield click(target);
   yield updated;
 }
 
 /**
  * Click selects a row in the table.
  *
  * @param {String} id
  *        The id of the row in the table widget
  */
 function* selectTableItem(id) {
   let selector = ".table-widget-cell[data-id='" + id + "']";
   let target = gPanelWindow.document.querySelector(selector);
+  ok(target, "table item found with ids " + id);
 
   yield click(target);
   yield gUI.once("sidebar-updated");
 }
 
 /**
  * Wait for eventName on target.
  * @param {Object} target An observable object that either supports on/off or
--- a/devtools/client/storage/ui.js
+++ b/devtools/client/storage/ui.js
@@ -336,21 +336,26 @@ StorageUI.prototype = {
    *
    * @param {object} storageTypes
    *        List of storages and their corresponding hosts returned by the
    *        StorageFront.listStores call.
    */
   populateStorageTree: function(storageTypes) {
     this.storageTypes = {};
     for (let type in storageTypes) {
+      // Ignore `from` field, which is just a protocol.js implementation artifact
       if (type === "from") {
         continue;
       }
-
-      let typeLabel = L10N.getStr("tree.labels." + type);
+      let typeLabel = type;
+      try {
+        typeLabel = L10N.getStr("tree.labels." + type);
+      } catch(e) {
+        console.error("Unable to localize tree label type:" + type);
+      }
       this.tree.add([{id: type, label: typeLabel, type: "store"}]);
       if (!storageTypes[type].hosts) {
         continue;
       }
       this.storageTypes[type] = storageTypes[type];
       for (let host in storageTypes[type].hosts) {
         this.tree.add([type, {id: host, type: "url"}]);
         for (let name of storageTypes[type].hosts[host]) {
@@ -563,17 +568,22 @@ StorageUI.prototype = {
    */
   resetColumns: function(data, type) {
     let columns = {};
     let uniqueKey = null;
     for (let key in data) {
       if (!uniqueKey) {
         this.table.uniqueId = uniqueKey = key;
       }
-      columns[key] = L10N.getStr("table.headers." + type + "." + key);
+      columns[key] = key;
+      try {
+        columns[key] = L10N.getStr("table.headers." + type + "." + key);
+      } catch(e) {
+        console.error("Unable to localize table header type:" + type + " key:" + key);
+      }
     }
     this.table.setColumns(columns, null, HIDDEN_COLUMNS);
     this.shouldResetColumns = false;
     this.hideSidebar();
   },
 
   /**
    * Populates or updates the rows in the storage table.