File tree Expand file tree Collapse file tree 8 files changed +22
-12
lines changed Open diff view settings
Expand file tree Collapse file tree 8 files changed +22
-12
lines changed Open diff view settings
Original file line number Diff line number Diff line change @@ -216,7 +216,8 @@ void Agent::InitAdaptor(Environment* env) {
216216 NODE_SET_PROTOTYPE_METHOD (t, " notifyWait" , NotifyWait);
217217 NODE_SET_PROTOTYPE_METHOD (t, " sendCommand" , SendCommand);
218218
219- Local<Object> api = t->GetFunction ()->NewInstance ();
219+ Local<Object> api =
220+ t->GetFunction ()->NewInstance (env->context ()).ToLocalChecked ();
220221 api->SetAlignedPointerInInternalField (0 , this );
221222
222223 api->Set (String::NewFromUtf8 (isolate, " port" ), Integer::New (isolate, port_));
Original file line number Diff line number Diff line change @@ -2989,7 +2989,8 @@ void SetupProcessObject(Environment* env,
29892989 EnvDeleter,
29902990 EnvEnumerator,
29912991 env->as_external ());
2992- Local<Object> process_env = process_env_template->NewInstance ();
2992+ Local<Object> process_env =
2993+ process_env_template->NewInstance (env->context ()).ToLocalChecked ();
29932994 process->Set (env->env_string (), process_env);
29942995
29952996 READONLY_PROPERTY (process, " pid" , Integer::New (env->isolate (), getpid ()));
@@ -4142,7 +4143,8 @@ Environment* CreateEnvironment(Isolate* isolate,
41424143 Local<FunctionTemplate> process_template = FunctionTemplate::New (isolate);
41434144 process_template->SetClassName (FIXED_ONE_BYTE_STRING (isolate, " process" ));
41444145
4145- Local<Object> process_object = process_template->GetFunction ()->NewInstance ();
4146+ Local<Object> process_object =
4147+ process_template->GetFunction ()->NewInstance (context).ToLocalChecked ();
41464148 env->set_process_object (process_object);
41474149
41484150 SetupProcessObject (env, argc, argv, exec_argc, exec_argv);
Original file line number Diff line number Diff line change @@ -176,7 +176,8 @@ class ContextifyContext {
176176 Local<Value> CreateDataWrapper (Environment* env) {
177177 EscapableHandleScope scope (env->isolate ());
178178 Local<Object> wrapper =
179- env->script_data_constructor_function ()->NewInstance ();
179+ env->script_data_constructor_function ()
180+ ->NewInstance (env->context ()).FromMaybe (Local<Object>());
180181 if (wrapper.IsEmpty ())
181182 return scope.Escape (Local<Value>::New (env->isolate (), Local<Value>()));
182183
Original file line number Diff line number Diff line change @@ -442,7 +442,10 @@ Local<Value> BuildStatsObject(Environment* env, const uv_stat_t* s) {
442442
443443 // Call out to JavaScript to create the stats object.
444444 Local<Value> stats =
445- env->fs_stats_constructor_function ()->NewInstance (ARRAY_SIZE (argv), argv);
445+ env->fs_stats_constructor_function ()->NewInstance (
446+ env->context (),
447+ ARRAY_SIZE (argv),
448+ argv).FromMaybe (Local<Value>());
446449
447450 if (stats.IsEmpty ())
448451 return handle_scope.Escape (Local<Object>());
Original file line number Diff line number Diff line change @@ -63,8 +63,8 @@ Local<Object> PipeWrap::Instantiate(Environment* env, AsyncWrap* parent) {
6363 Local<Function> constructor = env->pipe_constructor_template ()->GetFunction ();
6464 CHECK_EQ (false , constructor.IsEmpty ());
6565 Local<Value> ptr = External::New (env->isolate (), parent);
66- Local<Object> instance = constructor-> NewInstance ( 1 , &ptr);
67- CHECK_EQ ( false , instance. IsEmpty () );
66+ Local<Object> instance =
67+ constructor-> NewInstance (env-> context (), 1 , &ptr). ToLocalChecked ( );
6868 return handle_scope.Escape (instance);
6969}
7070
Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ Local<Object> TCPWrap::Instantiate(Environment* env, AsyncWrap* parent) {
5757 Local<Function> constructor = env->tcp_constructor_template ()->GetFunction ();
5858 CHECK_EQ (constructor.IsEmpty (), false );
5959 Local<Value> ptr = External::New (env->isolate (), parent);
60- Local<Object> instance = constructor-> NewInstance ( 1 , &ptr);
61- CHECK_EQ (instance. IsEmpty (), false );
60+ Local<Object> instance =
61+ constructor-> NewInstance (env-> context (), 1 , &ptr). ToLocalChecked ( );
6262 return handle_scope.Escape (instance);
6363}
6464
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ TLSWrap::TLSWrap(Environment* env,
3636 StreamBase* stream,
3737 SecureContext* sc)
3838 : AsyncWrap(env,
39- env->tls_wrap_constructor_function ()->NewInstance(),
39+ env->tls_wrap_constructor_function ()
40+ ->NewInstance(env->context ()).ToLocalChecked(),
4041 AsyncWrap::PROVIDER_TLSWRAP),
4142 SSLWrap<TLSWrap>(env, sc, kind),
4243 StreamBase(env),
@@ -289,7 +290,8 @@ void TLSWrap::EncOut() {
289290 CHECK (write_size_ != 0 && count != 0 );
290291
291292 Local<Object> req_wrap_obj =
292- env ()->write_wrap_constructor_function ()->NewInstance ();
293+ env ()->write_wrap_constructor_function ()
294+ ->NewInstance (env ()->context ()).ToLocalChecked ();
293295 WriteWrap* write_req = WriteWrap::New (env (),
294296 req_wrap_obj,
295297 this ,
Original file line number Diff line number Diff line change @@ -422,7 +422,8 @@ Local<Object> UDPWrap::Instantiate(Environment* env, AsyncWrap* parent) {
422422 CHECK_EQ (env->udp_constructor_function ().IsEmpty (), false );
423423 EscapableHandleScope scope (env->isolate ());
424424 Local<Value> ptr = External::New (env->isolate (), parent);
425- return scope.Escape (env->udp_constructor_function ()->NewInstance (1 , &ptr));
425+ return scope.Escape (env->udp_constructor_function ()
426+ ->NewInstance (env->context (), 1 , &ptr).ToLocalChecked ());
426427}
427428
428429
You can’t perform that action at this time.
0 commit comments