summaryrefslogtreecommitdiffstats
path: root/devtools
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-04-28 16:19:14 +0200
committerGitHub <noreply@github.com>2018-04-28 16:19:14 +0200
commitbddefd4211ea893df4a5a86d40d4a16b608f42fc (patch)
tree288b4be119020fbcea5d49ebda4efee038cd4ed0 /devtools
parentadb23ed9481102c80d9bd63f59d4011c64ed9a39 (diff)
parent8f65db7541d1a34b5696d888431d9b5189f4fe65 (diff)
downloadUXP-bddefd4211ea893df4a5a86d40d4a16b608f42fc.tar
UXP-bddefd4211ea893df4a5a86d40d4a16b608f42fc.tar.gz
UXP-bddefd4211ea893df4a5a86d40d4a16b608f42fc.tar.lz
UXP-bddefd4211ea893df4a5a86d40d4a16b608f42fc.tar.xz
UXP-bddefd4211ea893df4a5a86d40d4a16b608f42fc.zip
Merge pull request #280 from janekptacijarabaci/devtools_storage_style-clean-up_1
[DevTools] Storage - style clean up - a check of the variable to see if it exists
Diffstat (limited to 'devtools')
-rw-r--r--devtools/client/storage/ui.js42
1 files changed, 24 insertions, 18 deletions
diff --git a/devtools/client/storage/ui.js b/devtools/client/storage/ui.js
index 7745c8da9..5bd29d297 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,13 @@ 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;