diff options
author | Andreas Haas <ahaas@google.com> | 2018-09-21 13:13:35 +0200 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2018-09-24 05:44:28 +0200 |
commit | 7dde560beb736e82b7867130a2d5824544122a60 (patch) | |
tree | c34d8cdc7be51ceee11ed3160e49acd1270319de /test | |
parent | a0c1326257b9679b056d8611ccdee2d6757b0bf0 (diff) | |
download | node-new-7dde560beb736e82b7867130a2d5824544122a60.tar.gz |
src: replace deprecated uses of FunctionTemplate::GetFunction
PR-URL: https://github.com/nodejs/node/pull/22993
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/addons/heap-profiler/binding.cc | 5 | ||||
-rw-r--r-- | test/addons/new-target/binding.cc | 5 | ||||
-rw-r--r-- | test/addons/openssl-binding/binding.cc | 4 | ||||
-rw-r--r-- | test/addons/zlib-binding/binding.cc | 4 | ||||
-rw-r--r-- | test/cctest/test_node_postmortem_metadata.cc | 12 |
5 files changed, 22 insertions, 8 deletions
diff --git a/test/addons/heap-profiler/binding.cc b/test/addons/heap-profiler/binding.cc index 09feefa669..861fb5a80c 100644 --- a/test/addons/heap-profiler/binding.cc +++ b/test/addons/heap-profiler/binding.cc @@ -18,8 +18,11 @@ inline void Test(const v8::FunctionCallbackInfo<v8::Value>& args) { inline void Initialize(v8::Local<v8::Object> binding) { v8::Isolate* const isolate = binding->GetIsolate(); + v8::Local<v8::Context> context = isolate->GetCurrentContext(); binding->Set(v8::String::NewFromUtf8(isolate, "test"), - v8::FunctionTemplate::New(isolate, Test)->GetFunction()); + v8::FunctionTemplate::New(isolate, Test) + ->GetFunction(context) + .ToLocalChecked()); } NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) diff --git a/test/addons/new-target/binding.cc b/test/addons/new-target/binding.cc index 3ae2aca7c2..21b932ae01 100644 --- a/test/addons/new-target/binding.cc +++ b/test/addons/new-target/binding.cc @@ -11,8 +11,11 @@ inline void NewClass(const v8::FunctionCallbackInfo<v8::Value>& args) { inline void Initialize(v8::Local<v8::Object> binding) { auto isolate = binding->GetIsolate(); + auto context = isolate->GetCurrentContext(); binding->Set(v8::String::NewFromUtf8(isolate, "Class"), - v8::FunctionTemplate::New(isolate, NewClass)->GetFunction()); + v8::FunctionTemplate::New(isolate, NewClass) + ->GetFunction(context) + .ToLocalChecked()); } NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) diff --git a/test/addons/openssl-binding/binding.cc b/test/addons/openssl-binding/binding.cc index fa40b3346a..bb00f1e176 100644 --- a/test/addons/openssl-binding/binding.cc +++ b/test/addons/openssl-binding/binding.cc @@ -23,7 +23,9 @@ inline void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Context> context) { auto isolate = context->GetIsolate(); auto key = v8::String::NewFromUtf8(isolate, "randomBytes"); - auto value = v8::FunctionTemplate::New(isolate, RandomBytes)->GetFunction(); + auto value = v8::FunctionTemplate::New(isolate, RandomBytes) + ->GetFunction(context) + .ToLocalChecked(); assert(exports->Set(context, key, value).IsJust()); } diff --git a/test/addons/zlib-binding/binding.cc b/test/addons/zlib-binding/binding.cc index a9a8c14306..1d0af91111 100644 --- a/test/addons/zlib-binding/binding.cc +++ b/test/addons/zlib-binding/binding.cc @@ -46,7 +46,9 @@ inline void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Context> context) { auto isolate = context->GetIsolate(); auto key = v8::String::NewFromUtf8(isolate, "compressBytes"); - auto value = v8::FunctionTemplate::New(isolate, CompressBytes)->GetFunction(); + auto value = v8::FunctionTemplate::New(isolate, CompressBytes) + ->GetFunction(context) + .ToLocalChecked(); assert(exports->Set(context, key, value).IsJust()); } diff --git a/test/cctest/test_node_postmortem_metadata.cc b/test/cctest/test_node_postmortem_metadata.cc index 8e8cbabf00..f0a93f3185 100644 --- a/test/cctest/test_node_postmortem_metadata.cc +++ b/test/cctest/test_node_postmortem_metadata.cc @@ -134,8 +134,10 @@ TEST_F(DebugSymbolsTest, HandleWrapList) { auto obj_template = v8::FunctionTemplate::New(isolate_); obj_template->InstanceTemplate()->SetInternalFieldCount(1); - v8::Local<v8::Object> object = - obj_template->GetFunction()->NewInstance(env.context()).ToLocalChecked(); + v8::Local<v8::Object> object = obj_template->GetFunction(env.context()) + .ToLocalChecked() + ->NewInstance(env.context()) + .ToLocalChecked(); TestHandleWrap obj(*env, object, &handle); auto queue = reinterpret_cast<uintptr_t>((*env)->handle_wrap_queue()); @@ -161,8 +163,10 @@ TEST_F(DebugSymbolsTest, ReqWrapList) { auto obj_template = v8::FunctionTemplate::New(isolate_); obj_template->InstanceTemplate()->SetInternalFieldCount(1); - v8::Local<v8::Object> object = - obj_template->GetFunction()->NewInstance(env.context()).ToLocalChecked(); + v8::Local<v8::Object> object = obj_template->GetFunction(env.context()) + .ToLocalChecked() + ->NewInstance(env.context()) + .ToLocalChecked(); TestReqWrap obj(*env, object); // NOTE (mmarchini): Workaround to fix failing tests on ARM64 machines with |