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:
parent
0d3ef5b0f8
commit
a253704446
@ -141,7 +141,7 @@ function setupNextTick() {
|
||||
callback(args[0], args[1], args[2]);
|
||||
break;
|
||||
default:
|
||||
callback.apply(null, args);
|
||||
callback(...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user