fs: invoke callbacks with undefined context
Many callbacks appear to be invoked with `this` set to `undefined` including `fs.stat()`, `fs.lstat()`, and `fs.fstat()`. However, some such as `fs.open()` and `fs.mkdtemp()` invoke their callbacks with `this` set to `null`. Change to `undefined`. 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
c6126b1308
commit
2249234fee
@ -132,7 +132,7 @@ function makeCallback(cb) {
|
||||
}
|
||||
|
||||
return function() {
|
||||
return cb.apply(null, arguments);
|
||||
return cb.apply(undefined, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ assert(common.fileExists(utf8));
|
||||
function handler(err, folder) {
|
||||
assert.ifError(err);
|
||||
assert(common.fileExists(folder));
|
||||
assert.strictEqual(this, null);
|
||||
assert.strictEqual(this, undefined);
|
||||
}
|
||||
|
||||
fs.mkdtemp(path.join(common.tmpDir, 'bar.'), common.mustCall(handler));
|
||||
|
@ -66,7 +66,7 @@ fs.open('.', 'r', undefined, common.mustCall(function(err, fd) {
|
||||
// Confirm that we are not running in the context of the internal binding
|
||||
// layer.
|
||||
// Ref: https://github.com/nodejs/node/commit/463d6bac8b349acc462d345a6e298a76f7d06fb1
|
||||
assert.strictEqual(this, null);
|
||||
assert.strictEqual(this, undefined);
|
||||
}));
|
||||
|
||||
// fstatSync
|
||||
|
Loading…
x
Reference in New Issue
Block a user