diff options
author | Sakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com> | 2016-12-26 16:42:09 +0530 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-03-22 15:02:43 -0700 |
commit | caf9ae748b1324c34284b324f2951b91368ca840 (patch) | |
tree | 9279dc83f97af9aa417a18e543a2b3eb34db3d8a /lib | |
parent | 221b03ad20453f08cef7ac3fcc788b8466edc3ef (diff) | |
download | android-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.js | 4 | ||||
-rw-r--r-- | lib/internal/process.js | 3 |
2 files changed, 3 insertions, 4 deletions
@@ -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 |