Skip to content

Commit 9b8837b

Browse files
committed
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 nodejs/node-v0.x-archive#8302 (comment) Confirmed in nodejs/node-v0.x-archive#8302 (comment) Signed-off-by: Trevor Norris <trev.norris@gmail.com>
1 parent 73631bb commit 9b8837b

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

lib/child_process.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,8 @@ function setupChannel(target, channel) {
454454
var obj = handleConversion[message.type];
455455

456456
// convert TCP object to native handle object
457-
handle = handleConversion[message.type].send.apply(target, arguments);
457+
handle =
458+
handleConversion[message.type].send.call(target, message, handle);
458459

459460
// If handle was sent twice, or it is impossible to get native handle
460461
// out of it - just send a text without the handle.

lib/cluster.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,8 @@ function sendHelper(proc, message, handle, cb) {
662662
// to the callback but intercepts and redirects ACK messages.
663663
function internal(worker, cb) {
664664
return function(message, handle) {
665+
'use strict';
666+
665667
if (message.cmd !== 'NODE_CLUSTER') return;
666668
var fn = cb;
667669
if (!util.isUndefined(message.ack)) {

lib/net.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,9 +604,10 @@ Socket.prototype.__defineGetter__('localPort', function() {
604604

605605

606606
Socket.prototype.write = function(chunk, encoding, cb) {
607+
'use strict';
607608
if (!util.isString(chunk) && !util.isBuffer(chunk))
608609
throw new TypeError('invalid data');
609-
return stream.Duplex.prototype.write.call(this, chunk, encoding, cb);
610+
return stream.Duplex.prototype.write.apply(this, arguments);
610611
};
611612

612613

0 commit comments

Comments
 (0)