summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2021-01-19 00:30:27 +0100
committerJose <jose@zeroc.com>2021-01-19 00:30:27 +0100
commit590b2a4049ddbd76a61850682d210a197c50e303 (patch)
tree426a0a1b938f304be723d51d5379970b7a896308
parentCheck the python version of the interpreter running the tests (diff)
downloadice-590b2a4049ddbd76a61850682d210a197c50e303.tar.bz2
ice-590b2a4049ddbd76a61850682d210a197c50e303.tar.xz
ice-590b2a4049ddbd76a61850682d210a197c50e303.zip
JavaScript default protocol for browsers should be "ws" - Close #934
-rw-r--r--js/src/Ice/DefaultsAndOverrides.js2
-rw-r--r--js/test/Ice/info/Client.js17
2 files changed, 15 insertions, 4 deletions
diff --git a/js/src/Ice/DefaultsAndOverrides.js b/js/src/Ice/DefaultsAndOverrides.js
index 88cd72358df..2fbd4ebb960 100644
--- a/js/src/Ice/DefaultsAndOverrides.js
+++ b/js/src/Ice/DefaultsAndOverrides.js
@@ -20,7 +20,7 @@ class DefaultsAndOverrides
constructor(properties, logger)
{
this.defaultProtocol = properties.getPropertyWithDefault("Ice.Default.Protocol",
- Ice.TcpEndpointFactory !== undefined ? "tcp" : "ws");
+ Ice.TcpTransceiver !== null ? "tcp" : "ws");
let value = properties.getProperty("Ice.Default.Host");
this.defaultHost = value.length > 0 ? value : null;
diff --git a/js/test/Ice/info/Client.js b/js/test/Ice/info/Client.js
index 1f4353cfd8f..202074a8077 100644
--- a/js/test/Ice/info/Client.js
+++ b/js/test/Ice/info/Client.js
@@ -1,3 +1,4 @@
+
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
@@ -8,6 +9,7 @@
const Test = require("Test").Test;
const TestHelper = require("TestHelper").TestHelper;
const test = TestHelper.test;
+ const isBrowser = (typeof window !== 'undefined' || typeof WorkerGlobalScope !== 'undefined');
function getTCPEndpointInfo(info)
{
@@ -46,9 +48,9 @@
"test -t:default -h tcphost -p 10000 -t 1200 -z --sourceAddress 10.10.10.10:opaque -e 1.8 -t 100 -v ABCD";
const p1 = communicator.stringToProxy(ref);
- const endps = p1.ice_getEndpoints();
- const endpoint = endps[0].getInfo();
- const ipEndpoint = getTCPEndpointInfo(endpoint);
+ let endps = p1.ice_getEndpoints();
+ let endpoint = endps[0].getInfo();
+ let ipEndpoint = getTCPEndpointInfo(endpoint);
test(ipEndpoint.host == "tcphost");
test(ipEndpoint.port == 10000);
test(ipEndpoint.timeout == 1200);
@@ -63,6 +65,15 @@
ipEndpoint.type() == Ice.WSEndpointType && endpoint instanceof Ice.WSEndpointInfo ||
ipEndpoint.type() == Ice.WSSEndpointType && endpoint instanceof Ice.WSEndpointInfo);
+
+ let ic = Ice.initialize();
+ ic.stringToProxy("test:default");
+ endps = p1.ice_getEndpoints();
+ endpoint = endps[0].getInfo();
+ ipEndpoint = getTCPEndpointInfo(endpoint);
+ test(ipEndpoint.type() == isBrowser ? Ice.WSEndpointType : Ice.TCPEndpointType);
+ ic.destroy();
+
const opaqueEndpoint = endps[1].getInfo();
test(opaqueEndpoint.rawEncoding.equals(new Ice.EncodingVersion(1, 8)));
out.writeLine("ok");