1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

Avoid throwing an unhandled error when the indexeddb is deleted

Hopefully this will fix the vector-web test failures (the
OutgoingRoomRequestManager throws an exception because the indexeddb is being
deleted just as it's getting started).
This commit is contained in:
Richard van der Hoff
2017-06-20 15:36:05 +01:00
parent c96f7e5a13
commit cd19578d80
2 changed files with 9 additions and 0 deletions

View File

@@ -96,6 +96,7 @@ export default class OutgoingRoomKeyRequestManager {
* Called when the client is stopped. Stops any running background processes.
*/
stop() {
console.log('stopping OutgoingRoomKeyRequestManager');
// stop the timer on the next run
this._clientRunning = false;
}
@@ -229,6 +230,12 @@ export default class OutgoingRoomKeyRequestManager {
this._sendOutgoingRoomKeyRequests().finally(() => {
this._sendOutgoingRoomKeyRequestsRunning = false;
}).catch((e) => {
// this should only happen if there is an indexeddb error,
// in which case we're a bit stuffed anyway.
console.warn(
`error in OutgoingRoomKeyRequestManager: ${e}`,
);
}).done();
};

View File

@@ -91,9 +91,11 @@ export default class IndexedDBCryptoStore {
// attempts to delete the database will block (and subsequent
// attempts to re-create it will also block).
db.onversionchange = (ev) => {
console.log(`versionchange for indexeddb ${this._dbName}: closing`);
db.close();
};
console.log(`connected to indexeddb ${this._dbName}`);
resolve(db);
};
});