summaryrefslogtreecommitdiff
path: root/ext/bg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg/js')
-rw-r--r--ext/bg/js/database.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/ext/bg/js/database.js b/ext/bg/js/database.js
index 9810328f..b2a2007f 100644
--- a/ext/bg/js/database.js
+++ b/ext/bg/js/database.js
@@ -81,8 +81,9 @@ class Database {
this.db = {
backendDB: () => idb,
- close: () => {}, // Not implemented
- delete: () => {} // Not implemented
+ close: () => idb.close(),
+ get name() { return idb.name; },
+ set name(v) {}
};
}
@@ -90,7 +91,7 @@ class Database {
this.validate();
this.db.close();
- await this.db.delete();
+ await Database.deleteDatabase(this.db.name);
this.db = null;
await this.prepare();
@@ -815,4 +816,12 @@ class Database {
}
}
}
+
+ static deleteDatabase(dbName) {
+ return new Promise((resolve, reject) => {
+ const request = indexedDB.deleteDatabase(dbName);
+ request.onerror = (e) => reject(e);
+ request.onsuccess = () => resolve();
+ });
+ }
}