Ignore Indexed DB errors (#129)

This commit is contained in:
Maxim Baz
2019-04-19 17:32:03 +02:00
committed by GitHub
parent d1b997e0f8
commit 2e0e7f5a39

View File

@@ -194,13 +194,17 @@ async function saveRecent(settings, login, remove = false) {
}
// save to usage log
const DB_VERSION = 1;
const db = await idb.openDB("browserpass", DB_VERSION, {
upgrade(db) {
db.createObjectStore("log", { keyPath: "time" });
}
});
await db.add("log", { time: Date.now(), host: settings.host, login: login.login });
try {
const DB_VERSION = 1;
const db = await idb.openDB("browserpass", DB_VERSION, {
upgrade(db) {
db.createObjectStore("log", { keyPath: "time" });
}
});
await db.add("log", { time: Date.now(), host: settings.host, login: login.login });
} catch {
// ignore if we cannot write to Indexed DB (e.g. it's readonly in incognito mode)
}
}
/**