From c9b6d95161e996245e424e428e5c350d4ce52948 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); 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 ae950bb4bfe34d..485eefa9446c43 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -2017,8 +2017,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()