From 6dc7e7eff471b76de061fd26193061c036b7a0f3 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 26 Jun 2018 14:15:25 +0200 Subject: [PATCH] Disable WebWorkers by default --- www/common/application_config_internal.js | 7 +++++++ www/common/cryptpad-common.js | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/www/common/application_config_internal.js b/www/common/application_config_internal.js index ec97ac39c..e3ab72b91 100644 --- a/www/common/application_config_internal.js +++ b/www/common/application_config_internal.js @@ -119,5 +119,12 @@ define(function() { // You can use config.afterLogin to import these values in the users' drive. //config.disableProfile = true; + // Disable the use of webworkers and sharedworkers in CryptPad. + // Workers allow us to run the websockets connection and open the user drive in a separate thread. + // SharedWorkers allow us to load only one websocket and one user drive for all the browser tabs, + // making it much faster to open new tabs. + // Warning: This is an experimental feature. It will be enabled by default once we're sure it's stable. + config.disableWorkers = true; + return config; }); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 15ac1c703..589ec0292 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -906,7 +906,11 @@ define([ var msgEv = Util.mkEvent(); var postMsg, worker; - var noWorker = false; + var noWorker = AppConfig.disableWorkers || false; + if (localStorage.CryptPad_noWorkers) { + noWorker = localStorage.CryptPad_noWorkers === '1'; + console.error('WebWorker/SharedWorker state forced to ' + !noWorker); + } Nthen(function (waitFor2) { if (Worker) { var w = waitFor2();