File tree Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Expand file tree Collapse file tree 3 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -2800,15 +2800,20 @@ void StopProfilerIdleNotifier(const FunctionCallbackInfo<Value>& args) {
2800
2800
2801
2801
#define READONLY_PROPERTY (obj, str, var ) \
2802
2802
do { \
2803
- obj->ForceSet (OneByteString (env->isolate (), str), var, v8::ReadOnly); \
2803
+ obj->DefineOwnProperty (env->context (), \
2804
+ OneByteString (env->isolate (), str), \
2805
+ var, \
2806
+ v8::ReadOnly).FromJust (); \
2804
2807
} while (0 )
2805
2808
2806
2809
#define READONLY_DONT_ENUM_PROPERTY (obj, str, var ) \
2807
2810
do { \
2808
- obj->ForceSet (OneByteString (env->isolate (), str), \
2809
- var, \
2810
- static_cast <v8::PropertyAttribute>(v8::ReadOnly | \
2811
- v8::DontEnum)); \
2811
+ obj->DefineOwnProperty (env->context (), \
2812
+ OneByteString (env->isolate (), str), \
2813
+ var, \
2814
+ static_cast <v8::PropertyAttribute>(v8::ReadOnly | \
2815
+ v8::DontEnum)) \
2816
+ .FromJust (); \
2812
2817
} while (0 )
2813
2818
2814
2819
Original file line number Diff line number Diff line change @@ -225,13 +225,17 @@ NODE_EXTERN void RunAtExit(Environment* env);
225
225
#define NODE_DEFINE_CONSTANT (target, constant ) \
226
226
do { \
227
227
v8::Isolate* isolate = target->GetIsolate (); \
228
+ v8::Local<v8::Context> context = isolate->GetCurrentContext (); \
228
229
v8::Local<v8::String> constant_name = \
229
230
v8::String::NewFromUtf8 (isolate, #constant); \
230
231
v8::Local<v8::Number> constant_value = \
231
232
v8::Number::New (isolate, static_cast <double >(constant)); \
232
233
v8::PropertyAttribute constant_attributes = \
233
234
static_cast <v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
234
- (target)->ForceSet (constant_name, constant_value, constant_attributes); \
235
+ (target)->DefineOwnProperty (context, \
236
+ constant_name, \
237
+ constant_value, \
238
+ constant_attributes).FromJust (); \
235
239
} \
236
240
while (0 )
237
241
Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ struct sockaddr;
22
22
v8::String::NewFromUtf8 (isolate, constant); \
23
23
v8::PropertyAttribute constant_attributes = \
24
24
static_cast <v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete); \
25
- target->ForceSet (isolate->GetCurrentContext (), \
26
- constant_name, \
27
- constant_value, \
28
- constant_attributes); \
25
+ target->DefineOwnProperty (isolate->GetCurrentContext (), \
26
+ constant_name, \
27
+ constant_value, \
28
+ constant_attributes). FromJust (); \
29
29
} while (0 )
30
30
31
31
namespace node {
You can’t perform that action at this time.
0 commit comments