Merge pull request #2836 from jryans/storage-firefox-errors

Catch errors when checking IndexedDB
pull/21833/head
J. Ryan Stinnett 2019-03-27 15:55:47 +00:00 committed by GitHub
commit b4995f3698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 8 deletions

View File

@ -61,10 +61,16 @@ export async function checkConsistency() {
}
if (indexedDB && localStorage) {
const dataInSyncStore = await Matrix.IndexedDBStore.exists(
indexedDB, SYNC_STORE_NAME,
);
log(`Sync store contains data? ${dataInSyncStore}`);
try {
const dataInSyncStore = await Matrix.IndexedDBStore.exists(
indexedDB, SYNC_STORE_NAME,
);
log(`Sync store contains data? ${dataInSyncStore}`);
} catch (e) {
healthy = false;
error("Sync store inaccessible", e);
track("Sync store inaccessible");
}
} else {
healthy = false;
error("Sync store cannot be used on this browser");
@ -72,10 +78,16 @@ export async function checkConsistency() {
}
if (indexedDB) {
dataInCryptoStore = await Matrix.IndexedDBCryptoStore.exists(
indexedDB, CRYPTO_STORE_NAME,
);
log(`Crypto store contains data? ${dataInCryptoStore}`);
try {
dataInCryptoStore = await Matrix.IndexedDBCryptoStore.exists(
indexedDB, CRYPTO_STORE_NAME,
);
log(`Crypto store contains data? ${dataInCryptoStore}`);
} catch (e) {
healthy = false;
error("Crypto store inaccessible", e);
track("Crypto store inaccessible");
}
} else {
healthy = false;
error("Crypto store cannot be used on this browser");