GeezerVison is showing github.com — src: fix NewInstance deprecation warnings · outsideris/node@ad0ce57
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/debug-agent.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -216,7 +216,8 @@ void Agent::InitAdaptor(Environment* env) { | 216 | 216 | NODE_SET_PROTOTYPE_METHOD(t, "notifyWait", NotifyWait); | 217 | 217 | NODE_SET_PROTOTYPE_METHOD(t, "sendCommand", SendCommand); | 218 | 218 |
| 219 | | - Local<Object> api = t->GetFunction()->NewInstance(); | | 219 | + Local<Object> api = | | 220 | + t->GetFunction()->NewInstance(env->context()).ToLocalChecked(); | 220 | 221 | api->SetAlignedPointerInInternalField(0, this); | 221 | 222 |
| 222 | 223 | api->Set(String::NewFromUtf8(isolate, "port"), Integer::New(isolate, port_)); | |
Collapse file Copy file name to clipboardExpand all lines: src/node.cc +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2989,7 +2989,8 @@ void SetupProcessObject(Environment* env, | 2989 | 2989 | EnvDeleter, | 2990 | 2990 | EnvEnumerator, | 2991 | 2991 | 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(); | 2993 | 2994 | process->Set(env->env_string(), process_env); | 2994 | 2995 |
| 2995 | 2996 | READONLY_PROPERTY(process, "pid", Integer::New(env->isolate(), getpid())); | @@ -4142,7 +4143,8 @@ Environment* CreateEnvironment(Isolate* isolate, | 4142 | 4143 | Local<FunctionTemplate> process_template = FunctionTemplate::New(isolate); | 4143 | 4144 | process_template->SetClassName(FIXED_ONE_BYTE_STRING(isolate, "process")); | 4144 | 4145 |
| 4145 | | - Local<Object> process_object = process_template->GetFunction()->NewInstance(); | | 4146 | + Local<Object> process_object = | | 4147 | + process_template->GetFunction()->NewInstance(context).ToLocalChecked(); | 4146 | 4148 | env->set_process_object(process_object); | 4147 | 4149 |
| 4148 | 4150 | SetupProcessObject(env, argc, argv, exec_argc, exec_argv); | |
Collapse file Copy file name to clipboardExpand all lines: src/node_contextify.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -176,7 +176,8 @@ class ContextifyContext { | 176 | 176 | Local<Value> CreateDataWrapper(Environment* env) { | 177 | 177 | EscapableHandleScope scope(env->isolate()); | 178 | 178 | Local<Object> wrapper = | 179 | | - env->script_data_constructor_function()->NewInstance(); | | 179 | + env->script_data_constructor_function() | | 180 | + ->NewInstance(env->context()).FromMaybe(Local<Object>()); | 180 | 181 | if (wrapper.IsEmpty()) | 181 | 182 | return scope.Escape(Local<Value>::New(env->isolate(), Local<Value>())); | 182 | 183 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_file.cc +4-1Lines changed: 4 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -442,7 +442,10 @@ Local<Value> BuildStatsObject(Environment* env, const uv_stat_t* s) { | 442 | 442 |
| 443 | 443 | // Call out to JavaScript to create the stats object. | 444 | 444 | 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>()); | 446 | 449 |
| 447 | 450 | if (stats.IsEmpty()) | 448 | 451 | return handle_scope.Escape(Local<Object>()); | |
Collapse file Copy file name to clipboardExpand all lines: src/pipe_wrap.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -63,8 +63,8 @@ Local<Object> PipeWrap::Instantiate(Environment* env, AsyncWrap* parent) { | 63 | 63 | Local<Function> constructor = env->pipe_constructor_template()->GetFunction(); | 64 | 64 | CHECK_EQ(false, constructor.IsEmpty()); | 65 | 65 | 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(); | 68 | 68 | return handle_scope.Escape(instance); | 69 | 69 | } | 70 | 70 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/tcp_wrap.cc +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -57,8 +57,8 @@ Local<Object> TCPWrap::Instantiate(Environment* env, AsyncWrap* parent) { | 57 | 57 | Local<Function> constructor = env->tcp_constructor_template()->GetFunction(); | 58 | 58 | CHECK_EQ(constructor.IsEmpty(), false); | 59 | 59 | 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(); | 62 | 62 | return handle_scope.Escape(instance); | 63 | 63 | } | 64 | 64 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/tls_wrap.cc +4-2Lines changed: 4 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -36,7 +36,8 @@ TLSWrap::TLSWrap(Environment* env, | 36 | 36 | StreamBase* stream, | 37 | 37 | SecureContext* sc) | 38 | 38 | : AsyncWrap(env, | 39 | | - env->tls_wrap_constructor_function()->NewInstance(), | | 39 | + env->tls_wrap_constructor_function() | | 40 | + ->NewInstance(env->context()).ToLocalChecked(), | 40 | 41 | AsyncWrap::PROVIDER_TLSWRAP), | 41 | 42 | SSLWrap<TLSWrap>(env, sc, kind), | 42 | 43 | StreamBase(env), | @@ -289,7 +290,8 @@ void TLSWrap::EncOut() { | 289 | 290 | CHECK(write_size_ != 0 && count != 0); | 290 | 291 |
| 291 | 292 | Local<Object> req_wrap_obj = | 292 | | - env()->write_wrap_constructor_function()->NewInstance(); | | 293 | + env()->write_wrap_constructor_function() | | 294 | + ->NewInstance(env()->context()).ToLocalChecked(); | 293 | 295 | WriteWrap* write_req = WriteWrap::New(env(), | 294 | 296 | req_wrap_obj, | 295 | 297 | this, | |
Collapse file Copy file name to clipboardExpand all lines: src/udp_wrap.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -422,7 +422,8 @@ Local<Object> UDPWrap::Instantiate(Environment* env, AsyncWrap* parent) { | 422 | 422 | CHECK_EQ(env->udp_constructor_function().IsEmpty(), false); | 423 | 423 | EscapableHandleScope scope(env->isolate()); | 424 | 424 | 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()); | 426 | 427 | } | 427 | 428 |
| 428 | 429 |
| |
|