Catch errors when checking IndexedDB
In Firefox private browsing, we may get errors when checking storage consistency. We don't want that to block general Riot operation, so catch those errors and log instead. Fixes https://github.com/vector-im/riot-web/issues/9300
This commit is contained in:
parent
1b8b3efece
commit
73b2484e08
1 changed files with 20 additions and 8 deletions
|
@ -61,10 +61,16 @@ export async function checkConsistency() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexedDB && localStorage) {
|
if (indexedDB && localStorage) {
|
||||||
const dataInSyncStore = await Matrix.IndexedDBStore.exists(
|
try {
|
||||||
indexedDB, SYNC_STORE_NAME,
|
const dataInSyncStore = await Matrix.IndexedDBStore.exists(
|
||||||
);
|
indexedDB, SYNC_STORE_NAME,
|
||||||
log(`Sync store contains data? ${dataInSyncStore}`);
|
);
|
||||||
|
log(`Sync store contains data? ${dataInSyncStore}`);
|
||||||
|
} catch (e) {
|
||||||
|
healthy = false;
|
||||||
|
error("Sync store inaccessible", e);
|
||||||
|
track("Sync store inaccessible");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
healthy = false;
|
healthy = false;
|
||||||
error("Sync store cannot be used on this browser");
|
error("Sync store cannot be used on this browser");
|
||||||
|
@ -72,10 +78,16 @@ export async function checkConsistency() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexedDB) {
|
if (indexedDB) {
|
||||||
dataInCryptoStore = await Matrix.IndexedDBCryptoStore.exists(
|
try {
|
||||||
indexedDB, CRYPTO_STORE_NAME,
|
dataInCryptoStore = await Matrix.IndexedDBCryptoStore.exists(
|
||||||
);
|
indexedDB, CRYPTO_STORE_NAME,
|
||||||
log(`Crypto store contains data? ${dataInCryptoStore}`);
|
);
|
||||||
|
log(`Crypto store contains data? ${dataInCryptoStore}`);
|
||||||
|
} catch (e) {
|
||||||
|
healthy = false;
|
||||||
|
error("Crypto store inaccessible", e);
|
||||||
|
track("Crypto store inaccessible");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
healthy = false;
|
healthy = false;
|
||||||
error("Crypto store cannot be used on this browser");
|
error("Crypto store cannot be used on this browser");
|
||||||
|
|
Loading…
Reference in a new issue