@@ -11,6 +11,7 @@ namespace node {
1111using  v8::Boolean;
1212using  v8::Context;
1313using  v8::Integer;
14+ using  v8::Isolate;
1415using  v8::Local;
1516using  v8::Number;
1617using  v8::Object;
@@ -25,24 +26,24 @@ using v8::Value;
2526
2627#define  READONLY_BOOLEAN_PROPERTY (str )                                        \
2728  do  {                                                                        \
28-     target->DefineOwnProperty (env-> context (),                                  \
29-                               OneByteString (env-> isolate () , str),              \
30-                               True (env-> isolate ()) , ReadOnly).FromJust ();     \
29+     target->DefineOwnProperty (context,                                         \
30+                               FIXED_ONE_BYTE_STRING ( isolate, str),            \
31+                               True (isolate) , ReadOnly).FromJust ();             \
3132  } while  (0 )
3233
3334#define  READONLY_PROPERTY (obj, name, value )                                   \
3435  do  {                                                                        \
3536    obj->DefineOwnProperty (env->context (),                                    \
36-                            OneByteString (env->isolate (), name),               \
37-                            value,                                             \
38-                            ReadOnly).FromJust ();                              \
37+                            FIXED_ONE_BYTE_STRING (isolate, name),              \
38+                            value, ReadOnly).FromJust ();                       \
3939  } while  (0 )
4040
41- 
4241static  void  InitConfig (Local<Object> target,
4342                       Local<Value> unused,
4443                       Local<Context> context) {
4544  Environment* env = Environment::GetCurrent (context);
45+   Isolate* isolate = env->isolate ();
46+ 
4647#ifdef  NODE_HAVE_I18N_SUPPORT
4748
4849  READONLY_BOOLEAN_PROPERTY (" hasIntl"  );
@@ -51,10 +52,13 @@ static void InitConfig(Local<Object> target,
5152  READONLY_BOOLEAN_PROPERTY (" hasSmallICU"  );
5253#endif   //  NODE_HAVE_SMALL_ICU
5354
54-   target->DefineOwnProperty (env->context (),
55-                             OneByteString (env->isolate (), " icuDataDir"  ),
56-                             OneByteString (env->isolate (), icu_data_dir.data ()))
57-       .FromJust ();
55+   target->DefineOwnProperty (
56+       context,
57+       FIXED_ONE_BYTE_STRING (isolate, " icuDataDir"  ),
58+       String::NewFromUtf8 (isolate,
59+                           icu_data_dir.data (),
60+                           v8::NewStringType::kNormal ).ToLocalChecked (),
61+       ReadOnly).FromJust ();
5862
5963#endif   //  NODE_HAVE_I18N_SUPPORT
6064
@@ -64,37 +68,6 @@ static void InitConfig(Local<Object> target,
6468  if  (config_pending_deprecation)
6569    READONLY_BOOLEAN_PROPERTY (" pendingDeprecation"  );
6670
67-   if  (!config_warning_file.empty ()) {
68-     Local<String> name = OneByteString (env->isolate (), " warningFile"  );
69-     Local<String> value = String::NewFromUtf8 (env->isolate (),
70-                                               config_warning_file.data (),
71-                                               v8::NewStringType::kNormal ,
72-                                               config_warning_file.size ())
73-                                                 .ToLocalChecked ();
74-     target->DefineOwnProperty (env->context (), name, value).FromJust ();
75-   }
76- 
77-   Local<Object> debugOptions = Object::New (env->isolate ());
78- 
79-   target->DefineOwnProperty (env->context (),
80-                             OneByteString (env->isolate (), " debugOptions"  ),
81-                             debugOptions).FromJust ();
82- 
83-   debugOptions->DefineOwnProperty (env->context (),
84-                             OneByteString (env->isolate (), " host"  ),
85-                             String::NewFromUtf8 (env->isolate (),
86-                             debug_options.host_name ().c_str ())).FromJust ();
87- 
88-   debugOptions->DefineOwnProperty (env->context (),
89-                             OneByteString (env->isolate (), " port"  ),
90-                             Integer::New (env->isolate (),
91-                             debug_options.port ())).FromJust ();
92- 
93-   debugOptions->DefineOwnProperty (env->context (),
94-                             OneByteString (env->isolate (), " inspectorEnabled"  ),
95-                             Boolean::New (env->isolate (),
96-                             debug_options.inspector_enabled ())).FromJust ();
97- 
9871  if  (config_expose_internals)
9972    READONLY_BOOLEAN_PROPERTY (" exposeInternals"  );
10073
@@ -104,6 +77,43 @@ static void InitConfig(Local<Object> target,
10477  READONLY_PROPERTY (target,
10578                    " bits"  ,
10679                    Number::New (env->isolate (), 8  * sizeof (intptr_t )));
80+ 
81+   if  (!config_warning_file.empty ()) {
82+     target->DefineOwnProperty (
83+         context,
84+         FIXED_ONE_BYTE_STRING (isolate, " warningFile"  ),
85+         String::NewFromUtf8 (isolate,
86+                             config_warning_file.data (),
87+                             v8::NewStringType::kNormal ).ToLocalChecked (),
88+         ReadOnly).FromJust ();
89+   }
90+ 
91+   Local<Object> debugOptions = Object::New (isolate);
92+ 
93+   target->DefineOwnProperty (
94+       context,
95+       FIXED_ONE_BYTE_STRING (isolate, " debugOptions"  ),
96+       debugOptions, ReadOnly).FromJust ();
97+ 
98+   debugOptions->DefineOwnProperty (
99+       context,
100+       FIXED_ONE_BYTE_STRING (isolate, " host"  ),
101+       String::NewFromUtf8 (isolate,
102+                           debug_options.host_name ().c_str (),
103+                           v8::NewStringType::kNormal ).ToLocalChecked (),
104+       ReadOnly).FromJust ();
105+ 
106+   debugOptions->DefineOwnProperty (
107+       context,
108+       FIXED_ONE_BYTE_STRING (isolate, " port"  ),
109+       Integer::New (isolate, debug_options.port ()),
110+       ReadOnly).FromJust ();
111+ 
112+   debugOptions->DefineOwnProperty (
113+       context,
114+       FIXED_ONE_BYTE_STRING (isolate, " inspectorEnabled"  ),
115+       Boolean::New (isolate, debug_options.inspector_enabled ()), ReadOnly)
116+           .FromJust ();
107117}  //  InitConfig
108118
109119}  //  namespace node
0 commit comments