Skip to content

Commit 33821c3

Browse files
bnoordhuisMylesBorins
authored andcommittedApr 16, 2018
n-api: use Maybe version of Object::SetPrototype()
Fixes the following deprecation warning: ../src/node_api.cc:2020:30: warning: 'bool v8::Object::SetPrototype(v8::Local<v8::Value>)' is deprecated: Use maybe version [-Wdeprecated-declarations] wrapper->SetPrototype(proto); ../src/node_api.cc:2021:28: warning: 'bool v8::Object::SetPrototype(v8::Local<v8::Value>)' is deprecated: Use maybe version [-Wdeprecated-declarations] obj->SetPrototype(wrapper); Backport-PR-URL: #19447 PR-URL: #14053 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 80cf25a commit 33821c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/node_api.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -2020,8 +2020,8 @@ napi_status napi_wrap(napi_env env,
20202020

20212021
// Insert the wrapper into the object's prototype chain.
20222022
v8::Local<v8::Value> proto = obj->GetPrototype();
2023-
wrapper->SetPrototype(proto);
2024-
obj->SetPrototype(wrapper);
2023+
CHECK(wrapper->SetPrototype(context, proto).FromJust());
2024+
CHECK(obj->SetPrototype(context, wrapper).FromJust());
20252025

20262026
if (result != nullptr) {
20272027
// The returned reference should be deleted via napi_delete_reference()

0 commit comments

Comments
 (0)
Please sign in to comment.