summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-10-04 10:20:24 +0200
committerJose <jose@zeroc.com>2016-10-04 10:20:24 +0200
commit8c3173fc13a8642e3a165f23f9bf1d087aec4a55 (patch)
tree2b75200cedf2241e5894f996bfc95e70c1fd685d
parentAnother fix for ICE-7399 (diff)
downloadice-8c3173fc13a8642e3a165f23f9bf1d087aec4a55.tar.bz2
ice-8c3173fc13a8642e3a165f23f9bf1d087aec4a55.tar.xz
ice-8c3173fc13a8642e3a165f23f9bf1d087aec4a55.zip
Fixed (ICE-7404) - js Ice/binding hung on Windows with Chrome
-rw-r--r--js/src/Ice/browser/TimerUtil.js2
-rw-r--r--js/test/Common/TestRunner.js14
-rw-r--r--js/test/Common/TestSuite.js14
-rw-r--r--js/test/Common/Worker.js40
-rw-r--r--js/test/Ice/binding/Client.js15
5 files changed, 65 insertions, 20 deletions
diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js
index 99c7b3f2608..10ff74c28b8 100644
--- a/js/src/Ice/browser/TimerUtil.js
+++ b/js/src/Ice/browser/TimerUtil.js
@@ -30,7 +30,7 @@ function createTimerObject()
Timer.setInterval = function () { setInterval.apply(null, arguments); };
Timer.clearInterval = function () { clearInterval.apply(null, arguments); };
Timer.setImmediate = typeof(setImmediate) == "function" ?
- function () { setImmediate.apply(null, arguments); } :
+ function () { setImmediate.apply(null, arguments); } :
function () { setTimeout.apply(null, arguments); };
return Timer;
}
diff --git a/js/test/Common/TestRunner.js b/js/test/Common/TestRunner.js
index d8c7e399c96..e006c755172 100644
--- a/js/test/Common/TestRunner.js
+++ b/js/test/Common/TestRunner.js
@@ -19,11 +19,25 @@ function isSafari()
return /^((?!chrome).)*safari/i.test(navigator.userAgent);
}
+function isChrome()
+{
+ //
+ // We need to check for Edge browser as it might include Chrome in its user agent.
+ //
+ return navigator.userAgent.indexOf("Edge/") === -1 &&
+ navigator.userAgent.indexOf("Chrome/") !== -1;
+}
+
function isWorker()
{
return typeof(WorkerGlobalScope) !== 'undefined' && this instanceof WorkerGlobalScope;
}
+function isWindows()
+{
+ return navigator.userAgent.indexOf("Windows") != -1;
+}
+
function runTest(name, language, defaultHost, protocol, configurations, out)
{
var server, communicator;
diff --git a/js/test/Common/TestSuite.js b/js/test/Common/TestSuite.js
index 41f5773202b..9afdc7db260 100644
--- a/js/test/Common/TestSuite.js
+++ b/js/test/Common/TestSuite.js
@@ -54,7 +54,7 @@ $(document).ready(
$("#test").val("/test/" + current + "/index.html");
$("#worker").prop("checked", query.worker == "true");
$("#loop").prop("checked", query.loop == "true");
-
+
function nextTest()
{
document.location.assign(new URI()
@@ -83,7 +83,7 @@ $(document).ready(
updateLocation();
}
}
-
+
function setRunning(running)
{
if(running)
@@ -104,7 +104,7 @@ $(document).ready(
$("#run").removeClass("disabled");
}
}
-
+
function updateLocation()
{
document.location.assign(new URI()
@@ -137,6 +137,7 @@ $(document).ready(
}
else if(e.data.type == "TestFinished")
{
+ worker.terminate();
setRunning(false);
next(e.data.success);
}
@@ -154,6 +155,11 @@ $(document).ready(
files: TestCases[current].files
}
});
+
+ worker.onerror = function(e)
+ {
+ console.log(e);
+ };
}
else
{
@@ -187,7 +193,7 @@ $(document).ready(
updateLocation();
return false;
});
-
+
$("#worker").on("change",
function(e)
{
diff --git a/js/test/Common/Worker.js b/js/test/Common/Worker.js
index e7789c45ded..21e8cb9cc0d 100644
--- a/js/test/Common/Worker.js
+++ b/js/test/Common/Worker.js
@@ -11,7 +11,7 @@
self : false,
runTest : false
*/
-
+
var Output =
{
write: function(msg)
@@ -26,20 +26,34 @@ var Output =
self.onmessage = function(e)
{
- if(e.data.type == "RunTest")
+ try
{
- var test = e.data.test;
- self.importScripts("/lib/Ice.js");
- self.importScripts("/test/Common/Controller.js");
- self.importScripts("/test/Common/TestRunner.js");
- for(var i = 0; i < test.files.length; ++i)
+ if(e.data.type == "RunTest")
{
- self.importScripts("/test/" + test.name + "/" + test.files[i]);
- }
- runTest(test.name, test.language, test.defaultHost, test.protocol, test.configurations, Output).then(
- function(r)
+ var test = e.data.test;
+ self.importScripts("/lib/Ice.js");
+ self.importScripts("/test/Common/Controller.js");
+ self.importScripts("/test/Common/TestRunner.js");
+ for(var i = 0; i < test.files.length; ++i)
{
- self.postMessage({type:"TestFinished", success:r});
- });
+ self.importScripts("/test/" + test.name + "/" + test.files[i]);
+ }
+
+ runTest(test.name, test.language, test.defaultHost, test.protocol, test.configurations, Output).then(
+ function(r)
+ {
+ self.postMessage({type:"TestFinished", success:r});
+ }).exception(
+ function(ex)
+ {
+ Output.writeLine(ex.toString());
+ self.postMessage({type:"TestFinished", success:false});
+ });
+ }
+ }
+ catch(ex)
+ {
+ Output.writeLine(ex.toString());
+ self.postMessage({type:"TestFinished", success:false});
}
};
diff --git a/js/test/Ice/binding/Client.js b/js/test/Ice/binding/Client.js
index b58c697837f..babd2f15edb 100644
--- a/js/test/Ice/binding/Client.js
+++ b/js/test/Ice/binding/Client.js
@@ -1165,15 +1165,26 @@
return p;
};
- if(typeof(navigator) !== 'undefined' && isSafari() && isWorker())
+ if(typeof(navigator) !== 'undefined' && isWorker() && (isSafari() || (isWindows() && isChrome())))
{
//
+ // BUGFIX:
+ //
// With Safari 9.1 and WebWorkers, this test hangs in communicator destruction. The
// web socket send() method never returns for the sending of close connection message.
//
+ // With Chrome on Windows the Webworker is unexpectelly terminated.
+ //
exports.__test__ = function(out, id)
{
- out.writeLine("Test not supported with Safari web workers.");
+ if(isSafari())
+ {
+ out.writeLine("Test not supported with Safari web workers.");
+ }
+ else if(isWindows() && isChrome())
+ {
+ out.writeLine("Test not supported with Chrome web workers.");
+ }
};
}
else