File tree Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Open diff view settings
Expand file tree Collapse file tree 3 files changed +17
-14
lines changed Open diff view settings
Original file line number Diff line number Diff line change 3434 V(builtins) \
3535 V(cares_wrap) \
3636 V(config) \
37+ V(constants) \
3738 V(contextify) \
3839 V(credentials) \
3940 V(encoding_binding) \
@@ -619,7 +620,6 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
619620 Realm* realm = Realm::GetCurrent (args);
620621 Isolate* isolate = realm->isolate ();
621622 HandleScope scope (isolate);
622- Local<Context> context = realm->context ();
623623
624624 CHECK (args[0 ]->IsString ());
625625
@@ -631,10 +631,6 @@ void GetInternalBinding(const FunctionCallbackInfo<Value>& args) {
631631 if (mod != nullptr ) {
632632 exports = InitInternalBinding (realm, mod);
633633 realm->internal_bindings .insert (mod);
634- } else if (!strcmp (*module_v, " constants" )) {
635- exports = Object::New (isolate);
636- CHECK (exports->SetPrototype (context, Null (isolate)).FromJust ());
637- DefineConstants (isolate, exports);
638634 } else {
639635 return THROW_ERR_INVALID_MODULE (isolate, " No such binding: %s" , *module_v);
640636 }
Original file line number Diff line number Diff line change 6363
6464namespace node {
6565
66+ using v8::Context;
67+ using v8::Isolate;
6668using v8::Local;
69+ using v8::Null;
6770using v8::Object;
71+ using v8::Value;
6872
69- namespace {
73+ namespace constants {
7074
7175void DefineErrnoConstants (Local<Object> target) {
7276#ifdef E2BIG
@@ -1270,10 +1274,14 @@ void DefineTraceConstants(Local<Object> target) {
12701274 NODE_DEFINE_CONSTANT (target, TRACE_EVENT_PHASE_LINK_IDS);
12711275}
12721276
1273- } // anonymous namespace
1277+ void CreatePerContextProperties (Local<Object> target,
1278+ Local<Value> unused,
1279+ Local<Context> context,
1280+ void * priv) {
1281+ Isolate* isolate = context->GetIsolate ();
1282+ Environment* env = Environment::GetCurrent (context);
12741283
1275- void DefineConstants (v8::Isolate* isolate, Local<Object> target) {
1276- Environment* env = Environment::GetCurrent (isolate);
1284+ CHECK (target->SetPrototype (env->context (), Null (env->isolate ())).FromJust ());
12771285
12781286 Local<Object> os_constants = Object::New (isolate);
12791287 CHECK (os_constants->SetPrototype (env->context (),
@@ -1353,4 +1361,8 @@ void DefineConstants(v8::Isolate* isolate, Local<Object> target) {
13531361 trace_constants).Check ();
13541362}
13551363
1364+ } // namespace constants
13561365} // namespace node
1366+
1367+ NODE_BINDING_CONTEXT_AWARE_INTERNAL (constants,
1368+ node::constants::CreatePerContextProperties)
Original file line number Diff line number Diff line change 7474#endif // NODE_OPENSSL_DEFAULT_CIPHER_LIST
7575#endif // HAVE_OPENSSL
7676
77- namespace node {
78-
79- void DefineConstants (v8::Isolate* isolate, v8::Local<v8::Object> target);
80- } // namespace node
81-
8277#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
8378
8479#endif // SRC_NODE_CONSTANTS_H_
You can’t perform that action at this time.
0 commit comments