Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSakthipriyan Vairamani (thefourtheye) <thechargingvolcano@gmail.com>2016-12-26 14:12:09 +0300
committerJames M Snell <jasnell@gmail.com>2017-03-23 01:02:43 +0300
commitcaf9ae748b1324c34284b324f2951b91368ca840 (patch)
tree9279dc83f97af9aa417a18e543a2b3eb34db3d8a /src/node_constants.cc
parent221b03ad20453f08cef7ac3fcc788b8466edc3ef (diff)
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 'src/node_constants.cc')
-rw-r--r--src/node_constants.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/node_constants.cc b/src/node_constants.cc
index bed87b76498..5bde53fcdf1 100644
--- a/src/node_constants.cc
+++ b/src/node_constants.cc
@@ -1245,12 +1245,31 @@ void DefineZlibConstants(Local<Object> target) {
}
void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
+ Environment* env = Environment::GetCurrent(isolate);
+
Local<Object> os_constants = Object::New(isolate);
+ CHECK(os_constants->SetPrototype(env->context(),
+ Null(env->isolate())).FromJust());
+
Local<Object> err_constants = Object::New(isolate);
+ CHECK(err_constants->SetPrototype(env->context(),
+ Null(env->isolate())).FromJust());
+
Local<Object> sig_constants = Object::New(isolate);
+ CHECK(sig_constants->SetPrototype(env->context(),
+ Null(env->isolate())).FromJust());
+
Local<Object> fs_constants = Object::New(isolate);
+ CHECK(fs_constants->SetPrototype(env->context(),
+ Null(env->isolate())).FromJust());
+
Local<Object> crypto_constants = Object::New(isolate);
+ CHECK(crypto_constants->SetPrototype(env->context(),
+ Null(env->isolate())).FromJust());
+
Local<Object> zlib_constants = Object::New(isolate);
+ CHECK(zlib_constants->SetPrototype(env->context(),
+ Null(env->isolate())).FromJust());
DefineErrnoConstants(err_constants);
DefineWindowsErrorConstants(err_constants);