Skip to content

Commit a253704

Browse files
committed
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: #14645 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]>
1 parent 0d3ef5b commit a253704

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/internal/process/next_tick.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function setupNextTick() {
141141
callback(args[0], args[1], args[2]);
142142
break;
143143
default:
144-
callback.apply(null, args);
144+
callback(...args);
145145
}
146146
}
147147
}

test/parallel/test-next-tick.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ process.nextTick((a, b) => {
5151
}, 42, obj);
5252

5353
process.nextTick(function() {
54-
assert.strictEqual(this, null);
54+
assert.strictEqual(this, undefined);
5555
}, 1, 2, 3, 4);
5656

5757
process.nextTick(() => {

0 commit comments

Comments
 (0)