src_do_not_use_deprecated_v8_api.patch 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
  2. From: ishell <[email protected]>
  3. Date: Mon, 25 Mar 2024 15:45:41 +0100
  4. Subject: src: do not use deprecated V8 API
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Namely:
  9. - `v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, ...);`
  10. - `v8::ObjectTemplate::SetNativeDataProperty` with `AccessControl`
  11. Refs: https://github.com/v8/v8/commit/46c241eb99557fe8205acac5c526650c3847d180
  12. Refs: https://github.com/v8/v8/commit/6ec883986bd417e2a42ddb960bd9449deb7e4639
  13. Co-authored-by: Michaël Zasso <[email protected]>
  14. PR-URL: https://github.com/nodejs/node/pull/53084
  15. Reviewed-By: Luigi Pinca <[email protected]>
  16. Reviewed-By: Tobias Nießen <[email protected]>
  17. Reviewed-By: James M Snell <[email protected]>
  18. Reviewed-By: Joyee Cheung <[email protected]>
  19. (cherry picked from commit 26d5cafff76d3a096ebfd7d7a6279d4b5b190230)
  20. diff --git a/src/base_object-inl.h b/src/base_object-inl.h
  21. index da8fed7b3013df10ae02be2070545c74d9a978f0..518b22dabef0974c2e7ecb466669925338524059 100644
  22. --- a/src/base_object-inl.h
  23. +++ b/src/base_object-inl.h
  24. @@ -132,14 +132,14 @@ v8::EmbedderGraph::Node::Detachedness BaseObject::GetDetachedness() const {
  25. template <int Field>
  26. void BaseObject::InternalFieldGet(
  27. - v8::Local<v8::String> property,
  28. + v8::Local<v8::Name> property,
  29. const v8::PropertyCallbackInfo<v8::Value>& info) {
  30. info.GetReturnValue().Set(
  31. info.This()->GetInternalField(Field).As<v8::Value>());
  32. }
  33. -template <int Field, bool (v8::Value::* typecheck)() const>
  34. -void BaseObject::InternalFieldSet(v8::Local<v8::String> property,
  35. +template <int Field, bool (v8::Value::*typecheck)() const>
  36. +void BaseObject::InternalFieldSet(v8::Local<v8::Name> property,
  37. v8::Local<v8::Value> value,
  38. const v8::PropertyCallbackInfo<void>& info) {
  39. // This could be e.g. value->IsFunction().
  40. diff --git a/src/base_object.h b/src/base_object.h
  41. index 5968694e8393d8434fb2ffee411dfac4c93aff29..5c16d0d1b32e2d056f4fcfa0e01781292932a0fa 100644
  42. --- a/src/base_object.h
  43. +++ b/src/base_object.h
  44. @@ -111,10 +111,10 @@ class BaseObject : public MemoryRetainer {
  45. // Setter/Getter pair for internal fields that can be passed to SetAccessor.
  46. template <int Field>
  47. - static void InternalFieldGet(v8::Local<v8::String> property,
  48. + static void InternalFieldGet(v8::Local<v8::Name> property,
  49. const v8::PropertyCallbackInfo<v8::Value>& info);
  50. template <int Field, bool (v8::Value::*typecheck)() const>
  51. - static void InternalFieldSet(v8::Local<v8::String> property,
  52. + static void InternalFieldSet(v8::Local<v8::Name> property,
  53. v8::Local<v8::Value> value,
  54. const v8::PropertyCallbackInfo<void>& info);
  55. diff --git a/src/node_builtins.cc b/src/node_builtins.cc
  56. index 3e37aa8b0c9696cceb3f3cfab9721f38c74a2fba..78f20de6b127961e9de7b5caaeca702ed7a36e01 100644
  57. --- a/src/node_builtins.cc
  58. +++ b/src/node_builtins.cc
  59. @@ -11,7 +11,6 @@ namespace node {
  60. namespace builtins {
  61. using v8::Context;
  62. -using v8::DEFAULT;
  63. using v8::EscapableHandleScope;
  64. using v8::Function;
  65. using v8::FunctionCallbackInfo;
  66. @@ -720,7 +719,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
  67. nullptr,
  68. Local<Value>(),
  69. None,
  70. - DEFAULT,
  71. SideEffectType::kHasNoSideEffect);
  72. target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"),
  73. @@ -728,7 +726,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
  74. nullptr,
  75. Local<Value>(),
  76. None,
  77. - DEFAULT,
  78. SideEffectType::kHasNoSideEffect);
  79. target->SetNativeDataProperty(
  80. @@ -737,7 +734,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
  81. nullptr,
  82. Local<Value>(),
  83. None,
  84. - DEFAULT,
  85. SideEffectType::kHasNoSideEffect);
  86. target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"),
  87. @@ -745,7 +741,6 @@ void BuiltinLoader::CreatePerIsolateProperties(IsolateData* isolate_data,
  88. nullptr,
  89. Local<Value>(),
  90. None,
  91. - DEFAULT,
  92. SideEffectType::kHasNoSideEffect);
  93. SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage);
  94. diff --git a/src/node_external_reference.h b/src/node_external_reference.h
  95. index 4e2ad9024020fa0851da41da44afccdf188c7044..c4aba23510872d66b58a1adc88cdd1ee85a86cfe 100644
  96. --- a/src/node_external_reference.h
  97. +++ b/src/node_external_reference.h
  98. @@ -64,8 +64,6 @@ class ExternalReferenceRegistry {
  99. V(CFunctionWithBool) \
  100. V(const v8::CFunctionInfo*) \
  101. V(v8::FunctionCallback) \
  102. - V(v8::AccessorGetterCallback) \
  103. - V(v8::AccessorSetterCallback) \
  104. V(v8::AccessorNameGetterCallback) \
  105. V(v8::AccessorNameSetterCallback) \
  106. V(v8::GenericNamedPropertyDefinerCallback) \