diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-04-28 17:57:18 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-04-28 17:57:18 +0200 |
commit | f69729b0aa1d8cd1964994919ab30ce7c7d9f410 (patch) | |
tree | d877e04983b628a9e45271615fc9486712e4a404 /devtools | |
parent | b53db93006f732fb2e140137e4713dedca1700d9 (diff) | |
parent | de057c7a5635e65f45ce47162d226b1ddf24e8aa (diff) | |
download | UXP-f69729b0aa1d8cd1964994919ab30ce7c7d9f410.tar UXP-f69729b0aa1d8cd1964994919ab30ce7c7d9f410.tar.gz UXP-f69729b0aa1d8cd1964994919ab30ce7c7d9f410.tar.lz UXP-f69729b0aa1d8cd1964994919ab30ce7c7d9f410.tar.xz UXP-f69729b0aa1d8cd1964994919ab30ce7c7d9f410.zip |
Merge branch 'master' of https://github.com/MoonchildProductions/UXP
Diffstat (limited to 'devtools')
-rw-r--r-- | devtools/client/shared/widgets/TableWidget.js | 9 | ||||
-rw-r--r-- | devtools/client/storage/ui.js | 42 |
2 files changed, 32 insertions, 19 deletions
diff --git a/devtools/client/shared/widgets/TableWidget.js b/devtools/client/shared/widgets/TableWidget.js index a0f0dfc11..57d2914d5 100644 --- a/devtools/client/shared/widgets/TableWidget.js +++ b/devtools/client/shared/widgets/TableWidget.js @@ -463,7 +463,14 @@ TableWidget.prototype = { return; } - let selectedCell = this.tbody.querySelector(".theme-selected"); + // We need to get the first *visible* selected cell. Some columns are hidden + // e.g. because they contain a unique compound key for cookies that is never + // displayed in the UI. To do this we get all selected cells and filter out + // any that are hidden. + let selectedCells = [...this.tbody.querySelectorAll(".theme-selected")] + .filter(cell => cell.clientWidth > 0); + // Select the first visible selected cell. + let selectedCell = selectedCells[0]; if (!selectedCell) { return; } 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; |