summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-19 13:41:18 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-10-19 13:41:18 -0400
commit96e4bf1735cef3881e5284ff624ed2114709af82 (patch)
tree004d671fad712abf699b91789e9af3dc1eae0119
parent610c2b9cca953e102aa31449d604d24d2840cce3 (diff)
Use native IndexedDB APIs for findTagForTitle
-rw-r--r--ext/bg/js/database.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 95466e73..9f477b24 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -182,7 +182,12 @@ class Database {
this.validate();
let result = null;
- await this.db.tagMeta.where('name').equals(name).each(row => {
+ const db = this.db.backendDB();
+ const dbTransaction = db.transaction(['tagMeta'], 'readonly');
+ const dbTerms = dbTransaction.objectStore('tagMeta');
+ const dbIndex = dbTerms.index('name');
+ const only = IDBKeyRange.only(name);
+ await Database.getAll(dbIndex, only, null, row => {
if (title === row.dictionary) {
result = row;
}