summaryrefslogtreecommitdiff
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
commit064aafa652bcedb5821caffb61cf1d503dfc97bc (patch)
tree288b4be119020fbcea5d49ebda4efee038cd4ed0 /devtools
parent7e4df220c996464931c2b48a380c4a0092f50a0b (diff)
parent9bfc4f358cf8575078f049a3b70bb7fcd48b09f7 (diff)
downloaduxp-064aafa652bcedb5821caffb61cf1d503dfc97bc.tar.gz
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 7745c8da96..5bd29d297b 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;