diff options
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/Ice/browser/TimerUtil.js | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js index f3f66c33da2..bac6009a830 100644 --- a/js/src/Ice/browser/TimerUtil.js +++ b/js/src/Ice/browser/TimerUtil.js @@ -15,6 +15,16 @@ const Ice = require("../Ice/ModuleRegistry").Ice; +function isSafari() +{ + return (/^((?!chrome).)*safari/i).test(navigator.userAgent); +} + +function isWorker() +{ + return typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope; +} + // // Create a timer object that uses the default browser methods. Note that we also // have to use apply with null as the first argument to workaround an issue where @@ -47,7 +57,11 @@ function createTimerObject() static setImmediate(cb) { - if(typeof setImmediate == "function") + // + // BUGFIX: setImediate callback is some times not fired when used + // from a Safari worker. + // + if(typeof setImmediate == "function" && !(isWorker() && isSafari())) { return setImmediate(cb); } |