fix(e2ee) handle Olm initialization error

If the WASM code could not be loaded, fail to initialize if and remove it from
globals so the E2EE option becomes unavailable, since it will be non-functional.
This commit is contained in:
Saúl Ibarra Corretgé 2020-10-01 13:37:16 +02:00 committed by Saúl Ibarra Corretgé
parent 0c4d649459
commit 3d7ea52416
1 changed files with 4 additions and 1 deletions

5
app.js
View File

@ -20,7 +20,10 @@ import translation from './modules/translation/translation';
// Initialize Olm as early as possible.
if (window.Olm) {
window.Olm.init();
window.Olm.init().catch(e => {
console.error('Failed to initialize Olm, E2EE will be disabled', e);
delete window.Olm;
});
}
window.APP = {