summaryrefslogtreecommitdiffstats
path: root/devtools/client
diff options
context:
space:
mode:
authorjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-28 12:27:35 +0200
committerjanekptacijarabaci <janekptacijarabaci@seznam.cz>2018-04-28 12:27:35 +0200
commit775b1b825fcf80bc02d5be09d7169770f5d9b32c (patch)
treeb62ecee2090d337ae9b4e8e214c4b257a8ff207e /devtools/client
parentc75dae3ed21bfa5a8ae46cd83d18329af5bea05a (diff)
downloadUXP-775b1b825fcf80bc02d5be09d7169770f5d9b32c.tar
UXP-775b1b825fcf80bc02d5be09d7169770f5d9b32c.tar.gz
UXP-775b1b825fcf80bc02d5be09d7169770f5d9b32c.tar.lz
UXP-775b1b825fcf80bc02d5be09d7169770f5d9b32c.tar.xz
UXP-775b1b825fcf80bc02d5be09d7169770f5d9b32c.zip
[DevTools] Storage - style clean up - a check of the variable to see if it exists
Issue #102
Diffstat (limited to 'devtools/client')
-rw-r--r--devtools/client/storage/ui.js41
1 files changed, 23 insertions, 18 deletions
diff --git a/devtools/client/storage/ui.js b/devtools/client/storage/ui.js
index 7745c8da9..47f6e7074 100644
--- a/devtools/client/storage/ui.js
+++ b/devtools/client/storage/ui.js
@@ -482,24 +482,27 @@ StorageUI.prototype = {
* @param {object} See onUpdate docs
*/
handleChangedItems: function (changed) {
- if (this.tree.selectedItem) {
- let [type, host, db, objectStore] = this.tree.selectedItem;
- if (!changed[type] || !changed[type][host] ||
- changed[type][host].length == 0) {
- return;
- }
- try {
- let toUpdate = [];
- for (let name of changed[type][host]) {
- let names = JSON.parse(name);
- if (names[0] == db && names[1] == objectStore && names[2]) {
- toUpdate.push(name);
- }
+ let selectedItem = this.tree.selectedItem;
+ if (!selectedItem) {
+ return;
+ }
+
+ let [type, host, db, objectStore] = selectedItem;
+ if (!changed[type] || !changed[type][host] ||
+ changed[type][host].length == 0) {
+ return;
+ }
+ try {
+ let toUpdate = [];
+ for (let name of changed[type][host]) {
+ let names = JSON.parse(name);
+ if (names[0] == db && names[1] == objectStore && names[2]) {
+ toUpdate.push(name);
}
- this.fetchStorageObjects(type, host, toUpdate, REASON.UPDATE);
- } catch (ex) {
- this.fetchStorageObjects(type, host, changed[type][host], REASON.UPDATE);
}
+ this.fetchStorageObjects(type, host, toUpdate, REASON.UPDATE);
+ } catch (ex) {
+ this.fetchStorageObjects(type, host, changed[type][host], REASON.UPDATE);
}
},
@@ -830,6 +833,7 @@ StorageUI.prototype = {
if (!item) {
return;
}
+
this.table.clear();
this.hideSidebar();
this.searchBox.value = "";
@@ -1136,11 +1140,12 @@ StorageUI.prototype = {
* Handles adding an item from the storage
*/
onAddItem: function () {
- if (!this.tree.selectedItem) {
+ let selectedItem = this.tree.selectedItem;
+ if (!selectedItem) {
return;
}
let front = this.getCurrentFront();
- let [, host] = this.tree.selectedItem;
+ let [, host] = selectedItem;
// Prepare to scroll into view.
this.table.scrollIntoViewOnUpdate = true;