From 3e864c44c379ae3c5f5c046ca2c2cd9155b6b7e0 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 9 Nov 2019 20:49:44 -0500 Subject: Fixes for Edge --- ext/bg/js/database.js | 8 +++++--- ext/bg/js/settings-dictionaries.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'ext/bg/js') diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js index 3476b715..8317a91a 100644 --- a/ext/bg/js/database.js +++ b/ext/bg/js/database.js @@ -266,15 +266,17 @@ class Database { ]); } - const totalPromise = getTotal ? Database.getCounts(targets, null) : null; + // Query is required for Edge, otherwise index.count throws an exception. + const query1 = IDBKeyRange.lowerBound('', false); + const totalPromise = getTotal ? Database.getCounts(targets, query1) : null; const counts = []; const countPromises = []; for (let i = 0; i < dictionaryNames.length; ++i) { counts.push(null); const index = i; - const only = IDBKeyRange.only(dictionaryNames[i]); - const countPromise = Database.getCounts(targets, only).then(v => counts[index] = v); + const query2 = IDBKeyRange.only(dictionaryNames[i]); + const countPromise = Database.getCounts(targets, query2).then(v => counts[index] = v); countPromises.push(countPromise); } await Promise.all(countPromises); diff --git a/ext/bg/js/settings-dictionaries.js b/ext/bg/js/settings-dictionaries.js index 5a722c6f..720b7d3d 100644 --- a/ext/bg/js/settings-dictionaries.js +++ b/ext/bg/js/settings-dictionaries.js @@ -53,7 +53,7 @@ class SettingsDictionaryListUI { const titles = this.dictionaryEntries.map(e => e.dictionaryInfo.title); const removeKeys = Object.keys(this.optionsDictionaries).filter(key => titles.indexOf(key) < 0); if (removeKeys.length >= 0) { - for (const key of removeKeys) { + for (const key of toIterable(removeKeys)) { delete this.optionsDictionaries[key]; } changed = true; -- cgit v1.2.3