process: make this value consistent

The value of `this` for callbacks of `nextTick()` can vary depending on
the number of arguments. Make it consistent.

PR-URL: https://github.com/nodejs/node/pull/14645
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
Rich Trott 2017-08-05 19:10:21 -07:00
parent 0d3ef5b0f8
commit a253704446
2 changed files with 2 additions and 2 deletions

View File

@ -141,7 +141,7 @@ function setupNextTick() {
callback(args[0], args[1], args[2]);
break;
default:
callback.apply(null, args);
callback(...args);
}
}
}

View File

@ -51,7 +51,7 @@ process.nextTick((a, b) => {
}, 42, obj);
process.nextTick(function() {
assert.strictEqual(this, null);
assert.strictEqual(this, undefined);
}, 1, 2, 3, 4);
process.nextTick(() => {