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>
This commit is contained in:
parent
73631bbcc8
commit
9b8837b355
@ -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.
|
||||
|
@ -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)) {
|
||||
|
@ -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);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user