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

Add a bunch of logging

to try & diagnose https://github.com/vector-im/riot-web/issues/7769
This commit is contained in:
David Baker
2019-04-02 12:30:24 +01:00
parent cd3c6809a9
commit a4268d288e
4 changed files with 11 additions and 0 deletions

View File

@@ -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();

View File

@@ -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();
};

View File

@@ -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);
}
};

View File

@@ -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);
};