summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2018-10-25 10:10:24 +0200
committerJose <jose@zeroc.com>2018-10-25 10:11:30 +0200
commit780ad0be98a88e7402dc91ba3b0f59d8d03f5ebf (patch)
tree1f6ba3f0dfdaa8fda7803ddc9a337e0ff3cb73c3 /js
parentAdded IceSSL::ConnectionInfo for matlab. Closes #219. (diff)
downloadice-780ad0be98a88e7402dc91ba3b0f59d8d03f5ebf.tar.bz2
ice-780ad0be98a88e7402dc91ba3b0f59d8d03f5ebf.tar.xz
ice-780ad0be98a88e7402dc91ba3b0f59d8d03f5ebf.zip
Do not use setImedidate with Safari workers
Close #200
Diffstat (limited to 'js')
-rw-r--r--js/src/Ice/browser/TimerUtil.js16
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);
}