From e59aec0a45868501987c142f539174449a0cf3f7 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 17 Jul 2018 16:46:24 +0200 Subject: [PATCH] Try...catch on testworker.js --- www/common/cryptpad-common.js | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 81236762b..96488f386 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -1158,18 +1158,23 @@ define([ Nthen(function (waitFor2) { if (Worker) { var w = waitFor2(); - worker = new Worker('/common/outer/testworker.js?' + urlArgs); - worker.onerror = function (errEv) { - errEv.preventDefault(); - errEv.stopPropagation(); + try { + worker = new Worker('/common/outer/testworker.js?' + urlArgs); + worker.onerror = function (errEv) { + errEv.preventDefault(); + errEv.stopPropagation(); + noWorker = true; + w(); + }; + worker.onmessage = function (ev) { + if (ev.data === "OK") { + w(); + } + }; + } catch (e) { noWorker = true; w(); - }; - worker.onmessage = function (ev) { - if (ev.data === "OK") { - w(); - } - }; + } } if (typeof(SharedWorker) !== "undefined") { try {