summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-08-05 18:10:28 -0700
committerRich Trott <rtrott@gmail.com>2017-08-10 09:11:38 -0700
commit2249234fee2b4f0ce204859728135b9767538383 (patch)
tree61e3d7acad2f4ff86dbdb8fd1136c39af2b50de8
parentc6126b1308d5f7a8a06a36a3c1b523268edfd3fe (diff)
downloadandroid-node-v8-2249234fee2b4f0ce204859728135b9767538383.tar.gz
android-node-v8-2249234fee2b4f0ce204859728135b9767538383.tar.bz2
android-node-v8-2249234fee2b4f0ce204859728135b9767538383.zip
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>
-rw-r--r--lib/fs.js2
-rw-r--r--test/parallel/test-fs-mkdtemp.js2
-rw-r--r--test/parallel/test-fs-stat.js2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/fs.js b/lib/fs.js
index d733a0eaa5..7c4e68358b 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -132,7 +132,7 @@ function makeCallback(cb) {
}
return function() {
- return cb.apply(null, arguments);
+ return cb.apply(undefined, arguments);
};
}
diff --git a/test/parallel/test-fs-mkdtemp.js b/test/parallel/test-fs-mkdtemp.js
index 5ce340afa5..38a306b85c 100644
--- a/test/parallel/test-fs-mkdtemp.js
+++ b/test/parallel/test-fs-mkdtemp.js
@@ -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));
diff --git a/test/parallel/test-fs-stat.js b/test/parallel/test-fs-stat.js
index 8a6bb1c624..332a26e9bf 100644
--- a/test/parallel/test-fs-stat.js
+++ b/test/parallel/test-fs-stat.js
@@ -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