Skip to content

Commit

Permalink
Perform crypto store operations directly after transaction
Browse files Browse the repository at this point in the history
At least on Safari but perhaps other browsers as well, you must perform
IndexedDB operations in the same JS task as you start the transaction. As a
concrete example, you cannot open the transaction and await some promise before
actually using it.

This fixes the crypto store to meet this requirement.

Fixes element-hq/element-web#12207
  • Loading branch information
jryans committed Feb 27, 2020
1 parent a9fa048 commit 6bde52e
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 111 deletions.
3 changes: 3 additions & 0 deletions src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,9 @@ MatrixClient.prototype.initCrypto = async function() {
throw new Error(`Cannot enable encryption: no cryptoStore provided`);
}

logger.log("Crypto: Starting up crypto store...");
await this._cryptoStore.startup();

// initialise the list of encrypted rooms (whether or not crypto is enabled)
logger.log("Crypto: initialising roomlist...");
await this._roomList.init();
Expand Down
Loading

0 comments on commit 6bde52e

Please sign in to comment.