From a4268d288e4f2652794a367e15c57fe858c71da5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 2 Apr 2019 12:30:24 +0100 Subject: [PATCH] Add a bunch of logging to try & diagnose https://github.com/vector-im/riot-web/issues/7769 --- src/client.js | 2 ++ src/crypto/index.js | 6 ++++++ src/crypto/store/indexeddb-crypto-store-backend.js | 1 + src/crypto/store/indexeddb-crypto-store.js | 2 ++ 4 files changed, 11 insertions(+) diff --git a/src/client.js b/src/client.js index 79a1e68fa..ea6e32e86 100644 --- a/src/client.js +++ b/src/client.js @@ -491,6 +491,7 @@ MatrixClient.prototype.initCrypto = async function() { } // initialise the list of encrypted rooms (whether or not crypto is enabled) + console.log("Crypto: initialising roomlist..."); await this._roomList.init(); const userId = this.getUserId(); @@ -525,6 +526,7 @@ MatrixClient.prototype.initCrypto = async function() { "crypto.warning", ]); + console.log("Crypto: initialising crypto object..."); await crypto.init(); this.olmVersion = Crypto.getOlmVersion(); diff --git a/src/crypto/index.js b/src/crypto/index.js index b1ae7f3d3..889e66af2 100644 --- a/src/crypto/index.js +++ b/src/crypto/index.js @@ -197,8 +197,11 @@ utils.inherits(Crypto, EventEmitter); * Returns a promise which resolves once the crypto module is ready for use. */ Crypto.prototype.init = async function() { + console.log("Crypto: initialising Olm..."); await global.Olm.init(); + console.log("Crypto: initialising Olm device..."); await this._olmDevice.init(); + console.log("Crypto: loading device list..."); await this._deviceList.load(); // build our device keys: these will later be uploaded @@ -207,6 +210,7 @@ Crypto.prototype.init = async function() { this._deviceKeys["curve25519:" + this._deviceId] = this._olmDevice.deviceCurve25519Key; + console.log("Crypto: fetching own devices..."); let myDevices = this._deviceList.getRawStoredDevicesForUser( this._userId, ); @@ -217,6 +221,7 @@ Crypto.prototype.init = async function() { if (!myDevices[this._deviceId]) { // add our own deviceinfo to the cryptoStore + console.log("Crypto: adding this device to the store..."); const deviceInfo = { keys: this._deviceKeys, algorithms: this._supportedAlgorithms, @@ -231,6 +236,7 @@ Crypto.prototype.init = async function() { this._deviceList.saveIfDirty(); } + console.log("Crypto: checking for key backup..."); this._checkAndStartKeyBackup(); }; diff --git a/src/crypto/store/indexeddb-crypto-store-backend.js b/src/crypto/store/indexeddb-crypto-store-backend.js index 1689c5679..6853cea80 100644 --- a/src/crypto/store/indexeddb-crypto-store-backend.js +++ b/src/crypto/store/indexeddb-crypto-store-backend.js @@ -694,6 +694,7 @@ function promiseifyTxn(txn) { if (txn._mx_abortexception !== undefined) { reject(txn._mx_abortexception); } else { + console.log("Error performing indexeddb txn", event); reject(event.target.error); } }; diff --git a/src/crypto/store/indexeddb-crypto-store.js b/src/crypto/store/indexeddb-crypto-store.js index 4c28d9cfe..4b0cd7f49 100644 --- a/src/crypto/store/indexeddb-crypto-store.js +++ b/src/crypto/store/indexeddb-crypto-store.js @@ -90,6 +90,7 @@ export default class IndexedDBCryptoStore { }; req.onerror = (ev) => { + console.log("Error connecting to indexeddb", ev); reject(ev.target.error); }; @@ -159,6 +160,7 @@ export default class IndexedDBCryptoStore { }; req.onerror = (ev) => { + console.log("Error deleting data from indexeddb", ev); reject(ev.target.error); };