diff options
author | Jose <jose@zeroc.com> | 2015-07-21 00:15:51 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2015-07-21 00:15:51 +0200 |
commit | e537d6c0e62bdbf5b272d6542b3345eb972e9612 (patch) | |
tree | 1464b940cb6f2c19e537fd741bf2f31c877163db /js | |
parent | Fix JavaScript test for non connectable endpoints (diff) | |
download | ice-e537d6c0e62bdbf5b272d6542b3345eb972e9612.tar.bz2 ice-e537d6c0e62bdbf5b272d6542b3345eb972e9612.tar.xz ice-e537d6c0e62bdbf5b272d6542b3345eb972e9612.zip |
JSHint minor fixes
Minor fixes to issues reported by JSHint
Diffstat (limited to 'js')
-rw-r--r-- | js/src/Ice/HashMap.js | 5 | ||||
-rw-r--r-- | js/src/Ice/WSEndpoint.js | 1 | ||||
-rw-r--r-- | js/src/Ice/browser/WSTransceiver.js | 10 | ||||
-rw-r--r-- | js/test/Ice/hashmap/Client.js | 30 | ||||
-rw-r--r-- | js/test/Ice/hold/Client.js | 2 | ||||
-rw-r--r-- | js/test/Ice/info/Client.js | 4 | ||||
-rw-r--r-- | js/test/Ice/optionalBidir/InitialI.js | 2 | ||||
-rw-r--r-- | js/test/Ice/proxy/Client.js | 2 |
8 files changed, 39 insertions, 17 deletions
diff --git a/js/src/Ice/HashMap.js b/js/src/Ice/HashMap.js index a662d884a9f..686ac1a95d1 100644 --- a/js/src/Ice/HashMap.js +++ b/js/src/Ice/HashMap.js @@ -364,6 +364,7 @@ var HashMap = Ice.Class({ }, computeHash: function(v) { + var uuid; if(v === 0 || v === -0) { return {key:0, hash:0}; @@ -373,7 +374,7 @@ var HashMap = Ice.Class({ { if(HashMap._null === null) { - var uuid = Ice.generateUUID(); + uuid = Ice.generateUUID(); HashMap._null = {key:uuid, hash:StringUtil.hashCode(uuid)}; } return HashMap._null; @@ -400,7 +401,7 @@ var HashMap = Ice.Class({ { if(HashMap._nan === null) { - var uuid = Ice.generateUUID(); + uuid = Ice.generateUUID(); HashMap._nan = {key:uuid, hash:StringUtil.hashCode(uuid)}; } return HashMap._nan; diff --git a/js/src/Ice/WSEndpoint.js b/js/src/Ice/WSEndpoint.js index 42160ed4a05..6dd2739c8e1 100644 --- a/js/src/Ice/WSEndpoint.js +++ b/js/src/Ice/WSEndpoint.js @@ -19,6 +19,7 @@ Ice.__M.require(module, "../Ice/WSTransceiver", "../Ice/EndpointInfo" ]); +var IceSSL = Ice.__M.module("IceSSL"); var HashUtil = Ice.HashUtil; var StringUtil = Ice.StringUtil; diff --git a/js/src/Ice/browser/WSTransceiver.js b/js/src/Ice/browser/WSTransceiver.js index 781ce22d0cb..2468c111220 100644 --- a/js/src/Ice/browser/WSTransceiver.js +++ b/js/src/Ice/browser/WSTransceiver.js @@ -21,6 +21,7 @@ Ice.__M.require(module, "../Ice/Timer", "../Ice/ConnectionInfo" ]); +var IceSSL = Ice.__M.module("IceSSL"); var Debug = Ice.Debug; var ExUtil = Ice.ExUtil; @@ -184,9 +185,14 @@ var WSTransceiver = Ice.Class({ } var transceiver = this; + var bytesWrittenCallback = function() + { + transceiver._bytesWrittenCallback(0, 0); + }; + if(this._fd.bufferedAmount > 1024) { - Timer.setTimeout(function() { transceiver._bytesWrittenCallback(0, 0); }, 50); + Timer.setTimeout(bytesWrittenCallback, 50); return false; } @@ -216,7 +222,7 @@ var WSTransceiver = Ice.Class({ if(this._fd.bufferedAmount > 0 && packetSize > 0) { - Timer.setTimeout(function() { transceiver._bytesWrittenCallback(0, 0); }, 50); + Timer.setTimeout(bytesWrittenCallback, 50); return false; } } diff --git a/js/test/Ice/hashmap/Client.js b/js/test/Ice/hashmap/Client.js index 96c025b3765..f72f2013bd0 100644 --- a/js/test/Ice/hashmap/Client.js +++ b/js/test/Ice/hashmap/Client.js @@ -32,7 +32,8 @@ }; var h = new Ice.HashMap(keyComparator, valueComparator); - for(var i = 0; i < keys.length; ++i) + var i; + for(i = 0; i < keys.length; ++i) { h.set(keys[i], i); } @@ -40,7 +41,7 @@ // // Test the keys. // - for(var i = 0; i < keys.length; ++i) + for(i = 0; i < keys.length; ++i) { test(h.has(keys[i])); test(h.get(keys[i]) === i); @@ -62,7 +63,7 @@ fill(a, false); var k = h.keys(); test(k.length === keys.length); - for(var i = 0; i < k.length; ++i) + for(i = 0; i < k.length; ++i) { var p = keys.indexOf(k[i]); test(p != -1); @@ -76,7 +77,7 @@ fill(a, false); var v = h.values(); test(v.length === keys.length); - for(var i = 0; i < v.length; ++i) + for(i = 0; i < v.length; ++i) { a[v[i]] = true; } @@ -174,7 +175,8 @@ // var k = []; k.length = 1000; - for(var i = 0; i < k.length; ++i) + var i; + for(i = 0; i < k.length; ++i) { k[i] = i; } @@ -184,7 +186,7 @@ // Test string keys. // k.length = 100; - for(var i = 0; i < k.length; ++i) + for(i = 0; i < k.length; ++i) { k[i] = Ice.generateUUID(); } @@ -203,10 +205,22 @@ // // Test object keys (with hashCode methods and custom key comparator). // + function createObject(i) + { + var obj = + { + key:i, + hashCode:function() + { + return i; + } + }; + return obj; + } k.length = 10; - for(var i = 0; i < k.length; ++i) + for(i = 0; i < k.length; ++i) { - k[i] = {key:i, hashCode:function() { return i; }}; + k[i] = createObject(i); } var eq = function(a, b) { return a.key === b.key; }; testKeys(k, eq, eq); diff --git a/js/test/Ice/hold/Client.js b/js/test/Ice/hold/Client.js index 243ad743eec..cb8a7b7f085 100644 --- a/js/test/Ice/hold/Client.js +++ b/js/test/Ice/hold/Client.js @@ -113,7 +113,7 @@ out.write("testing without serialize mode... "); var result = null; condition.value = true; - all = [] + all = []; return loop(function() { var expected = value; diff --git a/js/test/Ice/info/Client.js b/js/test/Ice/info/Client.js index cd866ca535b..0ad3b57f9ae 100644 --- a/js/test/Ice/info/Client.js +++ b/js/test/Ice/info/Client.js @@ -107,7 +107,7 @@ info = connection.getInfo(); test(!info.incoming); - test(info.adapterName.length == 0); + test(info.adapterName.length === 0); if(connection.type() != "ws" && connection.type() != "wss") { test(info.localPort > 0); @@ -152,7 +152,7 @@ test(ctx.get("ws.Connection") == "Upgrade"); test(ctx.get("ws.Sec-WebSocket-Protocol") == "ice.zeroc.com"); test(ctx.get("ws.Sec-WebSocket-Version") == "13"); - test(ctx.get("ws.Sec-WebSocket-Key") != null); + test(ctx.get("ws.Sec-WebSocket-Key") !== null); } } ); diff --git a/js/test/Ice/optionalBidir/InitialI.js b/js/test/Ice/optionalBidir/InitialI.js index f3d38c8c38f..19d932a195c 100644 --- a/js/test/Ice/optionalBidir/InitialI.js +++ b/js/test/Ice/optionalBidir/InitialI.js @@ -350,7 +350,7 @@ }, opG: function(g, current) { - return g + return g; }, returnOptionalClass: function(req, current) { diff --git a/js/test/Ice/proxy/Client.js b/js/test/Ice/proxy/Client.js index 746b385767f..5796ba5c11d 100644 --- a/js/test/Ice/proxy/Client.js +++ b/js/test/Ice/proxy/Client.js @@ -1033,7 +1033,7 @@ { test(p.ice_getEndpoints()[0].getInfo() instanceof IceSSL.WSSEndpointInfo); } - return p.ice_getConnection() + return p.ice_getConnection(); } ).then( function(con) |