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) {
28002800
28012801#define READONLY_PROPERTY (obj, str, var ) \
28022802 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 (); \
28042807 } while (0 )
28052808
28062809#define READONLY_DONT_ENUM_PROPERTY (obj, str, var ) \
28072810 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 (); \
28122817 } while (0 )
28132818
28142819
Original file line number Diff line number Diff line change @@ -225,13 +225,17 @@ NODE_EXTERN void RunAtExit(Environment* env);
225225#define NODE_DEFINE_CONSTANT (target, constant ) \
226226 do { \
227227 v8::Isolate* isolate = target->GetIsolate (); \
228+ v8::Local<v8::Context> context = isolate->GetCurrentContext (); \
228229 v8::Local<v8::String> constant_name = \
229230 v8::String::NewFromUtf8 (isolate, #constant); \
230231 v8::Local<v8::Number> constant_value = \
231232 v8::Number::New (isolate, static_cast <double >(constant)); \
232233 v8::PropertyAttribute constant_attributes = \
233234 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 (); \
235239 } \
236240 while (0 )
237241
Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ struct sockaddr;
2222 v8::String::NewFromUtf8 (isolate, constant); \
2323 v8::PropertyAttribute constant_attributes = \
2424 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 (); \
2929 } while (0 )
3030
3131namespace node {
You can’t perform that action at this time.
0 commit comments