summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>2016-12-26 16:42:09 +0530
committerJames M Snell <jasnell@gmail.com>2017-03-22 15:02:43 -0700
commitcaf9ae748b1324c34284b324f2951b91368ca840 (patch)
tree9279dc83f97af9aa417a18e543a2b3eb34db3d8a /lib
parent221b03ad20453f08cef7ac3fcc788b8466edc3ef (diff)
downloadandroid-node-v8-caf9ae748b1324c34284b324f2951b91368ca840.tar.gz
android-node-v8-caf9ae748b1324c34284b324f2951b91368ca840.tar.bz2
android-node-v8-caf9ae748b1324c34284b324f2951b91368ca840.zip
lib,src: make constants not inherit from Object
Make sure `constants` object and all the nested objects don't inherit from `Object.prototype` but from `null`. PR-URL: https://github.com/nodejs/node/pull/10458 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'lib')
-rw-r--r--lib/fs.js4
-rw-r--r--lib/internal/process.js3
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 8c92db957b..3d65b2efa0 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -1058,7 +1058,7 @@ fs.fchmodSync = function(fd, mode) {
return binding.fchmod(fd, modeNum(mode));
};
-if (constants.hasOwnProperty('O_SYMLINK')) {
+if (constants.O_SYMLINK !== undefined) {
fs.lchmod = function(path, mode, callback) {
callback = maybeCallback(callback);
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
@@ -1116,7 +1116,7 @@ fs.chmodSync = function(path, mode) {
return binding.chmod(pathModule._makeLong(path), modeNum(mode));
};
-if (constants.hasOwnProperty('O_SYMLINK')) {
+if (constants.O_SYMLINK !== undefined) {
fs.lchown = function(path, uid, gid, callback) {
callback = maybeCallback(callback);
fs.open(path, constants.O_WRONLY | constants.O_SYMLINK, function(err, fd) {
diff --git a/lib/internal/process.js b/lib/internal/process.js
index a53618fd37..b4fe19093a 100644
--- a/lib/internal/process.js
+++ b/lib/internal/process.js
@@ -201,8 +201,7 @@ function setupSignalHandlers() {
const signalWraps = {};
function isSignal(event) {
- return typeof event === 'string' &&
- lazyConstants().hasOwnProperty(event);
+ return typeof event === 'string' && lazyConstants()[event] !== undefined;
}
// Detect presence of a listener for the special signal types