From 11f790d9113610c92cbc6767a9e3ab91f102ac47 Mon Sep 17 00:00:00 2001 From: ishell Date: Mon, 25 Mar 2024 15:45:41 +0100 Subject: [PATCH] src: do not use deprecated V8 API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Namely: - `v8::ObjectTemplate::SetAccessor(v8::Local, ...);` - `v8::ObjectTemplate::SetNativeDataProperty` with `AccessControl` Refs: https://github.com/v8/v8/commit/46c241eb99557fe8205acac5c526650c3847d180 Refs: https://github.com/v8/v8/commit/6ec883986bd417e2a42ddb960bd9449deb7e4639 Co-authored-by: Michaël Zasso PR-URL: https://github.com/nodejs/node/pull/53084 Reviewed-By: Luigi Pinca Reviewed-By: Tobias Nießen Reviewed-By: James M Snell Reviewed-By: Joyee Cheung --- src/base_object-inl.h | 6 +++--- src/base_object.h | 4 ++-- src/node_builtins.cc | 5 ----- src/node_external_reference.h | 2 -- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/base_object-inl.h b/src/base_object-inl.h index da8fed7b3013df..518b22dabef097 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -132,14 +132,14 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const { template void BaseObject::InternalFieldGet( - v8::Local property, + v8::Local property, const v8::PropertyCallbackInfo& info) { info.GetReturnValue().Set( info.This()->GetInternalField(Field).As()); } -template -void BaseObject::InternalFieldSet(v8::Local property, +template +void BaseObject::InternalFieldSet(v8::Local property, v8::Local value, const v8::PropertyCallbackInfo& info) { // This could be e.g. value->IsFunction(). diff --git a/src/base_object.h b/src/base_object.h index b0ada1d7f38fed..fd6d62a99ce011 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -111,10 +111,10 @@ class BaseObject : public MemoryRetainer { // Setter/Getter pair for internal fields that can be passed to SetAccessor. template - static void InternalFieldGet(v8::Local property, + static void InternalFieldGet(v8::Local property, const v8::PropertyCallbackInfo& info); template - static void InternalFieldSet(v8::Local property, + static void InternalFieldSet(v8::Local property, v8::Local value, const v8::PropertyCallbackInfo& info); diff --git a/src/node_builtins.cc b/src/node_builtins.cc index 81d3c9f7511e5d..1ffe2e13aae4a4 100644 --- a/src/node_builtins.cc +++ b/src/node_builtins.cc @@ -11,7 +11,6 @@ namespace node { namespace builtins { using v8::Context; -using v8::DEFAULT; using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; @@ -710,7 +709,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, - DEFAULT, SideEffectType::kHasNoSideEffect); target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"), @@ -718,7 +716,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, - DEFAULT, SideEffectType::kHasNoSideEffect); target->SetNativeDataProperty( @@ -727,7 +724,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, - DEFAULT, SideEffectType::kHasNoSideEffect); target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"), @@ -735,7 +731,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data, nullptr, Local(), None, - DEFAULT, SideEffectType::kHasNoSideEffect); SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage); diff --git a/src/node_external_reference.h b/src/node_external_reference.h index be4386dcf71203..6bbeffb8941ea3 100644 --- a/src/node_external_reference.h +++ b/src/node_external_reference.h @@ -68,8 +68,6 @@ class ExternalReferenceRegistry { V(CFunctionWithBool) \ V(const v8::CFunctionInfo*) \ V(v8::FunctionCallback) \ - V(v8::AccessorGetterCallback) \ - V(v8::AccessorSetterCallback) \ V(v8::AccessorNameGetterCallback) \ V(v8::AccessorNameSetterCallback) \ V(v8::NamedPropertyGetterCallback) \