summaryrefslogtreecommitdiff
path: root/js/src
diff options
context:
space:
mode:
Diffstat (limited to 'js/src')
-rw-r--r--js/src/Glacier2/Glacier2.js4
-rw-r--r--js/src/Ice/ArrayUtil.js6
-rw-r--r--js/src/Ice/AsyncStatus.js2
-rw-r--r--js/src/Ice/Base64.js4
-rw-r--r--js/src/Ice/Buffer.js7
-rw-r--r--js/src/Ice/ConnectRequestHandler.js48
-rw-r--r--js/src/Ice/ConnectionI.js213
-rw-r--r--js/src/Ice/Debug.js3
-rw-r--r--js/src/Ice/EndpointFactoryManager.js2
-rw-r--r--js/src/Ice/EnumBase.js11
-rw-r--r--js/src/Ice/Exception.js2
-rw-r--r--js/src/Ice/FormatType.js7
-rw-r--r--js/src/Ice/HashMap.js60
-rw-r--r--js/src/Ice/IdentityUtil.js7
-rw-r--r--js/src/Ice/IncomingAsync.js8
-rw-r--r--js/src/Ice/LocatorInfo.js21
-rw-r--r--js/src/Ice/ModuleRegistry.js4
-rw-r--r--js/src/Ice/Object.js2
-rw-r--r--js/src/Ice/ObjectAdapterI.js87
-rw-r--r--js/src/Ice/ObjectPrx.js5
-rw-r--r--js/src/Ice/Operation.js56
-rw-r--r--js/src/Ice/OutgoingAsync.js11
-rw-r--r--js/src/Ice/OutgoingConnectionFactory.js62
-rw-r--r--js/src/Ice/Promise.js7
-rw-r--r--js/src/Ice/Properties.js12
-rw-r--r--js/src/Ice/PropertyNames.js10
-rw-r--r--js/src/Ice/Protocol.js37
-rw-r--r--js/src/Ice/ProxyFactory.js2
-rw-r--r--js/src/Ice/Reference.js32
-rw-r--r--js/src/Ice/RouterInfo.js4
-rw-r--r--js/src/Ice/ServantManager.js50
-rw-r--r--js/src/Ice/Stream.js87
-rw-r--r--js/src/Ice/StreamHelpers.js51
-rw-r--r--js/src/Ice/StringUtil.js78
-rw-r--r--js/src/Ice/Struct.js2
-rw-r--r--js/src/Ice/TcpEndpointI.js2
-rw-r--r--js/src/Ice/TcpTransceiver.js29
-rw-r--r--js/src/Ice/Timer.js4
-rw-r--r--js/src/Ice/ToStringMode.js7
-rw-r--r--js/src/Ice/TraceUtil.js8
-rw-r--r--js/src/Ice/UnknownSlicedValue.js36
-rw-r--r--js/src/Ice/Value.js16
-rw-r--r--js/src/Ice/WSEndpoint.js16
-rw-r--r--js/src/Ice/browser/ModuleRegistry.js8
-rw-r--r--js/src/Ice/browser/TimerUtil.js42
-rw-r--r--js/src/Ice/browser/WSTransceiver.js3
-rw-r--r--js/src/IceGrid/IceGrid.js2
-rw-r--r--js/src/es5/index.js8
-rw-r--r--js/src/index.js8
49 files changed, 625 insertions, 568 deletions
diff --git a/js/src/Glacier2/Glacier2.js b/js/src/Glacier2/Glacier2.js
index 5ae2d25c1de..2ba6a085f4b 100644
--- a/js/src/Glacier2/Glacier2.js
+++ b/js/src/Glacier2/Glacier2.js
@@ -7,12 +7,12 @@
//
// **********************************************************************
-var _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry;
+const _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry;
module.exports.Glacier2 = _ModuleRegistry.require(module,
[
"../Glacier2/PermissionsVerifier",
"../Glacier2/Router",
"../Glacier2/Session",
- "../Glacier2/SSLInfo",
+ "../Glacier2/SSLInfo"
]).Glacier2;
diff --git a/js/src/Ice/ArrayUtil.js b/js/src/Ice/ArrayUtil.js
index 162a2d74913..2fbe9295bd3 100644
--- a/js/src/Ice/ArrayUtil.js
+++ b/js/src/Ice/ArrayUtil.js
@@ -92,11 +92,13 @@ Slice.defineSequence = function(module, name, valueHelper, fixed, elementType)
let helper = null;
Object.defineProperty(module, name,
{
- get: function()
+ get: () =>
{
if(helper === null)
{
- helper = Ice.StreamHelpers.generateSeqHelper(_ModuleRegistry.type(valueHelper), fixed, _ModuleRegistry.type(elementType));
+ helper = Ice.StreamHelpers.generateSeqHelper(_ModuleRegistry.type(valueHelper),
+ fixed,
+ _ModuleRegistry.type(elementType));
}
return helper;
}
diff --git a/js/src/Ice/AsyncStatus.js b/js/src/Ice/AsyncStatus.js
index 22767bdfc60..cdc3fb3c757 100644
--- a/js/src/Ice/AsyncStatus.js
+++ b/js/src/Ice/AsyncStatus.js
@@ -8,5 +8,5 @@
// **********************************************************************
const Ice = require("../Ice/ModuleRegistry").Ice;
-Ice.AsyncStatus = { Queued: 0, Sent: 1 };
+Ice.AsyncStatus = {Queued: 0, Sent: 1};
module.exports.Ice = Ice;
diff --git a/js/src/Ice/Base64.js b/js/src/Ice/Base64.js
index bd549baf767..944ffd89713 100644
--- a/js/src/Ice/Base64.js
+++ b/js/src/Ice/Base64.js
@@ -9,8 +9,6 @@
const Ice = require("../Ice/Buffer").Ice;
-const Buffer = Ice.Buffer;
-
const _codeA = "A".charCodeAt(0);
const _codea = "a".charCodeAt(0);
const _code0 = "0".charCodeAt(0);
@@ -170,7 +168,7 @@ class Base64
// Figure out how long the final sequence is going to be.
const totalBytes = (newStr.length * 3 / 4) + 1;
- const retval = new Buffer();
+ const retval = new Ice.Buffer();
retval.resize(totalBytes);
let by1;
diff --git a/js/src/Ice/Buffer.js b/js/src/Ice/Buffer.js
index 7af36f0e6ef..3bb6a08a1dd 100644
--- a/js/src/Ice/Buffer.js
+++ b/js/src/Ice/Buffer.js
@@ -147,7 +147,7 @@ class Buffer
putArray(v)
{
- //Expects an Uint8Array
+ // Expects an Uint8Array
if(!(v instanceof Uint8Array))
{
throw new TypeError('argument is not a Uint8Array');
@@ -286,8 +286,9 @@ class Buffer
{
throw new Error(bufferUnderflowExceptionMsg);
}
- length = length === undefined ? (this.b.byteLength - position) : length;
- return new Uint8Array(this.b.slice(position, position + length));
+ return new Uint8Array(
+ this.b.slice(position, position + length === undefined ?
+ (this.b.byteLength - position) : length));
}
getShort()
diff --git a/js/src/Ice/ConnectRequestHandler.js b/js/src/Ice/ConnectRequestHandler.js
index 9c708af752f..04c43ca8535 100644
--- a/js/src/Ice/ConnectRequestHandler.js
+++ b/js/src/Ice/ConnectRequestHandler.js
@@ -15,7 +15,7 @@ Ice._ModuleRegistry.require(module,
"../Ice/Debug",
"../Ice/RetryException",
"../Ice/ReferenceMode",
- "../Ice/Exception",
+ "../Ice/Exception"
]);
const AsyncStatus = Ice.AsyncStatus;
@@ -125,12 +125,14 @@ class ConnectRequestHandler
const ri = this._reference.getRouterInfo();
if(ri !== null)
{
- //
- ri.addProxy(this._proxy).then(() => this.flushRequests(), // The proxy was added to the router
- // info, we're now ready to send the
- // queued requests.
- //
- ex => this.setException(ex));
+ ri.addProxy(this._proxy).then(
+ //
+ // The proxy was added to the router
+ // info, we're now ready to send the
+ // queued requests.
+ //
+ () => this.flushRequests(),
+ ex => this.setException(ex));
return; // The request handler will be initialized once addProxy completes.
}
@@ -180,26 +182,23 @@ class ConnectRequestHandler
Debug.assert(this._connection !== null);
return true;
}
- else
+ else if(this._exception !== null)
{
- if(this._exception !== null)
- {
- if(this._connection !== null)
- {
- //
- // Only throw if the connection didn't get established. If
- // it died after being established, we allow the caller to
- // retry the connection establishment by not throwing here
- // (the connection will throw RetryException).
- //
- return true;
- }
- throw this._exception;
- }
- else
+ if(this._connection !== null)
{
- return this._initialized;
+ //
+ // Only throw if the connection didn't get established. If
+ // it died after being established, we allow the caller to
+ // retry the connection establishment by not throwing here
+ // (the connection will throw RetryException).
+ //
+ return true;
}
+ throw this._exception;
+ }
+ else
+ {
+ return this._initialized;
}
}
@@ -222,7 +221,6 @@ class ConnectRequestHandler
// Remove the request handler before retrying.
this._reference.getInstance().requestHandlerFactory().removeRequestHandler(this._reference, this);
-
request.retryException(ex.inner);
}
else
diff --git a/js/src/Ice/ConnectionI.js b/js/src/Ice/ConnectionI.js
index 94699a15d1d..d5a9ae8cfed 100644
--- a/js/src/Ice/ConnectionI.js
+++ b/js/src/Ice/ConnectionI.js
@@ -26,7 +26,7 @@ Ice._ModuleRegistry.require(module,
"../Ice/Version",
"../Ice/Exception",
"../Ice/LocalException",
- "../Ice/BatchRequestQueue",
+ "../Ice/BatchRequestQueue"
]);
const AsyncStatus = Ice.AsyncStatus;
@@ -96,7 +96,7 @@ class ConnectionI
this._readTimeoutId = 0;
this._readTimeoutScheduled = false;
- this._hasMoreData = { value: false };
+ this._hasMoreData = {value: false};
this._warn = initData.properties.getPropertyAsInt("Ice.Warn.Connections") > 0;
this._warnUdp = instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Datagrams") > 0;
@@ -159,9 +159,9 @@ class ConnectionI
this._startPromise = new Ice.Promise();
this._transceiver.setCallbacks(
- () => { this.message(SocketOperation.Write); }, // connected callback
- () => { this.message(SocketOperation.Read); }, // read callback
- () => { this.message(SocketOperation.Write); } // write callback
+ () => this.message(SocketOperation.Write), // connected callback
+ () => this.message(SocketOperation.Read), // read callback
+ () => this.message(SocketOperation.Write) // write callback
);
this.initialize();
}
@@ -213,6 +213,12 @@ class ConnectionI
this.setState(StateClosing, new Ice.CommunicatorDestroyedException());
break;
}
+
+ default:
+ {
+ Debug.assert(false);
+ break;
+ }
}
}
@@ -322,7 +328,7 @@ class ConnectionI
//
if(acm.heartbeat == Ice.ACMHeartbeat.HeartbeatAlways ||
(acm.heartbeat != Ice.ACMHeartbeat.HeartbeatOff && this._writeStream.isEmpty() &&
- now >= (this._acmLastActivity + acm.timeout / 4)))
+ now >= (this._acmLastActivity + (acm.timeout / 4))))
{
if(acm.heartbeat != Ice.ACMHeartbeat.HeartbeatOnDispatch || this._dispatchCount > 0)
{
@@ -903,7 +909,7 @@ class ConnectionI
if(this._hasMoreData.value)
{
- Timer.setImmediate(() => { this.message(SocketOperation.Read); }); // Don't tie up the thread.
+ Timer.setImmediate(() => this.message(SocketOperation.Read)); // Don't tie up the thread.
}
}
@@ -1010,31 +1016,28 @@ class ConnectionI
this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join(""));
}
}
- else
+ else if(traceLevels.network >= 1)
{
- if(traceLevels.network >= 1)
- {
- const s = [];
- s.push("closed ");
- s.push(this._endpoint.protocol());
- s.push(" connection\n");
- s.push(this.toString());
-
- //
- // Trace the cause of unexpected connection closures
- //
- if(!(this._exception instanceof Ice.CloseConnectionException ||
- this._exception instanceof Ice.ConnectionManuallyClosedException ||
- this._exception instanceof Ice.ConnectionTimeoutException ||
- this._exception instanceof Ice.CommunicatorDestroyedException ||
- this._exception instanceof Ice.ObjectAdapterDeactivatedException))
- {
- s.push("\n");
- s.push(this._exception.toString());
- }
+ const s = [];
+ s.push("closed ");
+ s.push(this._endpoint.protocol());
+ s.push(" connection\n");
+ s.push(this.toString());
- this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join(""));
+ //
+ // Trace the cause of unexpected connection closures
+ //
+ if(!(this._exception instanceof Ice.CloseConnectionException ||
+ this._exception instanceof Ice.ConnectionManuallyClosedException ||
+ this._exception instanceof Ice.ConnectionTimeoutException ||
+ this._exception instanceof Ice.CommunicatorDestroyedException ||
+ this._exception instanceof Ice.ObjectAdapterDeactivatedException))
+ {
+ s.push("\n");
+ s.push(this._exception.toString());
}
+
+ this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join(""));
}
if(this._startPromise !== null)
@@ -1272,100 +1275,106 @@ class ConnectionI
{
switch(state)
{
- case StateNotInitialized:
- {
- Debug.assert(false);
- break;
- }
+ case StateNotInitialized:
+ {
+ Debug.assert(false);
+ break;
+ }
- case StateNotValidated:
- {
- if(this._state !== StateNotInitialized)
+ case StateNotValidated:
{
- Debug.assert(this._state === StateClosed);
- return;
+ if(this._state !== StateNotInitialized)
+ {
+ Debug.assert(this._state === StateClosed);
+ return;
+ }
+ //
+ // Register to receive validation message.
+ //
+ if(!this._endpoint.datagram() && !this._incoming)
+ {
+ //
+ // Once validation is complete, a new connection starts out in the
+ // Holding state. We only want to register the transceiver now if we
+ // need to receive data in order to validate the connection.
+ //
+ this._transceiver.register();
+ }
+ break;
}
- //
- // Register to receive validation message.
- //
- if(!this._endpoint.datagram() && !this._incoming)
+
+ case StateActive:
{
//
- // Once validation is complete, a new connection starts out in the
- // Holding state. We only want to register the transceiver now if we
- // need to receive data in order to validate the connection.
+ // Can only switch from holding or not validated to
+ // active.
//
+ if(this._state !== StateHolding && this._state !== StateNotValidated)
+ {
+ return;
+ }
this._transceiver.register();
+ break;
}
- break;
- }
- case StateActive:
- {
- //
- // Can only switch from holding or not validated to
- // active.
- //
- if(this._state !== StateHolding && this._state !== StateNotValidated)
+ case StateHolding:
{
- return;
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(this._state !== StateActive && this._state !== StateNotValidated)
+ {
+ return;
+ }
+ if(this._state === StateActive)
+ {
+ this._transceiver.unregister();
+ }
+ break;
}
- this._transceiver.register();
- break;
- }
- case StateHolding:
- {
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(this._state !== StateActive && this._state !== StateNotValidated)
+ case StateClosing:
{
- return;
+ //
+ // Can't change back from closed.
+ //
+ if(this._state >= StateClosed)
+ {
+ return;
+ }
+ if(this._state === StateHolding)
+ {
+ // We need to continue to read in closing state.
+ this._transceiver.register();
+ }
+ break;
}
- if(this._state === StateActive)
+
+ case StateClosed:
{
+ if(this._state === StateFinished)
+ {
+ return;
+ }
+ this._batchRequestQueue.destroy(this._exception);
this._transceiver.unregister();
+ break;
}
- break;
- }
- case StateClosing:
- {
- //
- // Can't change back from closed.
- //
- if(this._state >= StateClosed)
- {
- return;
- }
- if(this._state === StateHolding)
+ case StateFinished:
{
- // We need to continue to read in closing state.
- this._transceiver.register();
+ Debug.assert(this._state === StateClosed);
+ this._transceiver.close();
+ this._communicator = null;
+ break;
}
- break;
- }
- case StateClosed:
- {
- if(this._state === StateFinished)
+ default:
{
- return;
+ Debug.assert(false);
+ break;
}
- this._batchRequestQueue.destroy(this._exception);
- this._transceiver.unregister();
- break;
- }
-
- case StateFinished:
- {
- Debug.assert(this._state === StateClosed);
- this._transceiver.close();
- this._communicator = null;
- break;
- }
}
}
catch(ex)
@@ -1567,7 +1576,7 @@ class ConnectionI
throw new Ice.ConnectionNotValidatedException();
}
this._readStream.readByte(); // Ignore compression status for validate connection.
- if( this._readStream.readInt() !== Protocol.headerSize)
+ if(this._readStream.readInt() !== Protocol.headerSize)
{
throw new Ice.IllegalMessageSizeException();
}
@@ -1692,7 +1701,7 @@ class ConnectionI
// If all the messages were sent and we are in the closing state, we schedule
// the close timeout to wait for the peer to close the connection.
//
- if(this._state === StateClosing && _shutdownInitiated)
+ if(this._state === StateClosing && this._shutdownInitiated)
{
this.scheduleTimeout(SocketOperation.Read);
}
diff --git a/js/src/Ice/Debug.js b/js/src/Ice/Debug.js
index bc7876b6b82..d7f1665c74a 100644
--- a/js/src/Ice/Debug.js
+++ b/js/src/Ice/Debug.js
@@ -7,6 +7,9 @@
//
// **********************************************************************
+/* eslint no-sync: "off" */
+/* eslint no-process-exit: "off" */
+
const Ice = require("../Ice/ModuleRegistry").Ice;
const fs = require("fs");
diff --git a/js/src/Ice/EndpointFactoryManager.js b/js/src/Ice/EndpointFactoryManager.js
index 2a2ddfc9219..0ea675d36aa 100644
--- a/js/src/Ice/EndpointFactoryManager.js
+++ b/js/src/Ice/EndpointFactoryManager.js
@@ -96,7 +96,7 @@ class EndpointFactoryManager
throw new EndpointParseException("unrecognized argument `" + arr[0] + "' in endpoint `" + str + "'");
}
- for(let i = 0, length = this._factories.length; i < length; ++i)
+ for(let i = 0, length = this._factories.length; i < length; ++i)
{
if(this._factories[i].type() == ue.type())
{
diff --git a/js/src/Ice/EnumBase.js b/js/src/Ice/EnumBase.js
index bf8fdf53368..9e9c03a585a 100644
--- a/js/src/Ice/EnumBase.js
+++ b/js/src/Ice/EnumBase.js
@@ -91,10 +91,6 @@ Slice.defineEnum = function(enumerators)
{
const type = class extends EnumBase
{
- constructor(n, v)
- {
- super(n, v);
- }
};
const enums = [];
@@ -121,9 +117,7 @@ Slice.defineEnum = function(enumerators)
}
}
- Object.defineProperty(type, "minWireSize", {
- get: function(){ return 1; }
- });
+ Object.defineProperty(type, "minWireSize", {get: () => 1});
type._write = function(os, v)
{
@@ -136,10 +130,12 @@ Slice.defineEnum = function(enumerators)
os.writeEnum(firstEnum);
}
};
+
type._read = function(is)
{
return is.readEnum(type);
};
+
type._writeOpt = function(os, tag, v)
{
if(v !== undefined)
@@ -150,6 +146,7 @@ Slice.defineEnum = function(enumerators)
}
}
};
+
type._readOpt = function(is, tag)
{
return is.readOptionalEnum(tag, type);
diff --git a/js/src/Ice/Exception.js b/js/src/Ice/Exception.js
index fa5ed01ce2d..162b28a7622 100644
--- a/js/src/Ice/Exception.js
+++ b/js/src/Ice/Exception.js
@@ -281,7 +281,7 @@ const readPreserved = function(is)
const ice_getSlicedData = function()
{
return this._slicedData;
-}
+};
Ice.Slice.PreservedUserException = function(ex)
{
diff --git a/js/src/Ice/FormatType.js b/js/src/Ice/FormatType.js
index d7e88b6fd71..a904c1caeef 100644
--- a/js/src/Ice/FormatType.js
+++ b/js/src/Ice/FormatType.js
@@ -8,5 +8,10 @@
// **********************************************************************
const Ice = require("../Ice/EnumBase").Ice;
-Ice.FormatType = Ice.Slice.defineEnum([['DefaultFormat', 0], ['CompactFormat',1], ['SlicedFormat',2]]);
+Ice.FormatType = Ice.Slice.defineEnum(
+ [
+ ['DefaultFormat', 0],
+ ['CompactFormat', 1],
+ ['SlicedFormat', 2]
+ ]);
module.exports.Ice = Ice;
diff --git a/js/src/Ice/HashMap.js b/js/src/Ice/HashMap.js
index feff178e07c..71dda4b2574 100644
--- a/js/src/Ice/HashMap.js
+++ b/js/src/Ice/HashMap.js
@@ -234,10 +234,15 @@ class HashMap
return false;
}
- const eq = valuesEqual || ((v1, v2) =>
- {
- return this._valueComparator.call(this._valueComparator, v1, v2);
- });
+ let eq;
+ if(valuesEqual)
+ {
+ eq = valuesEqual;
+ }
+ else
+ {
+ eq = (v1, v2) => this._valueComparator.call(this._valueComparator, v1, v2);
+ }
for(let e = this._head; e !== null; e = e._next)
{
@@ -264,44 +269,53 @@ class HashMap
// Create a new table entry.
//
const e = Object.create(null, {
- "key": {
+ key:
+ {
enumerable: true,
get: function() { return this._key; }
},
- "value": {
+ value:
+ {
enumerable: true,
get: function() { return this._value; }
},
- "next": {
+ next:
+ {
enumerable: true,
get: function() { return this._next; }
},
- "_key": {
+ _key:
+ {
enumerable: false,
writable: true,
value: key
},
- "_value": {
+ _value:
+ {
enumerable: false,
writable: true,
value: value
},
- "_prev": {
+ _prev:
+ {
enumerable: false,
writable: true,
value: null
},
- "_next": {
+ _next:
+ {
enumerable: false,
writable: true,
value: null
},
- "_nextInBucket": {
+ _nextInBucket:
+ {
enumerable: false,
writable: true,
value: null
},
- "_hash": {
+ _hash:
+ {
enumerable: false,
writable: true,
value: hash
@@ -366,9 +380,9 @@ class HashMap
computeHash(v)
{
- if(v === 0 || v === -0)
+ if(v === 0)
{
- return {key:0, hash:0};
+ return {key: 0, hash: 0};
}
if(v === null)
@@ -376,7 +390,7 @@ class HashMap
if(HashMap._null === null)
{
const uuid = Ice.generateUUID();
- HashMap._null = {key:uuid, hash:StringUtil.hashCode(uuid)};
+ HashMap._null = {key: uuid, hash: StringUtil.hashCode(uuid)};
}
return HashMap._null;
}
@@ -386,15 +400,15 @@ class HashMap
throw new Error("cannot compute hash for undefined value");
}
- if(typeof(v.hashCode) === "function")
+ if(typeof v.hashCode === "function")
{
- return {key:v, hash:v.hashCode()};
+ return {key: v, hash: v.hashCode()};
}
- const type = typeof(v);
+ const type = typeof v;
if(type === "string" || v instanceof String)
{
- return {key:v, hash:StringUtil.hashCode(v)};
+ return {key: v, hash: StringUtil.hashCode(v)};
}
else if(type === "number" || v instanceof Number)
{
@@ -403,15 +417,15 @@ class HashMap
if(HashMap._nan === null)
{
const uuid = Ice.generateUUID();
- HashMap._nan = {key:uuid, hash:StringUtil.hashCode(uuid)};
+ HashMap._nan = {key: uuid, hash: StringUtil.hashCode(uuid)};
}
return HashMap._nan;
}
- return {key:v, hash:v.toFixed(0)};
+ return {key: v, hash: v.toFixed(0)};
}
else if(type === "boolean" || v instanceof Boolean)
{
- return {key:v, hash:v ? 1 : 0};
+ return {key: v, hash: v ? 1 : 0};
}
throw new Error("cannot compute hash for value of type " + type);
diff --git a/js/src/Ice/IdentityUtil.js b/js/src/Ice/IdentityUtil.js
index c8d1b9ec993..1768ccdd79b 100644
--- a/js/src/Ice/IdentityUtil.js
+++ b/js/src/Ice/IdentityUtil.js
@@ -8,7 +8,12 @@
// **********************************************************************
const Ice = require("../Ice/ModuleRegistry").Ice;
-Ice._ModuleRegistry.require(module, [ "../Ice/StringUtil", "../Ice/Identity", "../Ice/LocalException"]);
+Ice._ModuleRegistry.require(module,
+ [
+ "../Ice/StringUtil",
+ "../Ice/Identity",
+ "../Ice/LocalException"
+ ]);
const StringUtil = Ice.StringUtil;
const Identity = Ice.Identity;
diff --git a/js/src/Ice/IncomingAsync.js b/js/src/Ice/IncomingAsync.js
index d5503b8d897..20cdd006f6d 100644
--- a/js/src/Ice/IncomingAsync.js
+++ b/js/src/Ice/IncomingAsync.js
@@ -47,7 +47,7 @@ class IncomingAsync
this._servant = null;
this._locator = null;
- this._cookie = { value: null };
+ this._cookie = {value: null};
this._os = null;
this._is = null;
@@ -208,7 +208,7 @@ class IncomingAsync
}
else
{
- Ice.StringSeqHelper.write(this._os, [ ex.facet ]);
+ Ice.StringSeqHelper.write(this._os, [ex.facet]);
}
this._os.writeString(ex.operation);
@@ -342,7 +342,6 @@ class IncomingAsync
this._os.writeBlob(Protocol.replyHdr);
this._os.writeInt(this._current.requestId);
this._os.writeByte(Protocol.replyUnknownException);
- //this._os.writeString(ex.toString());
this._os.writeString(ex.toString() + (ex.stack ? "\n" + ex.stack : ""));
this._connection.sendResponse(this._os);
}
@@ -457,7 +456,8 @@ class IncomingAsync
const promise = this._servant._iceDispatch(this, this._current);
if(promise !== null)
{
- promise.then(() => this.completed(null, true), (ex) => this.completed(ex, true));
+ promise.then(() => this.completed(null, true),
+ ex => this.completed(ex, true));
return;
}
diff --git a/js/src/Ice/LocatorInfo.js b/js/src/Ice/LocatorInfo.js
index e4085e307f0..b7e71384d57 100644
--- a/js/src/Ice/LocatorInfo.js
+++ b/js/src/Ice/LocatorInfo.js
@@ -95,7 +95,7 @@ class LocatorInfo
Debug.assert(ref.isIndirect());
let endpoints = null;
- const cached = { value: false };
+ const cached = {value: false};
if(!ref.isWellKnown())
{
endpoints = this._table.getAdapterEndpoints(ref.getAdapterId(), ttl, cached);
@@ -168,7 +168,7 @@ class LocatorInfo
}
else
{
- const r = this._table.removeObjectReference(ref.getIdentity());
+ const r = this._table.removeObjectReference(ref.getIdentity());
if(r !== null)
{
if(!r.isIndirect())
@@ -323,18 +323,15 @@ class LocatorInfo
this.trace("found endpoints for adapter in locator cache", ref, endpoints);
}
}
+ else if(ref.isWellKnown())
+ {
+ this.trace("retrieved endpoints for well-known proxy from locator, adding to locator cache",
+ ref, endpoints);
+ }
else
{
- if(ref.isWellKnown())
- {
- this.trace("retrieved endpoints for well-known proxy from locator, adding to locator cache",
- ref, endpoints);
- }
- else
- {
- this.trace("retrieved endpoints for adapter from locator, adding to locator cache",
- ref, endpoints);
- }
+ this.trace("retrieved endpoints for adapter from locator, adding to locator cache",
+ ref, endpoints);
}
}
else
diff --git a/js/src/Ice/ModuleRegistry.js b/js/src/Ice/ModuleRegistry.js
index 42607067a5c..b5a62b105ec 100644
--- a/js/src/Ice/ModuleRegistry.js
+++ b/js/src/Ice/ModuleRegistry.js
@@ -13,11 +13,11 @@ class _ModuleRegistry
{
static module(name)
{
- let m = modules[name];
+ let m = modules[name];
if(m === undefined)
{
m = {};
- modules[name] = m;
+ modules[name] = m;
}
return m;
}
diff --git a/js/src/Ice/Object.js b/js/src/Ice/Object.js
index 45dd64b54bc..e01468241e5 100644
--- a/js/src/Ice/Object.js
+++ b/js/src/Ice/Object.js
@@ -21,8 +21,6 @@ Ice._ModuleRegistry.require(module,
"../Ice/OptionalFormat"
]);
-const ids = ["::Ice::Object"];
-
Ice.Object = class
{
ice_isA(s, current)
diff --git a/js/src/Ice/ObjectAdapterI.js b/js/src/Ice/ObjectAdapterI.js
index a6c65d266e6..2fd184a958d 100644
--- a/js/src/Ice/ObjectAdapterI.js
+++ b/js/src/Ice/ObjectAdapterI.js
@@ -73,11 +73,11 @@ const _suffixes =
const StateUninitialized = 0; // Just constructed.
const StateHeld = 1;
-//const StateWaitActivate = 2;
+// const StateWaitActivate = 2;
const StateActive = 3;
-//const StateDeactivating = 4;
+// const StateDeactivating = 4;
const StateDeactivated = 5;
-const StateDestroyed = 6;
+const StateDestroyed = 6;
//
// Only for use by IceInternal.ObjectAdapterFactory
@@ -459,7 +459,11 @@ class ObjectAdapterI
refreshPublishedEndpoints()
{
this.checkForDeactivation();
- return this.computePublishedEndpoints().then(endpoints => this._publishedEndpoints = endpoints);
+ return this.computePublishedEndpoints().then(
+ endpoints =>
+ {
+ this._publishedEndpoints = endpoints;
+ });
}
getPublishedEndpoints()
@@ -488,7 +492,7 @@ class ObjectAdapterI
setAdapterOnConnection(connection)
{
this.checkForDeactivation();
- connection.setAdapterAndServantManager(this, _servantManager);
+ connection.setAdapterAndServantManager(this, this._servantManager);
}
messageSizeMax()
@@ -546,21 +550,22 @@ class ObjectAdapterI
let p;
if(this._routerInfo !== null)
{
- p = this._routerInfo.getServerEndpoints().then((endpts) =>
- {
- //
- // Remove duplicate endpoints, so we have a list of unique endpoints.
- //
- const endpoints = [];
- endpts.forEach(endpoint =>
- {
- if(endpoints.findIndex(value => endpoint.equals(value)) === -1)
+ p = this._routerInfo.getServerEndpoints().then(
+ endpts =>
{
- endpoints.push(endpoint);
- }
- });
- return endpoints;
- });
+ //
+ // Remove duplicate endpoints, so we have a list of unique endpoints.
+ //
+ const endpoints = [];
+ endpts.forEach(endpoint =>
+ {
+ if(endpoints.findIndex(value => endpoint.equals(value)) === -1)
+ {
+ endpoints.push(endpoint);
+ }
+ });
+ return endpoints;
+ });
}
else
{
@@ -609,7 +614,7 @@ class ObjectAdapterI
}
else
{
- quote = s.indexOf('\"', ++quote);
+ quote = s.indexOf("\"", ++quote);
if(quote == -1)
{
break;
@@ -632,7 +637,7 @@ class ObjectAdapterI
const es = s.substring(beg, end);
const endp = this._instance.endpointFactoryManager().create(es, false);
- if(endp == null)
+ if(endp === null)
{
throw new Ice.EndpointParseException("invalid object adapter endpoint `" + s + "'");
}
@@ -642,28 +647,30 @@ class ObjectAdapterI
p = Ice.Promise.resolve(endpoints);
}
- return p.then((endpoints) =>
- {
- if(this._instance.traceLevels().network >= 1 && endpoints.length > 0)
- {
- const s = [];
- s.push("published endpoints for object adapter `");
- s.push(this._name);
- s.push("':\n");
- let first = true;
- endpoints.forEach(endpoint =>
+ return p.then(
+ endpoints =>
{
- if(!first)
+ if(this._instance.traceLevels().network >= 1 && endpoints.length > 0)
{
- s.push(":");
+ const s = [];
+ s.push("published endpoints for object adapter `");
+ s.push(this._name);
+ s.push("':\n");
+ let first = true;
+ endpoints.forEach(endpoint =>
+ {
+ if(!first)
+ {
+ s.push(":");
+ }
+ s.push(endpoint.toString());
+ first = false;
+ });
+ this._instance.initializationData().logger.trace(this._instance.traceLevels().networkCat,
+ s.toString());
}
- s.push(endpoint.toString());
- first = false;
+ return endpoints;
});
- this._instance.initializationData().logger.trace(this._instance.traceLevels().networkCat, s.toString());
- }
- return endpoints;
- });
}
filterProperties(unknownProps)
@@ -684,7 +691,7 @@ class ObjectAdapterI
let noProps = true;
const props = this._instance.initializationData().properties.getPropertiesForPrefix(prefix);
- for(const [key, value] of props)
+ for(const key of props.keys())
{
let valid = false;
for(let i = 0; i < _suffixes.length; ++i)
diff --git a/js/src/Ice/ObjectPrx.js b/js/src/Ice/ObjectPrx.js
index cb1b03b25e3..3e83bcba57f 100644
--- a/js/src/Ice/ObjectPrx.js
+++ b/js/src/Ice/ObjectPrx.js
@@ -25,9 +25,7 @@ Ice._ModuleRegistry.require(module,
const ArrayUtil = Ice.ArrayUtil;
const AsyncResultBase = Ice.AsyncResultBase;
-const AsyncResult = Ice.AsyncResult;
const Debug = Ice.Debug;
-const FormatType = Ice.FormatType;
const OutgoingAsync = Ice.OutgoingAsync;
const ProxyFlushBatch = Ice.ProxyFlushBatch;
const ProxyGetConnection = Ice.ProxyGetConnection;
@@ -701,7 +699,7 @@ class ObjectPrx
else
{
const ostr = r.startWriteParams(fmt);
- marshalFn.call(null, ostr, args);
+ marshalFn(ostr, args);
r.endWriteParams();
}
r.invoke();
@@ -738,7 +736,6 @@ class ObjectPrx
catch(ex)
{
this.dispatchLocalException(r, ex);
- return;
}
}
diff --git a/js/src/Ice/Operation.js b/js/src/Ice/Operation.js
index 211dc2c2a2f..5fd85b1404a 100644
--- a/js/src/Ice/Operation.js
+++ b/js/src/Ice/Operation.js
@@ -37,7 +37,7 @@ const builtinHelpers =
function parseParam(p)
{
let type = p[0];
- const t = typeof(type);
+ const t = typeof type;
if(t === 'number')
{
type = builtinHelpers[p[0]];
@@ -48,9 +48,9 @@ function parseParam(p)
}
return {
- "type": type,
- "isObject": (p[1] === true),
- "tag": p[2] // Optional tag, which may not be present - an undefined tag means "not optional".
+ type: type,
+ isObject: (p[1] === true),
+ tag: p[2] // Optional tag, which may not be present - an undefined tag means "not optional".
};
}
@@ -181,23 +181,29 @@ function unmarshalParams(is, retvalInfo, allParamInfo, optParamInfo, usesClasses
{
if(p.isObject)
{
- is.readOptionalValue(p.tag, obj => params[p.pos + offset] = obj, p.type);
+ is.readOptionalValue(p.tag,
+ obj =>
+ {
+ params[p.pos + offset] = obj;
+ },
+ p.type);
}
else
{
params[p.pos + offset] = p.type.readOptional(is, p.tag);
}
}
+ else if(p.isObject)
+ {
+ is.readValue(obj =>
+ {
+ params[p.pos + offset] = obj;
+ },
+ p.type);
+ }
else
{
- if(p.isObject)
- {
- is.readValue(obj => params[p.pos + offset] = obj, p.type);
- }
- else
- {
- params[p.pos + offset] = p.type.read(is);
- }
+ params[p.pos + offset] = p.type.read(is);
}
};
@@ -277,7 +283,7 @@ function dispatchImpl(servant, op, incomingAsync, current)
// Check to make sure the servant implements the operation.
//
const method = servant[op.servantMethod];
- if(method === undefined || typeof(method) !== "function")
+ if(method === undefined || typeof method !== "function")
{
throw new Ice.UnknownException("servant for identity " + current.adapter.getCommunicator().identityToString(current.id) +
" does not define operation `" + op.servantMethod + "'");
@@ -492,10 +498,8 @@ function addProxyOperation(proxyType, name, data)
let op = null;
- proxyType.prototype[method] = function()
+ proxyType.prototype[method] = function(...args)
{
- const args = arguments;
-
//
// Parse the operation data on the first invocation of a proxy method.
//
@@ -524,7 +528,7 @@ function addProxyOperation(proxyType, name, data)
{
if(!p.type.validate(v))
{
- throw new Ice.MarshalException("invalid value for argument " + (i + 1) +
+ throw new Ice.MarshalException("invalid value for argument " + (i + 1) +
" in operation `" + op.servantMethod + "'");
}
}
@@ -558,8 +562,8 @@ function addProxyOperation(proxyType, name, data)
return results.length == 1 ? results[0] : results;
};
}
- return Ice.ObjectPrx._invoke(this, op.name, op.sendMode, op.format, ctx, marshalFn, unmarshalFn,
- op.exceptions, Array.prototype.slice.call(args));
+ return Ice.ObjectPrx._invoke(this, op.name, op.sendMode, op.format, ctx, marshalFn, unmarshalFn,
+ op.exceptions, Array.prototype.slice.call(args));
};
}
@@ -578,7 +582,7 @@ Slice.defineOperations = function(classType, proxyType, ids, pos, ops)
//
const method = getServantMethod(classType, current.operation);
- if(method === undefined || typeof(method) !== 'function')
+ if(method === undefined || typeof method !== 'function')
{
throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);
}
@@ -633,7 +637,7 @@ Slice.defineOperations = function(classType, proxyType, ids, pos, ops)
}
Object.defineProperty(proxyType, "_id", {
- get: function(){ return ids[pos]; }
+ get: () => ids[pos]
});
}
};
@@ -643,10 +647,10 @@ Slice.defineOperations = function(classType, proxyType, ids, pos, ops)
//
Slice.defineOperations(Ice.Object, Ice.ObjectPrx, ["::Ice::Object"], 0,
{
- "ice_ping": [, 1, 1, , , , , ],
- "ice_isA": [, 1, 1, , [1], [[7]], , ],
- "ice_id": [, 1, 1, , [7], , , ],
- "ice_ids": [, 1, 1, , ["Ice.StringSeqHelper"], , , ]
+ ice_ping: [undefined, 1, 1, undefined, undefined, undefined, undefined, undefined],
+ ice_isA: [undefined, 1, 1, undefined, [1], [[7]], undefined, undefined],
+ ice_id: [undefined, 1, 1, undefined, [7], undefined, undefined, undefined],
+ ice_ids: [undefined, 1, 1, undefined, ["Ice.StringSeqHelper"], undefined, undefined, undefined]
});
module.exports.Ice = Ice;
diff --git a/js/src/Ice/OutgoingAsync.js b/js/src/Ice/OutgoingAsync.js
index 0fdfe1cb794..c8fe3a4d6e3 100644
--- a/js/src/Ice/OutgoingAsync.js
+++ b/js/src/Ice/OutgoingAsync.js
@@ -124,7 +124,7 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase
{
try
{
- this._sent = false;
+ this._sent = false;
this._handler = this._proxy._getRequestHandler();
if((this._handler.sendAsyncRequest(this) & AsyncStatus.Sent) > 0)
{
@@ -184,7 +184,7 @@ class ProxyOutgoingAsyncBase extends OutgoingAsyncBase
handleException(ex)
{
- const interval = { value: 0 };
+ const interval = {value: 0};
this._cnt = this._proxy._handleException(ex, this._handler, this._mode, this._sent, interval, this._cnt);
return interval.value;
}
@@ -232,7 +232,7 @@ class OutgoingAsync extends ProxyOutgoingAsyncBase
}
else
{
- Ice.StringSeqHelper.write(this._os, [ facet ]);
+ Ice.StringSeqHelper.write(this._os, [facet]);
}
this._os.writeString(this._operation);
@@ -525,11 +525,6 @@ class ProxyFlushBatch extends ProxyOutgoingAsyncBase
class ProxyGetConnection extends ProxyOutgoingAsyncBase
{
- constructor(prx, operation)
- {
- super(prx, operation);
- }
-
invokeRemote(connection, response)
{
this.markFinished(true, r => r.resolve(connection));
diff --git a/js/src/Ice/OutgoingConnectionFactory.js b/js/src/Ice/OutgoingConnectionFactory.js
index 79ad1327686..a2ef3c054b2 100644
--- a/js/src/Ice/OutgoingConnectionFactory.js
+++ b/js/src/Ice/OutgoingConnectionFactory.js
@@ -202,14 +202,18 @@ class OutgoingConnectionFactory
applyOverrides(endpts)
{
const defaultsAndOverrides = this._instance.defaultsAndOverrides();
- return endpts.map(endpoint =>
- {
- //
- // Modify endpoints with overrides.
- //
- return defaultsAndOverrides.overrideTimeout ?
- endpoint.changeTimeout(defaultsAndOverrides.overrideTimeoutValue) : endpoint;
- });
+ return endpts.map(
+ endpoint =>
+ {
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ return endpoint.changeTimeout(defaultsAndOverrides.overrideTimeoutValue);
+ }
+ else
+ {
+ return endpoint;
+ }
+ });
}
findConnectionByEndpoint(endpoints)
@@ -410,12 +414,9 @@ class OutgoingConnectionFactory
connectionCallbacks.push(cc);
}
}
- else
+ else if(callbacks.indexOf(cc) === -1)
{
- if(callbacks.indexOf(cc) === -1)
- {
- callbacks.push(cc);
- }
+ callbacks.push(cc);
}
});
}
@@ -465,12 +466,9 @@ class OutgoingConnectionFactory
failedCallbacks.push(cc);
}
}
- else
+ else if(callbacks.indexOf(cc) === -1)
{
- if(callbacks.indexOf(cc) === -1)
- {
- callbacks.push(cc);
- }
+ callbacks.push(cc);
}
});
}
@@ -559,16 +557,13 @@ class OutgoingConnectionFactory
{
s.push("\n");
}
+ else if(hasMore)
+ {
+ s.push(", trying next endpoint\n");
+ }
else
{
- if(hasMore)
- {
- s.push(", trying next endpoint\n");
- }
- else
- {
- s.push(" and no more endpoints to try\n");
- }
+ s.push(" and no more endpoints to try\n");
}
s.push(ex.toString());
this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join(""));
@@ -586,16 +581,13 @@ class OutgoingConnectionFactory
{
s.push("\n");
}
+ else if(hasMore)
+ {
+ s.push(", trying next endpoint\n");
+ }
else
{
- if(hasMore)
- {
- s.push(", trying next endpoint\n");
- }
- else
- {
- s.push(" and no more endpoints to try\n");
- }
+ s.push(" and no more endpoints to try\n");
}
s.push(ex.toString());
this._instance.initializationData().logger.trace(traceLevels.networkCat, s.join(""));
@@ -831,7 +823,7 @@ class ConnectCallback
nextEndpoint()
{
- const start = (connection) =>
+ const start = connection =>
{
connection.start().then(
() =>
diff --git a/js/src/Ice/Promise.js b/js/src/Ice/Promise.js
index 07469f02e55..0c4b5a1abfc 100644
--- a/js/src/Ice/Promise.js
+++ b/js/src/Ice/Promise.js
@@ -14,7 +14,8 @@ class P extends Promise
{
constructor(cb)
{
- let res, rej;
+ let res;
+ let rej;
super((resolve, reject) =>
{
res = resolve;
@@ -33,8 +34,8 @@ class P extends Promise
finally(cb)
{
return this.then(
- (value) => P.resolve(cb()).then(() => value),
- (reason) => P.resolve(cb()).then(() => { throw reason; }));
+ value => P.resolve(cb()).then(() => value),
+ reason => P.resolve(cb()).then(() => { throw reason; }));
}
delay(ms)
diff --git a/js/src/Ice/Properties.js b/js/src/Ice/Properties.js
index 6574e7ed064..098d144beca 100644
--- a/js/src/Ice/Properties.js
+++ b/js/src/Ice/Properties.js
@@ -43,7 +43,7 @@ class Properties
//
for(const [key, property] of defaults._properties)
{
- this._properties.set(key, { 'value': property.value, 'used': false });
+ this._properties.set(key, {value: property.value, used: false});
}
}
@@ -212,7 +212,7 @@ class Properties
{
mismatchCase = true;
otherKey = pattern.substr(2);
- otherKey = otherKey.substr(0, otherKey.length -1);
+ otherKey = otherKey.substr(0, otherKey.length - 1);
otherKey = otherKey.replace(/\\/g, "");
break;
}
@@ -242,7 +242,7 @@ class Properties
}
else
{
- this._properties.set(key, { 'value': value, 'used': false });
+ this._properties.set(key, {value: value, used: false});
}
}
else
@@ -452,6 +452,12 @@ class Properties
}
break;
}
+
+ default:
+ {
+ Debug.assert(false);
+ break;
+ }
}
if(finished)
{
diff --git a/js/src/Ice/PropertyNames.js b/js/src/Ice/PropertyNames.js
index 5dc694c7c78..542d3b2889e 100644
--- a/js/src/Ice/PropertyNames.js
+++ b/js/src/Ice/PropertyNames.js
@@ -6,15 +6,17 @@
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Sat Apr 28 20:49:27 2018
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Apr 30 21:00:34 2018
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
+/* eslint comma-dangle: "off" */
+/* eslint array-bracket-newline: "off" */
+/* eslint no-useless-escape: "off" */
+
const Ice = require("../Ice/Property").Ice;
const PropertyNames = {};
const Property = Ice.Property;
-/* jshint -W044*/
-
PropertyNames.IceProps =
[
new Property("/^Ice\.ACM\.Client/", true, null),
@@ -196,8 +198,6 @@ PropertyNames.IceProps =
new Property("/^Ice\.Voip/", false, null),
];
-/* jshint +W044*/
-
PropertyNames.validProps =
[
PropertyNames.IceProps,
diff --git a/js/src/Ice/Protocol.js b/js/src/Ice/Protocol.js
index 5d71e4ecf0a..75a0506214f 100644
--- a/js/src/Ice/Protocol.js
+++ b/js/src/Ice/Protocol.js
@@ -40,10 +40,9 @@ Ice.Protocol_1_0 = new Ice.ProtocolVersion(1, 0);
Protocol.headerSize = 14;
//
-// The magic number at the front of each message
+// The magic number at the front of each message ['I', 'c', 'e', 'P']
//
-//Protocol.magic = [ 0x49, 0x63, 0x65, 0x50 ]; // 'I', 'c', 'e', 'P'
-Protocol.magic = new Uint8Array([ 0x49, 0x63, 0x65, 0x50 ]); // 'I', 'c', 'e', 'P'
+Protocol.magic = new Uint8Array([0x49, 0x63, 0x65, 0x50]);
//
// The current Ice protocol and encoding version
@@ -89,7 +88,7 @@ Protocol.requestHdr = new Uint8Array([
Protocol.requestMsg,
0, // Compression status.
0, 0, 0, 0, // Message size (placeholder).
- 0, 0, 0, 0 // Request ID (placeholder).
+ 0, 0, 0, 0 // Request ID (placeholder).
]);
Protocol.requestBatchHdr = new Uint8Array([
@@ -104,7 +103,7 @@ Protocol.requestBatchHdr = new Uint8Array([
Protocol.requestBatchMsg,
0, // Compression status.
0, 0, 0, 0, // Message size (placeholder).
- 0, 0, 0, 0 // Number of requests in batch (placeholder).
+ 0, 0, 0, 0 // Number of requests in batch (placeholder).
]);
Protocol.replyHdr = new Uint8Array([
@@ -242,25 +241,25 @@ Ice.protocolVersionToString = function(v)
};
/**
-* Converts an encoding version to a string.
-*
-* @param v The encoding version to convert.
-*
-* @return The converted string.
-**/
+ * Converts an encoding version to a string.
+ *
+ * @param v The encoding version to convert.
+ *
+ * @return The converted string.
+ **/
Ice.encodingVersionToString = function(v)
{
return majorMinorToString(v.major, v.minor);
};
-Protocol.OPTIONAL_END_MARKER = 0xFF;
-Protocol.FLAG_HAS_TYPE_ID_STRING = (1<<0);
-Protocol.FLAG_HAS_TYPE_ID_INDEX = (1<<1);
-Protocol.FLAG_HAS_TYPE_ID_COMPACT = (1<<1 | 1<<0);
-Protocol.FLAG_HAS_OPTIONAL_MEMBERS = (1<<2);
-Protocol.FLAG_HAS_INDIRECTION_TABLE = (1<<3);
-Protocol.FLAG_HAS_SLICE_SIZE = (1<<4);
-Protocol.FLAG_IS_LAST_SLICE = (1<<5);
+Protocol.OPTIONAL_END_MARKER = 0xFF;
+Protocol.FLAG_HAS_TYPE_ID_STRING = (1 << 0);
+Protocol.FLAG_HAS_TYPE_ID_INDEX = (1 << 1);
+Protocol.FLAG_HAS_TYPE_ID_COMPACT = (1 << 1 | 1 << 0);
+Protocol.FLAG_HAS_OPTIONAL_MEMBERS = (1 << 2);
+Protocol.FLAG_HAS_INDIRECTION_TABLE = (1 << 3);
+Protocol.FLAG_HAS_SLICE_SIZE = (1 << 4);
+Protocol.FLAG_IS_LAST_SLICE = (1 << 5);
Ice.Protocol = Protocol;
module.exports.Ice = Ice;
diff --git a/js/src/Ice/ProxyFactory.js b/js/src/Ice/ProxyFactory.js
index fbd81e026af..ebd5f0e23b9 100644
--- a/js/src/Ice/ProxyFactory.js
+++ b/js/src/Ice/ProxyFactory.js
@@ -64,7 +64,7 @@ class ProxyFactory
}
else
{
- this._retryIntervals = [ 0 ];
+ this._retryIntervals = [0];
}
}
diff --git a/js/src/Ice/Reference.js b/js/src/Ice/Reference.js
index c7e8e4ededa..6e3771eae87 100644
--- a/js/src/Ice/Reference.js
+++ b/js/src/Ice/Reference.js
@@ -454,7 +454,7 @@ class ReferenceFactory
}
else
{
- quote = s.indexOf('\"', ++quote);
+ quote = s.indexOf("\"", ++quote);
if(quote == -1)
{
break;
@@ -1329,6 +1329,12 @@ class Reference
s.push(" -D");
break;
}
+
+ default:
+ {
+ Debug.assert(false);
+ break;
+ }
}
if(this._secure)
@@ -1634,6 +1640,12 @@ class FixedReference extends Reference
}
break;
}
+
+ default:
+ {
+ Debug.assert(false);
+ break;
+ }
}
//
@@ -1992,8 +2004,8 @@ class RoutableReference extends Reference
properties.set(prefix + ".EndpointSelection",
this._endpointSelection === EndpointSelectionType.Random ? "Random" : "Ordered");
- properties.set(prefix + ".LocatorCacheTimeout", "" + this._locatorCacheTimeout);
- properties.set(prefix + ".InvocationTimeout", "" + this.getInvocationTimeout());
+ properties.set(prefix + ".LocatorCacheTimeout", String(this._locatorCacheTimeout));
+ properties.set(prefix + ".InvocationTimeout", String(this.getInvocationTimeout()));
if(this._routerInfo !== null)
{
@@ -2265,6 +2277,12 @@ class RoutableReference extends Reference
endpoints = endpoints.filter(e => e.datagram());
break;
}
+
+ default:
+ {
+ Debug.assert(false);
+ break;
+ }
}
//
@@ -2361,7 +2379,7 @@ class RoutableReference extends Reference
// connection for one of the endpoints.
//
const cb = new CreateConnectionCallback(this, endpoints, promise);
- factory.create([ endpoints[0] ], true, this.getEndpointSelection()).then(
+ factory.create([endpoints[0]], true, this.getEndpointSelection()).then(
connection => cb.setConnection(connection)).catch(ex => cb.setException(ex));
}
return promise;
@@ -2410,9 +2428,9 @@ class CreateConnectionCallback
}
this.ref.getInstance().outgoingConnectionFactory().create(
- [ this.endpoints[this.i] ],
+ [this.endpoints[this.i]],
this.i != this.endpoints.length - 1,
- this.ref.getEndpointSelection()).then(connection => this.setConnection(connection))
- .catch(ex => this.setException(ex));
+ this.ref.getEndpointSelection()).then(
+ connection => this.setConnection(connection)).catch(ex => this.setException(ex));
}
}
diff --git a/js/src/Ice/RouterInfo.js b/js/src/Ice/RouterInfo.js
index dd34a02669e..e14d42a52ab 100644
--- a/js/src/Ice/RouterInfo.js
+++ b/js/src/Ice/RouterInfo.js
@@ -79,7 +79,7 @@ class RouterInfo
}
else
{
- this._router.getClientProxy().then((result) =>
+ this._router.getClientProxy().then(result =>
this.setClientEndpoints(result[0],
result[1] !== undefined ? result[1] : true,
promise)).catch(promise.reject);
@@ -115,7 +115,7 @@ class RouterInfo
}
else
{
- return this._router.addProxies([ proxy ]).then(
+ return this._router.addProxies([proxy]).then(
evictedProxies =>
{
this.addAndEvictProxies(proxy, evictedProxies);
diff --git a/js/src/Ice/ServantManager.js b/js/src/Ice/ServantManager.js
index b858a0ecf80..b33a32b556b 100644
--- a/js/src/Ice/ServantManager.js
+++ b/js/src/Ice/ServantManager.js
@@ -30,9 +30,12 @@ class ServantManager
{
this._instance = instance;
this._adapterName = adapterName;
- this._servantMapMap = new HashMap(HashMap.compareEquals); // Map<Ice.Identity, Map<String, Ice.Object> >
- this._defaultServantMap = new Map(); // Map<String, Ice.Object>
- this._locatorMap = new Map(); // Map<String, Ice.ServantLocator>
+ // Map<Ice.Identity, Map<String, Ice.Object> >
+ this._servantMapMap = new HashMap(HashMap.compareEquals);
+ // Map<String, Ice.Object>
+ this._defaultServantMap = new Map();
+ // Map<String, Ice.ServantLocator>
+ this._locatorMap = new Map();
}
addServant(servant, ident, facet)
@@ -50,19 +53,16 @@ class ServantManager
m = new Map();
this._servantMapMap.set(ident, m);
}
- else
+ else if(m.has(facet))
{
- if(m.has(facet))
+ const ex = new Ice.AlreadyRegisteredException();
+ ex.id = Ice.identityToString(ident, this._instance.toStringMode());
+ ex.kindOfObject = "servant";
+ if(facet.length > 0)
{
- const ex = new Ice.AlreadyRegisteredException();
- ex.id = Ice.identityToString(ident, this._instance.toStringMode());
- ex.kindOfObject = "servant";
- if(facet.length > 0)
- {
- ex.id += " -f " + StringUtil.escapeString(facet, "", this._instance.toStringMode());
- }
- throw ex;
+ ex.id += " -f " + StringUtil.escapeString(facet, "", this._instance.toStringMode());
}
+ throw ex;
}
m.set(facet, servant);
@@ -153,14 +153,6 @@ class ServantManager
findServant(ident, facet)
{
- //
- // This assert is not valid if the adapter dispatch incoming
- // requests from bidir connections. This method might be called if
- // requests are received over the bidir connection after the
- // adapter was deactivated.
- //
- //Debug.assert(this._instance !== null); // Must not be called after destruction.
-
if(facet === null)
{
facet = "";
@@ -207,14 +199,6 @@ class ServantManager
hasServant(ident)
{
- //
- // This assert is not valid if the adapter dispatch incoming
- // requests from bidir connections. This method might be called if
- // requests are received over the bidir connection after the
- // adapter was deactivated.
- //
- //Debug.assert(this._instance !== null); // Must not be called after destruction.
-
const m = this._servantMapMap.get(ident);
if(m === undefined)
{
@@ -260,14 +244,6 @@ class ServantManager
findServantLocator(category)
{
- //
- // This assert is not valid if the adapter dispatch incoming
- // requests from bidir connections. This method might be called if
- // requests are received over the bidir connection after the
- // adapter was deactivated.
- //
- //Debug.assert(this._instance !== null); // Must not be called after destruction.
-
const l = this._locatorMap.get(category);
return l === undefined ? null : l;
}
diff --git a/js/src/Ice/Stream.js b/js/src/Ice/Stream.js
index eb8fdd1dd45..573ad9bea12 100644
--- a/js/src/Ice/Stream.js
+++ b/js/src/Ice/Stream.js
@@ -163,7 +163,7 @@ class EncapsDecoder
const obj = this._unmarshaledMap.get(index);
if(obj !== undefined && obj !== null)
{
- cb.call(null, obj);
+ cb(obj);
return;
}
@@ -303,7 +303,7 @@ class EncapsDecoder10 extends EncapsDecoder
if(index === 0)
{
- cb.call(null, null);
+ cb(null);
}
else
{
@@ -384,7 +384,7 @@ class EncapsDecoder10 extends EncapsDecoder
this._skipFirstSlice = true;
}
- endInstance(/*preserve*/)
+ endInstance(preserve)
{
//
// Read the Ice::Object slice.
@@ -558,7 +558,7 @@ class EncapsDecoder11 extends EncapsDecoder
{
if(cb !== null)
{
- cb.call(null, null);
+ cb(null);
}
}
else if(this._current !== null && (this._current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) !== 0)
@@ -793,25 +793,19 @@ class EncapsDecoder11 extends EncapsDecoder
Debug.assert(this._current.sliceSize >= 4);
this._stream.skip(this._current.sliceSize - 4);
}
+ else if(this._current.sliceType === SliceType.ValueSlice)
+ {
+ throw new Ice.NoValueFactoryException("no value factory found and compact format prevents slicing " +
+ "(the sender should use the sliced format instead)",
+ this._current.typeId);
+ }
+ else if(this._current.typeId.indexOf("::") === 0)
+ {
+ throw new Ice.UnknownUserException(this._current.typeId.substring(2));
+ }
else
{
- if(this._current.sliceType === SliceType.ValueSlice)
- {
- throw new Ice.NoValueFactoryException("no value factory found and compact format prevents slicing " +
- "(the sender should use the sliced format instead)",
- this._current.typeId);
- }
- else
- {
- if(this._current.typeId.indexOf("::") === 0)
- {
- throw new Ice.UnknownUserException(this._current.typeId.substring(2));
- }
- else
- {
- throw new Ice.UnknownUserException(this._current.typeId);
- }
- }
+ throw new Ice.UnknownUserException(this._current.typeId);
}
//
@@ -998,7 +992,7 @@ class EncapsDecoder11 extends EncapsDecoder
if(cb !== null)
{
- cb.call(null, v);
+ cb(v);
}
return index;
@@ -1067,7 +1061,7 @@ EncapsDecoder11.InstanceData = class
// Instance attributes
this.sliceType = null;
this.skipFirstSlice = false;
- this.slices = null; // Preserved slices. Ice.SliceInfo[]
+ this.slices = null; // Preserved slices. Ice.SliceInfo[]
this.indirectionTables = null; // int[][]
// Slice attributes
@@ -1832,14 +1826,7 @@ class InputStream
readValue(cb, T)
{
this.initEncaps();
- //
- // BUGFIX:
- // With Chrome on Linux the invocation of readValue on the decoder sometimes
- // calls InputStream.readValue with the decoder object as this param.
- // Use call instead of directly invoking the method to workaround this bug.
- //
- this._encapsStack.decoder.readValue.call(
- this._encapsStack.decoder,
+ this._encapsStack.decoder.readValue(
cb === null ? null : obj =>
{
if(obj !== null && !(obj instanceof T))
@@ -1923,29 +1910,50 @@ class InputStream
switch(format)
{
case OptionalFormat.F1:
+ {
this.skip(1);
break;
+ }
case OptionalFormat.F2:
+ {
this.skip(2);
break;
+ }
case OptionalFormat.F4:
+ {
this.skip(4);
break;
+ }
case OptionalFormat.F8:
+ {
this.skip(8);
break;
+ }
case OptionalFormat.Size:
+ {
this.skipSize();
break;
+ }
case OptionalFormat.VSize:
+ {
this.skip(this.readSize());
break;
+ }
case OptionalFormat.FSize:
+ {
this.skip(this.readInt());
break;
+ }
case OptionalFormat.Class:
+ {
this.readValue(null, Ice.Value);
break;
+ }
+ default:
+ {
+ Debug.assert(false);
+ break;
+ }
}
}
@@ -2027,8 +2035,7 @@ class InputStream
createUserException(id)
{
- let userEx = null, Class;
-
+ let userEx = null;
try
{
const typeId = id.length > 2 ? id.substr(2).replace(/::/g, ".") : "";
@@ -2261,7 +2268,7 @@ class EncapsEncoder10 extends EncapsEncoder
{
super(stream, encaps);
this._sliceType = SliceType.NoSlice;
- this._writeSlice = 0; // Position of the slice data members
+ this._writeSlice = 0; // Position of the slice data members
this._valueIdIndex = 0;
this._toBeMarshaledMap = new Map(); // Map<Ice.Value, Integer>();
}
@@ -2746,7 +2753,7 @@ EncapsEncoder11.InstanceData = class
// Slice attributes
this.sliceFlags = 0;
- this.writeSlice = 0; // Position of the slice data members
+ this.writeSlice = 0; // Position of the slice data members
this.sliceFlagsPos = 0; // Position of the slice flags
this.indirectionTable = null; // Ice.Value[]
this.indirectionMap = null; // Map<Ice.Value, int>
@@ -3487,7 +3494,10 @@ Ice.ObjectHelper = class
static read(is)
{
let o;
- is.readValue(v => o = v, Ice.Value);
+ is.readValue(v =>
+ {
+ o = v;
+ }, Ice.Value);
return o;
}
@@ -3499,7 +3509,10 @@ Ice.ObjectHelper = class
static readOptional(is, tag)
{
let o;
- is.readOptionalValue(tag, v => o = v, Ice.Value);
+ is.readOptionalValue(tag, v =>
+ {
+ o = v;
+ }, Ice.Value);
return o;
}
diff --git a/js/src/Ice/StreamHelpers.js b/js/src/Ice/StreamHelpers.js
index 3fc8c132b83..58077da5e47 100644
--- a/js/src/Ice/StreamHelpers.js
+++ b/js/src/Ice/StreamHelpers.js
@@ -154,11 +154,10 @@ class SequenceHelper
// Speacialization optimized for ByteSeq
const byteSeqHelper = new SequenceHelper();
-byteSeqHelper.write = function(os, v) { return os.writeByteSeq(v); };
-byteSeqHelper.read = function(is) { return is.readByteSeq(); };
-defineProperty(byteSeqHelper, "elementHelper", {
- get: function(){ return Ice.ByteHelper; }
-});
+byteSeqHelper.write = (os, v) => os.writeByteSeq(v);
+byteSeqHelper.read = is => is.readByteSeq();
+
+defineProperty(byteSeqHelper, "elementHelper", {get: () => Ice.ByteHelper});
StreamHelpers.VSizeContainer1OptHelper.call(byteSeqHelper);
// Read method for value sequences
@@ -170,7 +169,10 @@ const valueSequenceHelperRead = function(is)
const elementType = this.elementType;
const readValueAtIndex = function(idx)
{
- is.readValue(obj => v[idx] = obj, elementType);
+ is.readValue(obj =>
+ {
+ v[idx] = obj;
+ }, elementType);
};
for(let i = 0; i < sz; ++i)
@@ -204,15 +206,11 @@ StreamHelpers.generateSeqHelper = function(elementHelper, fixed, elementType)
StreamHelpers.FSizeOptHelper.call(helper);
}
- defineProperty(helper, "elementHelper", {
- get: function(){ return elementHelper; }
- });
+ defineProperty(helper, "elementHelper", {get: () => elementHelper});
if(elementHelper == Ice.ObjectHelper)
{
- defineProperty(helper, "elementType", {
- get: function(){ return elementType; }
- });
+ defineProperty(helper, "elementType", {get: () => elementType});
helper.read = valueSequenceHelperRead;
}
@@ -301,23 +299,28 @@ StreamHelpers.generateDictHelper = function(keyHelper, valueHelper, fixed, value
StreamHelpers.FSizeOptHelper.call(helper);
}
- defineProperty(helper, "mapType", {
- get: function(){ return mapType; }
- });
+ defineProperty(helper,
+ "mapType",
+ {
+ get: () => mapType
+ });
- defineProperty(helper, "keyHelper", {
- get: function(){ return keyHelper; }
- });
+ defineProperty(helper, "keyHelper",
+ {
+ get: () => keyHelper
+ });
- defineProperty(helper, "valueHelper", {
- get: function(){ return valueHelper; }
- });
+ defineProperty(helper, "valueHelper",
+ {
+ get: () => valueHelper
+ });
if(valueHelper == Ice.ObjectHelper)
{
- defineProperty(helper, "valueType", {
- get: function(){ return valueType; }
- });
+ defineProperty(helper, "valueType",
+ {
+ get: () => valueType
+ });
helper.read = valueDictionaryHelperRead;
}
diff --git a/js/src/Ice/StringUtil.js b/js/src/Ice/StringUtil.js
index b9edaacd970..3bef1d37639 100644
--- a/js/src/Ice/StringUtil.js
+++ b/js/src/Ice/StringUtil.js
@@ -30,6 +30,7 @@ Ice.StringUtil = class
}
return -1;
}
+
//
// Return the index of the first character in str which does
// not appear in match, starting from start. Returns -1 if none is
@@ -48,6 +49,7 @@ Ice.StringUtil = class
}
return -1;
}
+
//
// Add escape sequences (such as "\n", or "\123") to s
//
@@ -113,6 +115,7 @@ Ice.StringUtil = class
}
return result.join("");
}
+
//
// Remove escape sequences added by escapeString. Throws Error
// for an invalid input string.
@@ -157,6 +160,7 @@ Ice.StringUtil = class
return arr.join("");
}
}
+
//
// Split string helper; returns null for unmatched quotes
//
@@ -220,6 +224,7 @@ Ice.StringUtil = class
return v;
}
+
//
// If a single or double quotation mark is found at the start position,
// then the position of the matching closing quote is returned. If no
@@ -247,6 +252,7 @@ Ice.StringUtil = class
}
return 0; // Not quoted
}
+
static hashCode(s)
{
let hash = 0;
@@ -256,6 +262,7 @@ Ice.StringUtil = class
}
return hash;
}
+
static toInt(s)
{
const n = parseInt(s, 10);
@@ -347,55 +354,52 @@ function encodeChar(c, sb, special, toStringMode)
sb.push('\\');
sb.push(s);
}
- else
+ else if(c < 32 || c > 126)
{
- if(c < 32 || c > 126)
+ if(toStringMode === Ice.ToStringMode.Compat)
{
- if(toStringMode === Ice.ToStringMode.Compat)
+ //
+ // When ToStringMode=Compat, c is a UTF-8 byte
+ //
+ Debug.assert(c < 256);
+ sb.push('\\');
+ const octal = c.toString(8);
+ //
+ // Add leading zeroes so that we avoid problems during
+ // decoding. For example, consider the encoded string
+ // \0013 (i.e., a character with value 1 followed by
+ // the character '3'). If the leading zeroes were omitted,
+ // the result would be incorrectly interpreted by the
+ // decoder as a single character with value 11.
+ //
+ for(let j = octal.length; j < 3; j++)
{
- //
- // When ToStringMode=Compat, c is a UTF-8 byte
- //
- Debug.assert(c < 256);
- sb.push('\\');
- const octal = c.toString(8);
- //
- // Add leading zeroes so that we avoid problems during
- // decoding. For example, consider the encoded string
- // \0013 (i.e., a character with value 1 followed by
- // the character '3'). If the leading zeroes were omitted,
- // the result would be incorrectly interpreted by the
- // decoder as a single character with value 11.
- //
- for(let j = octal.length; j < 3; j++)
- {
- sb.push('0');
- }
- sb.push(octal);
+ sb.push('0');
}
- else if(c < 32 || c == 127 || toStringMode === Ice.ToStringMode.ASCII)
- {
- // append \\unnnn
- sb.push("\\u");
- const hex = c.toString(16);
- for(let j = hex.length; j < 4; j++)
- {
- sb.push('0');
- }
- sb.push(hex);
- }
- else
+ sb.push(octal);
+ }
+ else if(c < 32 || c == 127 || toStringMode === Ice.ToStringMode.ASCII)
+ {
+ // append \\unnnn
+ sb.push("\\u");
+ const hex = c.toString(16);
+ for(let j = hex.length; j < 4; j++)
{
- // keep as is
- sb.push(s);
+ sb.push('0');
}
+ sb.push(hex);
}
else
{
- // printable ASCII character
+ // keep as is
sb.push(s);
}
}
+ else
+ {
+ // printable ASCII character
+ sb.push(s);
+ }
break;
}
}
diff --git a/js/src/Ice/Struct.js b/js/src/Ice/Struct.js
index 96a4a2a3bb2..fa9e6b60a7b 100644
--- a/js/src/Ice/Struct.js
+++ b/js/src/Ice/Struct.js
@@ -97,7 +97,7 @@ function memberHashCode(h, e)
}
else
{
- const t = typeof(e);
+ const t = typeof e;
if(e instanceof String || t == "string")
{
return Ice.HashUtil.addString(h, e);
diff --git a/js/src/Ice/TcpEndpointI.js b/js/src/Ice/TcpEndpointI.js
index 8ce8f6259e1..9d905aa1955 100644
--- a/js/src/Ice/TcpEndpointI.js
+++ b/js/src/Ice/TcpEndpointI.js
@@ -24,7 +24,7 @@ const IceSSL = Ice._ModuleRegistry.require(module, ["../Ice/EndpointInfo"]).IceS
const Debug = Ice.Debug;
const HashUtil = Ice.HashUtil;
const StringUtil = Ice.StringUtil;
-const TcpTransceiver = typeof(Ice.TcpTransceiver) !== "undefined" ? Ice.TcpTransceiver : null;
+const TcpTransceiver = typeof Ice.TcpTransceiver !== "undefined" ? Ice.TcpTransceiver : null;
class TcpEndpointI extends Ice.IPEndpointI
{
diff --git a/js/src/Ice/TcpTransceiver.js b/js/src/Ice/TcpTransceiver.js
index ffad377425a..9ce88207d89 100644
--- a/js/src/Ice/TcpTransceiver.js
+++ b/js/src/Ice/TcpTransceiver.js
@@ -45,6 +45,7 @@ class TcpTransceiver
this._bytesAvailableCallback = bytesAvailableCallback;
this._bytesWrittenCallback = bytesWrittenCallback;
}
+
//
// Returns SocketOperation.None when initialization is complete.
//
@@ -60,9 +61,12 @@ class TcpTransceiver
if(this._state === StateNeedConnect)
{
this._state = StateConnectPending;
- this._fd = net.createConnection({port: this._addr.port,
- host: this._addr.host,
- localAddress: this._sourceAddr});
+ this._fd = net.createConnection(
+ {
+ port: this._addr.port,
+ host: this._addr.host,
+ localAddress: this._sourceAddr
+ });
this._fd.on("connect", () => this.socketConnected());
this._fd.on("data", buf => this.socketBytesAvailable(buf));
@@ -160,6 +164,7 @@ class TcpTransceiver
this._fd = null;
}
}
+
//
// Returns true if all of the data was flushed to the kernel buffer.
//
@@ -183,7 +188,12 @@ class TcpTransceiver
const slice = byteBuffer.b.slice(byteBuffer.position, byteBuffer.position + packetSize);
let sync = true;
- /*jshint -W083 */
+ //
+ // XXX: diasble for compatibility with Node 4.x replace by
+ // Buffer.from when we drop support to Node 4.x
+ //
+
+ /* eslint-disable no-buffer-constructor */
sync = this._fd.write(new Buffer(slice), null, () =>
{
if(!sync)
@@ -191,9 +201,9 @@ class TcpTransceiver
this._bytesWrittenCallback();
}
});
- /*jshint +W083 */
+ /* eslint-enable no-buffer-constructor */
- byteBuffer.position = byteBuffer.position + packetSize;
+ byteBuffer.position += packetSize;
if(!sync)
{
return false; // Wait for callback to be called before sending more data.
@@ -235,8 +245,15 @@ class TcpTransceiver
avail = byteBuffer.remaining;
}
+ //
+ // XXX: diasble for compatibility with Node 4.x replace by
+ // Buffer.from when we drop support to Node 4.x
+ //
+
+ /* eslint-disable no-buffer-constructor */
this._readBuffers[0].copy(new Buffer(byteBuffer.b), byteBuffer.position, this._readPosition,
this._readPosition + avail);
+ /* eslint-enable no-buffer-constructor */
byteBuffer.position += avail;
this._readPosition += avail;
diff --git a/js/src/Ice/Timer.js b/js/src/Ice/Timer.js
index 0cff34b1c46..1842edfe572 100644
--- a/js/src/Ice/Timer.js
+++ b/js/src/Ice/Timer.js
@@ -37,7 +37,7 @@ class Timer
}
const token = this._tokenId++;
const id = Timer.setTimeout(() => this.handleTimeout(token), delay);
- this._tokens.set(token, { callback: callback, id: id, isInterval: false });
+ this._tokens.set(token, {callback: callback, id: id, isInterval: false});
return token;
}
@@ -49,7 +49,7 @@ class Timer
}
const token = this._tokenId++;
const id = Timer.setInterval(() => this.handleInterval(token), period);
- this._tokens.set(token, { callback: callback, id: id, isInterval: true });
+ this._tokens.set(token, {callback: callback, id: id, isInterval: true});
return token;
}
diff --git a/js/src/Ice/ToStringMode.js b/js/src/Ice/ToStringMode.js
index cf40f644434..80ef16066fa 100644
--- a/js/src/Ice/ToStringMode.js
+++ b/js/src/Ice/ToStringMode.js
@@ -8,5 +8,10 @@
// **********************************************************************
const Ice = require("../Ice/EnumBase").Ice;
-Ice.ToStringMode = Ice.Slice.defineEnum([['Unicode', 0], ['ASCII',1], ['Compat',2]]);
+Ice.ToStringMode = Ice.Slice.defineEnum(
+ [
+ ['Unicode', 0],
+ ['ASCII', 1],
+ ['Compat', 2]
+ ]);
module.exports.Ice = Ice;
diff --git a/js/src/Ice/TraceUtil.js b/js/src/Ice/TraceUtil.js
index ab5aa925661..9d4bcca754d 100644
--- a/js/src/Ice/TraceUtil.js
+++ b/js/src/Ice/TraceUtil.js
@@ -224,7 +224,7 @@ function printRequestHeader(s, stream)
{
const key = stream.readString();
const value = stream.readString();
- s.push(key + '/'+ value);
+ s.push(key + '/' + value);
if(sz > 0)
{
s.push(", ");
@@ -241,7 +241,7 @@ function printRequestHeader(s, stream)
function printHeader(s, stream)
{
- stream.readByte(); // Don't bother printing the magic number
+ stream.readByte(); // Don't bother printing the magic number
stream.readByte();
stream.readByte();
stream.readByte();
@@ -348,7 +348,7 @@ function getMessageTypeAsString(type)
case Protocol.closeConnectionMsg:
return "close connection";
case Protocol.validateConnectionMsg:
- return "validate connection";
+ return "validate connection";
default:
return "unknown";
}
@@ -469,7 +469,7 @@ class TraceUtil
}
else
{
- s = "" + n;
+ s = String(n);
}
buf.push(s + " ");
}
diff --git a/js/src/Ice/UnknownSlicedValue.js b/js/src/Ice/UnknownSlicedValue.js
index 6bf779cffee..9ee01b89724 100644
--- a/js/src/Ice/UnknownSlicedValue.js
+++ b/js/src/Ice/UnknownSlicedValue.js
@@ -13,34 +13,34 @@ class SliceInfo
{
constructor()
{
- /**
- * The Slice type ID for this slice.
- **/
+ //
+ // The Slice type ID for this slice.
+ //
this.typeId = "";
- /**
- * The Slice compact type ID for this slice.
- **/
+ //
+ // The Slice compact type ID for this slice.
+ //
this.compactId = -1;
- /**
- * The encoded bytes for this slice, including the leading size integer.
- **/
+ //
+ // The encoded bytes for this slice, including the leading size integer.
+ //
this.bytes = [];
- /**
- * The class instances referenced by this slice.
- **/
+ //
+ // The class instances referenced by this slice.
+ //
this.instances = [];
- /**
- * Whether or not the slice contains optional members.
- **/
+ //
+ // Whether or not the slice contains optional members.
+ //
this.hasOptionalMembers = false;
- /**
- * Whether or not this is the last slice.
- **/
+ //
+ // Whether or not this is the last slice.
+ //
this.isLastSlice = false;
}
}
diff --git a/js/src/Ice/Value.js b/js/src/Ice/Value.js
index 9d40e2fea7c..f5700829193 100644
--- a/js/src/Ice/Value.js
+++ b/js/src/Ice/Value.js
@@ -63,15 +63,21 @@ Ice.Value = class
static read(is)
{
- const v = { value: null };
- is.readValue(o => v.value = o, this);
+ const v = {value: null};
+ is.readValue(o =>
+ {
+ v.value = o;
+ }, this);
return v;
}
static readOptional(is, tag)
{
- const v = { value: undefined };
- is.readOptionalValue(tag, o => v.value = o, this);
+ const v = {value: undefined};
+ is.readOptionalValue(tag, o =>
+ {
+ v.value = o;
+ }, this);
return v;
}
};
@@ -123,7 +129,7 @@ const writeImpl = function(obj, os, type)
}
os.startSlice(type.ice_staticId(),
- Object.prototype.hasOwnProperty.call(type, '_iceCompactId') ? type._iceCompactId : -1 ,
+ Object.prototype.hasOwnProperty.call(type, '_iceCompactId') ? type._iceCompactId : -1,
Object.getPrototypeOf(type) === Ice.Value);
if(type.prototype.hasOwnProperty('_iceWriteMemberImpl'))
{
diff --git a/js/src/Ice/WSEndpoint.js b/js/src/Ice/WSEndpoint.js
index cf588c89050..becfd0c90bd 100644
--- a/js/src/Ice/WSEndpoint.js
+++ b/js/src/Ice/WSEndpoint.js
@@ -213,21 +213,11 @@ class WSEndpoint extends EndpointI
}
return true;
}
-}
-if(typeof(Ice.WSTransceiver) !== "undefined")
-{
- WSEndpoint.prototype.connectable = function()
+ connectable()
{
- return true;
- };
-}
-else
-{
- WSEndpoint.prototype.connectable = function()
- {
- return false;
- };
+ return typeof Ice.WSTransceiver !== "undefined";
+ }
}
Ice.WSEndpoint = WSEndpoint;
diff --git a/js/src/Ice/browser/ModuleRegistry.js b/js/src/Ice/browser/ModuleRegistry.js
index 514e6115d57..4571803fce3 100644
--- a/js/src/Ice/browser/ModuleRegistry.js
+++ b/js/src/Ice/browser/ModuleRegistry.js
@@ -10,9 +10,9 @@
/* global
self : false
*/
-const root = typeof(window) !== "undefined" ? window :
- typeof(global) !== "undefined" ? global :
- typeof(self) !== "undefined" ? self : {};
+const root = typeof window !== "undefined" ? window :
+ typeof global !== "undefined" ? global :
+ typeof self !== "undefined" ? self : {};
/* global
self : true
*/
@@ -25,7 +25,7 @@ class _ModuleRegistry
if(m === undefined)
{
m = {};
- root[name] = m;
+ root[name] = m;
}
return m;
}
diff --git a/js/src/Ice/browser/TimerUtil.js b/js/src/Ice/browser/TimerUtil.js
index 54388e04c66..abe9ddfde97 100644
--- a/js/src/Ice/browser/TimerUtil.js
+++ b/js/src/Ice/browser/TimerUtil.js
@@ -27,44 +27,40 @@ function createTimerObject()
{
static setTimeout(cb, ms)
{
- return setTimeout.apply(null, arguments);
+ return setTimeout(cb, ms);
}
static clearTimeout(id)
{
- return clearTimeout.apply(null, arguments);
+ return clearTimeout(id);
}
- static setInterval()
+ static setInterval(cb, ms)
{
- return setInterval.apply(null, arguments);
+ return setInterval(cb, ms);
}
- static clearInterval()
+ static clearInterval(id)
{
- return clearInterval.apply(null, arguments);
+ return clearInterval(id);
}
- };
- if(typeof(setImmediate) == "function")
- {
- Timer.setImmediate = function()
- {
- return setImmediate.apply(null, arguments);
- };
- }
- else
- {
- Timer.setImmediate = function()
+ static setImmediate(cb)
{
- return setTimeout.apply(null, arguments);
- };
- }
-
+ if(typeof setImmediate == "function")
+ {
+ return setImmediate(cb);
+ }
+ else
+ {
+ return setTimeout(cb);
+ }
+ }
+ };
return Timer;
}
-const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
+const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
const _timers = new Map();
@@ -204,7 +200,7 @@ else if(typeof WorkerGlobalScope !== 'undefined' && this instanceof WorkerGlobal
}
else if(worker === undefined)
{
- const url = URL.createObjectURL(new Blob([workerCode()], {type : 'text/javascript'}));
+ const url = URL.createObjectURL(new Blob([workerCode()], {type: 'text/javascript'}));
worker = new Worker(url);
worker.onmessage = Timer.onmessage;
Ice.Timer = Timer;
diff --git a/js/src/Ice/browser/WSTransceiver.js b/js/src/Ice/browser/WSTransceiver.js
index 5ecee521186..b86f7c65c26 100644
--- a/js/src/Ice/browser/WSTransceiver.js
+++ b/js/src/Ice/browser/WSTransceiver.js
@@ -52,7 +52,7 @@ class WSTransceiver
writeReadyTimeout()
{
const t = Math.round(this._writeReadyTimeout);
- this._writeReadyTimeout += (this._writeReadyTimeout >= 5 ? 5 : 0.2);
+ this._writeReadyTimeout += (this._writeReadyTimeout >= 5 ? 5 : 0.2);
return Math.min(t, 25);
}
@@ -62,6 +62,7 @@ class WSTransceiver
this._bytesAvailableCallback = bytesAvailableCallback;
this._bytesWrittenCallback = bytesWrittenCallback;
}
+
//
// Returns SocketOperation.None when initialization is complete.
//
diff --git a/js/src/IceGrid/IceGrid.js b/js/src/IceGrid/IceGrid.js
index d57ed61575d..b3869d2e065 100644
--- a/js/src/IceGrid/IceGrid.js
+++ b/js/src/IceGrid/IceGrid.js
@@ -7,7 +7,7 @@
//
// **********************************************************************
-var _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry;
+const _ModuleRegistry = require("../Ice/ModuleRegistry").Ice._ModuleRegistry;
module.exports.IceGrid = _ModuleRegistry.require(module,
[
diff --git a/js/src/es5/index.js b/js/src/es5/index.js
index b9f004f3292..d8ed521ab93 100644
--- a/js/src/es5/index.js
+++ b/js/src/es5/index.js
@@ -8,9 +8,9 @@
// **********************************************************************
require("babel-polyfill");
-module.exports.Ice = require("./Ice/Ice").Ice;
-module.exports.IceMX = require("./Ice/Ice").IceMX;
-module.exports.IceSSL = require("./Ice/Ice").IceSSL;
+module.exports.Ice = require("./Ice/Ice").Ice;
+module.exports.IceMX = require("./Ice/Ice").IceMX;
+module.exports.IceSSL = require("./Ice/Ice").IceSSL;
module.exports.Glacier2 = require("./Glacier2/Glacier2").Glacier2;
-module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid;
+module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid;
module.exports.IceStorm = require("./IceStorm/IceStorm").IceStorm;
diff --git a/js/src/index.js b/js/src/index.js
index 59e8553e934..f883df3aa83 100644
--- a/js/src/index.js
+++ b/js/src/index.js
@@ -7,9 +7,9 @@
//
// **********************************************************************
-module.exports.Ice = require("./Ice/Ice").Ice;
-module.exports.IceMX = require("./Ice/Ice").IceMX;
-module.exports.IceSSL = require("./Ice/Ice").IceSSL;
+module.exports.Ice = require("./Ice/Ice").Ice;
+module.exports.IceMX = require("./Ice/Ice").IceMX;
+module.exports.IceSSL = require("./Ice/Ice").IceSSL;
module.exports.Glacier2 = require("./Glacier2/Glacier2").Glacier2;
-module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid;
+module.exports.IceGrid = require("./IceGrid/IceGrid").IceGrid;
module.exports.IceStorm = require("./IceStorm/IceStorm").IceStorm;