From 33821c3087f58fab0ab46502a7c65a9cd23d132e Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 3 Jul 2017 12:07:16 +0200 Subject: [PATCH] n-api: use Maybe version of Object::SetPrototype() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following deprecation warning: ../src/node_api.cc:2020:30: warning: 'bool v8::Object::SetPrototype(v8::Local)' is deprecated: Use maybe version [-Wdeprecated-declarations] wrapper->SetPrototype(proto); ../src/node_api.cc:2021:28: warning: 'bool v8::Object::SetPrototype(v8::Local)' is deprecated: Use maybe version [-Wdeprecated-declarations] obj->SetPrototype(wrapper); Backport-PR-URL: https://github.com/nodejs/node/pull/19447 PR-URL: https://github.com/nodejs/node/pull/14053 Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Daniel Bevenius Reviewed-By: Franziska Hinkelmann Reviewed-By: Michaƫl Zasso --- src/node_api.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node_api.cc b/src/node_api.cc index ef02bd47f6e549..f0dbe1fb717486 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -2020,8 +2020,8 @@ napi_status napi_wrap(napi_env env, // Insert the wrapper into the object's prototype chain. v8::Local proto = obj->GetPrototype(); - wrapper->SetPrototype(proto); - obj->SetPrototype(wrapper); + CHECK(wrapper->SetPrototype(context, proto).FromJust()); + CHECK(obj->SetPrototype(context, wrapper).FromJust()); if (result != nullptr) { // The returned reference should be deleted via napi_delete_reference()