Skip to content

Commit

Permalink
src: do not use deprecated V8 API
Browse files Browse the repository at this point in the history
Namely:
  - `v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, ...);`
  - `v8::ObjectTemplate::SetNativeDataProperty` with `AccessControl`

Refs: v8/v8@46c241e
Refs: v8/v8@6ec8839
Co-authored-by: Michaël Zasso <targos@protonmail.com>
PR-URL: #53084
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
isheludko and targos committed Jun 1, 2024
1 parent 6165894 commit 11f790d
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/base_object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {

template <int Field>
void BaseObject::InternalFieldGet(
v8::Local<v8::String> property,
v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(
info.This()->GetInternalField(Field).As<v8::Value>());
}

template <int Field, bool (v8::Value::* typecheck)() const>
void BaseObject::InternalFieldSet(v8::Local<v8::String> property,
template <int Field, bool (v8::Value::*typecheck)() const>
void BaseObject::InternalFieldSet(v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) {
// This could be e.g. value->IsFunction().
Expand Down
4 changes: 2 additions & 2 deletions src/base_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ class BaseObject : public MemoryRetainer {

// Setter/Getter pair for internal fields that can be passed to SetAccessor.
template <int Field>
static void InternalFieldGet(v8::Local<v8::String> property,
static void InternalFieldGet(v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info);
template <int Field, bool (v8::Value::*typecheck)() const>
static void InternalFieldSet(v8::Local<v8::String> property,
static void InternalFieldSet(v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info);

Expand Down
5 changes: 0 additions & 5 deletions src/node_builtins.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace node {
namespace builtins {

using v8::Context;
using v8::DEFAULT;
using v8::EscapableHandleScope;
using v8::Function;
using v8::FunctionCallbackInfo;
Expand Down Expand Up @@ -710,15 +709,13 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
nullptr,
Local<Value>(),
None,
DEFAULT,
SideEffectType::kHasNoSideEffect);

target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"),
BuiltinIdsGetter,
nullptr,
Local<Value>(),
None,
DEFAULT,
SideEffectType::kHasNoSideEffect);

target->SetNativeDataProperty(
Expand All @@ -727,15 +724,13 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
nullptr,
Local<Value>(),
None,
DEFAULT,
SideEffectType::kHasNoSideEffect);

target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"),
GetNatives,
nullptr,
Local<Value>(),
None,
DEFAULT,
SideEffectType::kHasNoSideEffect);

SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage);
Expand Down
2 changes: 0 additions & 2 deletions src/node_external_reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) \
Expand Down

0 comments on commit 11f790d

Please sign in to comment.