From b96cc78d56bbca4ad8d0b655518d68831c546aa9 Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 29 Mar 2018 15:11:43 +0200 Subject: Do not use WebWorkers with IE11 WebWorkers with IE11 can get stall, updated the timer to not use a WebWorker with IE11 and test scripts to not run tests with worker option --- js/src/Ice/browser/TimerUtil.js | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) (limited to 'js/src/Ice/browser/TimerUtil.js') diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js index 90317ec92d5..54388e04c66 100644 --- a/js/src/Ice/browser/TimerUtil.js +++ b/js/src/Ice/browser/TimerUtil.js @@ -186,7 +186,16 @@ const workerCode = function() }.toString() + "());"; }; -if(typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScope) +if(typeof navigator !== "undefined" && + (navigator.userAgent.indexOf("MSIE") !== -1 || + navigator.userAgent.match(/Trident.*rv:11\./))) +{ + // + // With IE always use the setInterval/setTimeout browser functions directly + // + Ice.Timer = createTimerObject(); +} +else if(typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobalScope) { // // If we are running in a worker don't spawn a separate worker for the timer @@ -195,24 +204,8 @@ if(typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScop } else if(worker === undefined) { - let url; - try - { - url = URL.createObjectURL(new Blob([workerCode()], {type : 'text/javascript'})); - worker = new Worker(url); - worker.onmessage = Timer.onmessage; - Ice.Timer = Timer; - } - catch(ex) - { - if(url !== undefined) - { - URL.revokeObjectURL(url); - } - // - // Fallback on setInterval/setTimeout if the worker creating failed. Some IE10 and IE11 don't - // support creating workers from blob URLs for instance. - // - Ice.Timer = createTimerObject(); - } + const url = URL.createObjectURL(new Blob([workerCode()], {type : 'text/javascript'})); + worker = new Worker(url); + worker.onmessage = Timer.onmessage; + Ice.Timer = Timer; } -- cgit v1.2.3