summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2014-09-03 14:24:50 -0700
committerTrevor Norris <trev.norris@gmail.com>2014-09-03 14:24:50 -0700
commit9b8837b3554cb38fe9412922f064529329f5fff7 (patch)
treef72efa93917d9a86d07e3f9c8c5ef339ff291eec /lib
parent73631bbcc83888ec61a0aebf4eff3904e9384a2e (diff)
downloadnodejs-9b8837b3554cb38fe9412922f064529329f5fff7.tar.gz
nodejs-9b8837b3554cb38fe9412922f064529329f5fff7.tar.bz2
nodejs-9b8837b3554cb38fe9412922f064529329f5fff7.zip
src: be more intelligent about use of "arguments"
Use 'use strict' when there are named arguments and the arguments object is passed to apply(). Also pass named arguments to call() when the named argument is modified by the function. Suggested in https://github.com/joyent/node/pull/8302#issuecomment-54331801 Confirmed in https://github.com/joyent/node/pull/8302#issuecomment-54364818 Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/child_process.js3
-rw-r--r--lib/cluster.js2
-rw-r--r--lib/net.js3
3 files changed, 6 insertions, 2 deletions
diff --git a/lib/child_process.js b/lib/child_process.js
index aadac2ed2..23963828c 100644
--- a/lib/child_process.js
+++ b/lib/child_process.js
@@ -454,7 +454,8 @@ function setupChannel(target, channel) {
var obj = handleConversion[message.type];
// convert TCP object to native handle object
- handle = handleConversion[message.type].send.apply(target, arguments);
+ handle =
+ handleConversion[message.type].send.call(target, message, handle);
// If handle was sent twice, or it is impossible to get native handle
// out of it - just send a text without the handle.
diff --git a/lib/cluster.js b/lib/cluster.js
index 0914546b9..c994f433b 100644
--- a/lib/cluster.js
+++ b/lib/cluster.js
@@ -662,6 +662,8 @@ function sendHelper(proc, message, handle, cb) {
// to the callback but intercepts and redirects ACK messages.
function internal(worker, cb) {
return function(message, handle) {
+ 'use strict';
+
if (message.cmd !== 'NODE_CLUSTER') return;
var fn = cb;
if (!util.isUndefined(message.ack)) {
diff --git a/lib/net.js b/lib/net.js
index c2f320d75..ddace957b 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -604,9 +604,10 @@ Socket.prototype.__defineGetter__('localPort', function() {
Socket.prototype.write = function(chunk, encoding, cb) {
+ 'use strict';
if (!util.isString(chunk) && !util.isBuffer(chunk))
throw new TypeError('invalid data');
- return stream.Duplex.prototype.write.call(this, chunk, encoding, cb);
+ return stream.Duplex.prototype.write.apply(this, arguments);
};