mirror of
https://github.com/electron/electron.git
synced 2026-01-10 07:58:08 -05:00
chore: bump nan to v2.22.2
This commit is contained in:
2
DEPS
2
DEPS
@@ -6,7 +6,7 @@ vars = {
|
||||
'node_version':
|
||||
'v22.15.0',
|
||||
'nan_version':
|
||||
'e14bdcd1f72d62bca1d541b66da43130384ec213',
|
||||
'3bf886345aa9be3ae2ee73068906de1a6f2c51a3',
|
||||
'squirrel.mac_version':
|
||||
'0e5d146ba13101a1302d59ea6e6e0b3cace4ae38',
|
||||
'reactiveobjc_version':
|
||||
|
||||
@@ -137,6 +137,6 @@
|
||||
]
|
||||
},
|
||||
"resolutions": {
|
||||
"nan": "nodejs/nan#e14bdcd1f72d62bca1d541b66da43130384ec213"
|
||||
"nan": "nodejs/nan#3bf886345aa9be3ae2ee73068906de1a6f2c51a3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
{ "patch_dir": "src/electron/patches/ffmpeg", "repo": "src/third_party/ffmpeg" },
|
||||
{ "patch_dir": "src/electron/patches/v8", "repo": "src/v8" },
|
||||
{ "patch_dir": "src/electron/patches/node", "repo": "src/third_party/electron_node" },
|
||||
{ "patch_dir": "src/electron/patches/nan", "repo": "src/third_party/nan" },
|
||||
{ "patch_dir": "src/electron/patches/perfetto", "repo": "src/third_party/perfetto" },
|
||||
{ "patch_dir": "src/electron/patches/squirrel.mac", "repo": "src/third_party/squirrel.mac" },
|
||||
{ "patch_dir": "src/electron/patches/Mantle", "repo": "src/third_party/squirrel.mac/vendor/Mantle" },
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
use_new_constructor_for_scriptorigin_when_17_x.patch
|
||||
fix_define_nan_copyablepersistenttraits_for_v8_12_5.patch
|
||||
remove_deprecated_v8_isolate_idlenotificationdeadline.patch
|
||||
remove_several_apis_deprecated_in_version_12_6.patch
|
||||
apply_allcan_read_write.patch
|
||||
fix_support_new_variant_of_namedpropertyhandlerconfiguration_and.patch
|
||||
fix_correct_usages_of_v8_returnvalue_void_set_nonempty_for_new.patch
|
||||
chore_remove_deprecated_functioncallbackinfo_holder.patch
|
||||
@@ -1,141 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Keeley Hammond <khammond@slack-corp.com>
|
||||
Date: Thu, 20 Jun 2024 14:42:08 -0700
|
||||
Subject: Check for NODE_21_0_MODULE_VERSION
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/5006387
|
||||
Should be upstreamed.
|
||||
|
||||
Module version checks are made against 119 since that is the current assigned version
|
||||
for Electron 28 in https://github.com/nodejs/node/blob/main/doc/abi_version_registry.json.
|
||||
The version should be updateed to the one assinged for Electron 29 when it is available.
|
||||
|
||||
Steps for upstreaming this patch:
|
||||
|
||||
- Get a new module version assigned for Electron 29 in nodejs/node
|
||||
- Update NODE_21_0_MODULE_VERSION to the new version number
|
||||
- Upstream patch to nodejs/nan before Electron 29 is branched
|
||||
|
||||
diff --git a/nan.h b/nan.h
|
||||
index 9a9112afe0cc94ce58ed3cce9763ace7c160a932..f4865a77e60d5105ed2426037984ddcbfa58bbca 100644
|
||||
--- a/nan.h
|
||||
+++ b/nan.h
|
||||
@@ -47,6 +47,7 @@
|
||||
#define NODE_18_0_MODULE_VERSION 108
|
||||
#define NODE_19_0_MODULE_VERSION 111
|
||||
#define NODE_20_0_MODULE_VERSION 115
|
||||
+#define NODE_21_0_MODULE_VERSION 119
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800)
|
||||
@@ -2525,7 +2526,9 @@ NAN_DEPRECATED inline void SetAccessor(
|
||||
, GetterCallback getter
|
||||
, SetterCallback setter
|
||||
, v8::Local<v8::Value> data
|
||||
+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
|
||||
, v8::AccessControl settings
|
||||
+#endif
|
||||
, v8::PropertyAttribute attribute
|
||||
, imp::Sig signature) {
|
||||
HandleScope scope;
|
||||
@@ -2553,17 +2556,28 @@ NAN_DEPRECATED inline void SetAccessor(
|
||||
obj->SetInternalField(imp::kDataIndex, data);
|
||||
}
|
||||
|
||||
+#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION)
|
||||
+ tpl->SetNativeDataProperty(
|
||||
+ name
|
||||
+ , getter_
|
||||
+ , setter_
|
||||
+ , obj
|
||||
+ , attribute);
|
||||
+#else
|
||||
tpl->SetAccessor(
|
||||
name
|
||||
, getter_
|
||||
, setter_
|
||||
, obj
|
||||
+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
|
||||
, settings
|
||||
+#endif
|
||||
, attribute
|
||||
#if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION)
|
||||
, signature
|
||||
#endif
|
||||
);
|
||||
+#endif
|
||||
}
|
||||
|
||||
inline void SetAccessor(
|
||||
@@ -2572,7 +2586,9 @@ inline void SetAccessor(
|
||||
, GetterCallback getter
|
||||
, SetterCallback setter = 0
|
||||
, v8::Local<v8::Value> data = v8::Local<v8::Value>()
|
||||
+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
|
||||
, v8::AccessControl settings = v8::DEFAULT
|
||||
+#endif
|
||||
, v8::PropertyAttribute attribute = v8::None) {
|
||||
HandleScope scope;
|
||||
|
||||
@@ -2599,14 +2615,25 @@ inline void SetAccessor(
|
||||
obj->SetInternalField(imp::kDataIndex, data);
|
||||
}
|
||||
|
||||
+#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION)
|
||||
+ tpl->SetNativeDataProperty(
|
||||
+ name
|
||||
+ , getter_
|
||||
+ , setter_
|
||||
+ , obj
|
||||
+ , attribute);
|
||||
+#else
|
||||
tpl->SetAccessor(
|
||||
name
|
||||
, getter_
|
||||
, setter_
|
||||
, obj
|
||||
+#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
|
||||
, settings
|
||||
+#endif
|
||||
, attribute
|
||||
);
|
||||
+#endif
|
||||
}
|
||||
|
||||
inline bool SetAccessor(
|
||||
@@ -2642,7 +2669,15 @@ inline bool SetAccessor(
|
||||
, New<v8::External>(reinterpret_cast<void *>(setter)));
|
||||
}
|
||||
|
||||
-#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
|
||||
+#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION)
|
||||
+ return obj->SetNativeDataProperty(
|
||||
+ GetCurrentContext()
|
||||
+ , name
|
||||
+ , getter_
|
||||
+ , setter_
|
||||
+ , dataobj
|
||||
+ , attribute).FromMaybe(false);
|
||||
+#elif (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
|
||||
return obj->SetAccessor(
|
||||
GetCurrentContext()
|
||||
, name
|
||||
diff --git a/test/js/accessors-test.js b/test/js/accessors-test.js
|
||||
index e6ad45737e2ac18da3fa936b1de618e7389933bc..025f5b66774c2f5fe0ccb98c91fc714dd916fcb1 100644
|
||||
--- a/test/js/accessors-test.js
|
||||
+++ b/test/js/accessors-test.js
|
||||
@@ -11,7 +11,7 @@ const test = require('tap').test
|
||||
, bindings = require('bindings')({ module_root: testRoot, bindings: 'accessors' });
|
||||
|
||||
test('accessors', function (t) {
|
||||
- t.plan(7)
|
||||
+ t.plan(6)
|
||||
var settergetter = bindings.create()
|
||||
t.equal(settergetter.prop1, 'this is property 1')
|
||||
t.ok(settergetter.prop2 === '')
|
||||
@@ -28,5 +28,4 @@ test('accessors', function (t) {
|
||||
t.equal(derived.prop1, 'this is property 1')
|
||||
derived.prop2 = 'setting a new value'
|
||||
t.equal(derived.prop2, 'setting a new value')
|
||||
- t.equal(settergetter.prop2, 'setting a new value')
|
||||
})
|
||||
@@ -1,30 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@electronjs.org>
|
||||
Date: Fri, 28 Feb 2025 11:17:01 -0500
|
||||
Subject: chore remove deprecated FunctionCallbackInfo Holder
|
||||
|
||||
v8 version 13.5.191 removed the deprecated FunctionCallbackInfo::Holder().
|
||||
|
||||
Callers are supposed to use FunctionCallbackInfo::This() instead.
|
||||
|
||||
See https://chromium-review.googlesource.com/c/v8/v8/+/6309166
|
||||
|
||||
diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h
|
||||
index 1af2459efcf54fa97ff24aaa221892eede6eb0d3..e8505247a5070dba572954ba63bc193c9fd51eb6 100644
|
||||
--- a/nan_callbacks_12_inl.h
|
||||
+++ b/nan_callbacks_12_inl.h
|
||||
@@ -109,7 +109,14 @@ class FunctionCallbackInfo {
|
||||
inline v8::Local<v8::Function> Callee() const { return info_.Callee(); }
|
||||
#endif
|
||||
inline v8::Local<v8::Value> Data() const { return data_; }
|
||||
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION < 13 || \
|
||||
+(V8_MAJOR_VERSION == 13 && defined(V8_MINOR_VERSION) && \
|
||||
+(V8_MINOR_VERSION < 5 || (V8_MINOR_VERSION == 5 && \
|
||||
+defined(V8_BUILD_NUMBER) && V8_BUILD_NUMBER < 191))))
|
||||
inline v8::Local<v8::Object> Holder() const { return info_.Holder(); }
|
||||
+#else
|
||||
+ inline v8::Local<v8::Object> Holder() const { return info_.This(); }
|
||||
+#endif
|
||||
inline bool IsConstructCall() const { return info_.IsConstructCall(); }
|
||||
inline int Length() const { return info_.Length(); }
|
||||
inline v8::Local<v8::Value> operator[](int i) const { return info_[i]; }
|
||||
@@ -1,47 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Wed, 3 Jul 2024 08:43:17 +0000
|
||||
Subject: fix: correct usages of v8::ReturnValue<void>::Set[NonEmpty] for new
|
||||
API
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/5647894
|
||||
|
||||
The Nan tests were returning the property's value that
|
||||
was intended to be set or defined, but V8 was interpreting
|
||||
this value as a boolean result indicating whether the operation
|
||||
succeeded or not which was incorrect.
|
||||
|
||||
This should be upstreamed.
|
||||
|
||||
diff --git a/test/cpp/indexedinterceptors.cpp b/test/cpp/indexedinterceptors.cpp
|
||||
index f2cd97ac9c40070c127bf9d682401c33955d6d6a..38f1298c2b44130eca73d9d005d2d7ab5f234926 100644
|
||||
--- a/test/cpp/indexedinterceptors.cpp
|
||||
+++ b/test/cpp/indexedinterceptors.cpp
|
||||
@@ -90,9 +90,9 @@ NAN_INDEX_SETTER(IndexedInterceptor::PropertySetter) {
|
||||
interceptor->buf
|
||||
, *Nan::Utf8String(value)
|
||||
, sizeof (interceptor->buf));
|
||||
- info.GetReturnValue().Set(info.This());
|
||||
+ info.GetReturnValue().Set(True());
|
||||
} else {
|
||||
- info.GetReturnValue().Set(info.This());
|
||||
+ info.GetReturnValue().Set(True());
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/test/cpp/namedinterceptors.cpp b/test/cpp/namedinterceptors.cpp
|
||||
index 8ab5f47db4b9830dd18c36d1a7cb0fced5925355..ae67f2391906fa0e9a60bc406bde86550965dab9 100644
|
||||
--- a/test/cpp/namedinterceptors.cpp
|
||||
+++ b/test/cpp/namedinterceptors.cpp
|
||||
@@ -90,10 +90,8 @@ NAN_PROPERTY_SETTER(NamedInterceptor::PropertySetter) {
|
||||
interceptor->buf
|
||||
, *Nan::Utf8String(value)
|
||||
, sizeof (interceptor->buf));
|
||||
- info.GetReturnValue().Set(info.This());
|
||||
- } else {
|
||||
- info.GetReturnValue().Set(info.This());
|
||||
}
|
||||
+ info.GetReturnValue().Set(True());
|
||||
}
|
||||
|
||||
NAN_PROPERTY_ENUMERATOR(NamedInterceptor::PropertyEnumerator) {
|
||||
@@ -1,44 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: deepak1556 <hop2deep@gmail.com>
|
||||
Date: Fri, 12 Apr 2024 22:16:58 +0900
|
||||
Subject: fix: define Nan::CopyablePersistentTraits for v8 >= 12.5
|
||||
|
||||
Refs https://chromium-review.googlesource.com/c/v8/v8/+/5403708
|
||||
Should be upstreamed.
|
||||
|
||||
diff --git a/nan.h b/nan.h
|
||||
index 2a68349448c163fa29af327a03b11678e61f5789..42285328055ddb7c76548258f3c4847d2c278ad6 100644
|
||||
--- a/nan.h
|
||||
+++ b/nan.h
|
||||
@@ -203,9 +203,11 @@ typedef v8::String::ExternalOneByteStringResource
|
||||
template<typename T>
|
||||
class NonCopyablePersistentTraits :
|
||||
public v8::NonCopyablePersistentTraits<T> {};
|
||||
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION <= 12 && V8_MINOR_VERSION < 5)
|
||||
template<typename T>
|
||||
class CopyablePersistentTraits :
|
||||
public v8::CopyablePersistentTraits<T> {};
|
||||
+#endif
|
||||
|
||||
template<typename T>
|
||||
class PersistentBase :
|
||||
diff --git a/nan_persistent_12_inl.h b/nan_persistent_12_inl.h
|
||||
index d9649e867606c6356e393e9964b5607a08ea4e3a..ad89657e204259018f1e3814a864410a0917a915 100644
|
||||
--- a/nan_persistent_12_inl.h
|
||||
+++ b/nan_persistent_12_inl.h
|
||||
@@ -129,4 +129,15 @@ class Global : public v8::UniquePersistent<T> {
|
||||
};
|
||||
#endif
|
||||
|
||||
+#if defined(V8_MAJOR_VERSION) && ((V8_MAJOR_VERSION >= 12 && V8_MINOR_VERSION >= 5) || V8_MAJOR_VERSION >= 13)
|
||||
+template<typename T>
|
||||
+struct CopyablePersistentTraits {
|
||||
+ typedef v8::Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
|
||||
+ static const bool kResetInDestructor = true;
|
||||
+ template<typename S, typename M>
|
||||
+ static inline void Copy(const v8::Persistent<S, M> &source,
|
||||
+ CopyablePersistent *dest) {}
|
||||
+};
|
||||
+#endif
|
||||
+
|
||||
#endif // NAN_PERSISTENT_12_INL_H_
|
||||
@@ -1,220 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samuel Attard <marshallofsound@electronjs.org>
|
||||
Date: Fri, 28 Jun 2024 11:45:44 -0700
|
||||
Subject: fix: support new variant of NamedPropertyHandlerConfiguration and
|
||||
IndexedPropertyHandlerConfiguration
|
||||
|
||||
Ref: https://chromium-review.googlesource.com/c/v8/v8/+/5630388
|
||||
|
||||
This should be upstreamed, the reinterpret_cast is funky but works, but require more review when upstreaming.
|
||||
|
||||
diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h
|
||||
index bbcde4d65dec73139fee53339f154babd8f83b28..1af2459efcf54fa97ff24aaa221892eede6eb0d3 100644
|
||||
--- a/nan_callbacks_12_inl.h
|
||||
+++ b/nan_callbacks_12_inl.h
|
||||
@@ -255,7 +255,98 @@ typedef void (*NativeSetter)(
|
||||
, const v8::PropertyCallbackInfo<void> &);
|
||||
#endif
|
||||
|
||||
-#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
+#if NODE_MODULE_VERSION > NODE_21_0_MODULE_VERSION
|
||||
+static
|
||||
+v8::Intercepted PropertyGetterCallbackWrapper(
|
||||
+ v8::Local<v8::Name> property
|
||||
+ , const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Value>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kPropertyGetterIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(property.As<v8::String>(), cbinfo);
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativePropertyGetter)
|
||||
+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
+
|
||||
+static
|
||||
+v8::Intercepted PropertySetterCallbackWrapper(
|
||||
+ v8::Local<v8::Name> property
|
||||
+ , v8::Local<v8::Value> value
|
||||
+ , const v8::PropertyCallbackInfo<void> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<void>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kPropertySetterIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(property.As<v8::String>(), value, *reinterpret_cast<PropertyCallbackInfo<v8::Value>*>(&cbinfo));
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativePropertySetter)(
|
||||
+ v8::Local<v8::Name>
|
||||
+ , v8::Local<v8::Value>
|
||||
+ , const v8::PropertyCallbackInfo<void> &);
|
||||
+
|
||||
+static
|
||||
+void PropertyEnumeratorCallbackWrapper(
|
||||
+ const v8::PropertyCallbackInfo<v8::Array> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Array>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ PropertyEnumeratorCallback callback =
|
||||
+ reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kPropertyEnumeratorIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(cbinfo);
|
||||
+}
|
||||
+
|
||||
+typedef void (*NativePropertyEnumerator)
|
||||
+ (const v8::PropertyCallbackInfo<v8::Array> &);
|
||||
+
|
||||
+static
|
||||
+v8::Intercepted PropertyDeleterCallbackWrapper(
|
||||
+ v8::Local<v8::Name> property
|
||||
+ , const v8::PropertyCallbackInfo<v8::Boolean> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Boolean>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kPropertyDeleterIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(property.As<v8::String>(), cbinfo);
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (NativePropertyDeleter)
|
||||
+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean> &);
|
||||
+
|
||||
+static
|
||||
+v8::Intercepted PropertyQueryCallbackWrapper(
|
||||
+ v8::Local<v8::Name> property
|
||||
+ , const v8::PropertyCallbackInfo<v8::Integer> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Integer>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kPropertyQueryIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(property.As<v8::String>(), cbinfo);
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativePropertyQuery)
|
||||
+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
+#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
|
||||
static
|
||||
void PropertyGetterCallbackWrapper(
|
||||
v8::Local<v8::Name> property
|
||||
@@ -431,6 +522,96 @@ typedef void (*NativePropertyQuery)
|
||||
(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
#endif
|
||||
|
||||
+#if NODE_MODULE_VERSION > NODE_21_0_MODULE_VERSION
|
||||
+static
|
||||
+v8::Intercepted IndexGetterCallbackWrapper(
|
||||
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Value>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kIndexPropertyGetterIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(index, cbinfo);
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativeIndexGetter)
|
||||
+ (uint32_t, const v8::PropertyCallbackInfo<v8::Value> &);
|
||||
+
|
||||
+static
|
||||
+v8::Intercepted IndexSetterCallbackWrapper(
|
||||
+ uint32_t index
|
||||
+ , v8::Local<v8::Value> value
|
||||
+ , const v8::PropertyCallbackInfo<void> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<void>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kIndexPropertySetterIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(index, value, *reinterpret_cast<PropertyCallbackInfo<v8::Value>*>(&cbinfo));
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativeIndexSetter)(
|
||||
+ uint32_t
|
||||
+ , v8::Local<v8::Value>
|
||||
+ , const v8::PropertyCallbackInfo<void> &);
|
||||
+
|
||||
+static
|
||||
+void IndexEnumeratorCallbackWrapper(
|
||||
+ const v8::PropertyCallbackInfo<v8::Array> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Array>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(
|
||||
+ kIndexPropertyEnumeratorIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(cbinfo);
|
||||
+}
|
||||
+
|
||||
+typedef void (*NativeIndexEnumerator)
|
||||
+ (const v8::PropertyCallbackInfo<v8::Array> &);
|
||||
+
|
||||
+static
|
||||
+v8::Intercepted IndexDeleterCallbackWrapper(
|
||||
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Boolean>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kIndexPropertyDeleterIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(index, cbinfo);
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativeIndexDeleter)
|
||||
+ (uint32_t, const v8::PropertyCallbackInfo<v8::Boolean> &);
|
||||
+
|
||||
+static
|
||||
+v8::Intercepted IndexQueryCallbackWrapper(
|
||||
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) {
|
||||
+ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
|
||||
+ PropertyCallbackInfo<v8::Integer>
|
||||
+ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
|
||||
+ IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
|
||||
+ reinterpret_cast<intptr_t>(
|
||||
+ obj->GetInternalField(kIndexPropertyQueryIndex)
|
||||
+ .As<v8::Value>().As<v8::External>()->Value()));
|
||||
+ callback(index, cbinfo);
|
||||
+ return v8::Intercepted::kYes;
|
||||
+}
|
||||
+
|
||||
+typedef v8::Intercepted (*NativeIndexQuery)
|
||||
+ (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
+#else
|
||||
static
|
||||
void IndexGetterCallbackWrapper(
|
||||
uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
|
||||
@@ -515,6 +696,8 @@ void IndexQueryCallbackWrapper(
|
||||
|
||||
typedef void (*NativeIndexQuery)
|
||||
(uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
|
||||
+#endif
|
||||
+
|
||||
} // end of namespace imp
|
||||
|
||||
#endif // NAN_CALLBACKS_12_INL_H_
|
||||
@@ -1,28 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@electronjs.org>
|
||||
Date: Thu, 6 Jun 2024 15:16:49 -0400
|
||||
Subject: Remove deprecated v8::Isolate::IdleNotificationDeadline
|
||||
|
||||
See https://chromium-review.googlesource.com/c/v8/v8/+/5539852
|
||||
|
||||
Also https://github.com/nodejs/nan/issues/953#issuecomment-1791163429
|
||||
|
||||
diff --git a/nan.h b/nan.h
|
||||
index 42285328055ddb7c76548258f3c4847d2c278ad6..9a9112afe0cc94ce58ed3cce9763ace7c160a932 100644
|
||||
--- a/nan.h
|
||||
+++ b/nan.h
|
||||
@@ -684,7 +684,13 @@ inline uv_loop_t* GetCurrentEventLoop() {
|
||||
v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb);
|
||||
}
|
||||
|
||||
-#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 11 || \
|
||||
+ (V8_MAJOR_VERSION == 11 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
+ inline bool IdleNotification(int idle_time_in_ms) {
|
||||
+ v8::Isolate::GetCurrent()->MemoryPressureNotification(v8::MemoryPressureLevel::kModerate);
|
||||
+ return true;
|
||||
+ }
|
||||
+#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
|
||||
(V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
|
||||
inline bool IdleNotification(int idle_time_in_ms) {
|
||||
return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
|
||||
@@ -1,41 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: John Kleinschmidt <jkleinsc@electronjs.org>
|
||||
Date: Thu, 6 Jun 2024 15:17:39 -0400
|
||||
Subject: Remove several APIs deprecated in version 12.6
|
||||
|
||||
See https://chromium-review.googlesource.com/c/v8/v8/+/5539888
|
||||
|
||||
ScriptOrigin constructor with isolate has been removed;
|
||||
Deprecation instructions were to "Use constructor without the isolate."
|
||||
|
||||
diff --git a/nan_scriptorigin.h b/nan_scriptorigin.h
|
||||
index ce79cdf8dc931d61633c74079a4c38efd3c785ed..85202aaba148540644d39ea2cdf88de0dd101fe4 100644
|
||||
--- a/nan_scriptorigin.h
|
||||
+++ b/nan_scriptorigin.h
|
||||
@@ -11,7 +11,25 @@
|
||||
|
||||
class ScriptOrigin : public v8::ScriptOrigin {
|
||||
public:
|
||||
-#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \
|
||||
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
|
||||
+ (V8_MAJOR_VERSION == 12 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 6\
|
||||
+ || (V8_MINOR_VERSION == 7 && defined(V8_BUILD_NUMBER) \
|
||||
+ && V8_BUILD_NUMBER >= 1)))))
|
||||
+ explicit ScriptOrigin(v8::Local<v8::Value> name) :
|
||||
+ v8::ScriptOrigin(name) {}
|
||||
+
|
||||
+ ScriptOrigin(v8::Local<v8::Value> name
|
||||
+ , v8::Local<v8::Integer> line) :
|
||||
+ v8::ScriptOrigin(name
|
||||
+ , To<int32_t>(line).FromMaybe(0)) {}
|
||||
+
|
||||
+ ScriptOrigin(v8::Local<v8::Value> name
|
||||
+ , v8::Local<v8::Integer> line
|
||||
+ , v8::Local<v8::Integer> column) :
|
||||
+ v8::ScriptOrigin(name
|
||||
+ , To<int32_t>(line).FromMaybe(0)
|
||||
+ , To<int32_t>(column).FromMaybe(0)) {}
|
||||
+#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \
|
||||
(V8_MAJOR_VERSION == 9 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 0\
|
||||
|| (V8_MINOR_VERSION == 0 && defined(V8_BUILD_NUMBER) \
|
||||
&& V8_BUILD_NUMBER >= 1)))))
|
||||
@@ -1,33 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jeremy Rose <japthorp@slack-corp.com>
|
||||
Date: Thu, 5 May 2022 14:14:36 -0700
|
||||
Subject: use new constructor for ScriptOrigin when >= 17.x
|
||||
|
||||
https://chromium-review.googlesource.com/c/v8/v8/+/3395880
|
||||
|
||||
Also
|
||||
See https://chromium-review.googlesource.com/c/v8/v8/+/5539888
|
||||
ScriptOrigin constructor with isolate has been removed;
|
||||
|
||||
diff --git a/test/cpp/news.cpp b/test/cpp/news.cpp
|
||||
index a218167c7e3a5ec90c6668943cb395dba2bbe3a7..b1fa6e2a77e926e38006bf47ffcda2ae86555d17 100644
|
||||
--- a/test/cpp/news.cpp
|
||||
+++ b/test/cpp/news.cpp
|
||||
@@ -115,7 +115,7 @@ NAN_METHOD(NewScript) {
|
||||
|
||||
NAN_METHOD(NewScript2) {
|
||||
v8::ScriptOrigin origin(
|
||||
-#if NODE_MODULE_VERSION >= NODE_18_0_MODULE_VERSION
|
||||
+#if NODE_MODULE_VERSION >= NODE_17_0_MODULE_VERSION && NODE_MODULE_VERSION < NODE_20_0_MODULE_VERSION
|
||||
info.GetIsolate(),
|
||||
#endif
|
||||
New<v8::String>("x").ToLocalChecked());
|
||||
@@ -136,7 +136,7 @@ NAN_METHOD(CompileScript) {
|
||||
|
||||
NAN_METHOD(CompileScript2) {
|
||||
v8::ScriptOrigin origin(
|
||||
-#if NODE_MODULE_VERSION >= NODE_18_0_MODULE_VERSION
|
||||
+#if NODE_MODULE_VERSION >= NODE_17_0_MODULE_VERSION && NODE_MODULE_VERSION < NODE_20_0_MODULE_VERSION
|
||||
info.GetIsolate(),
|
||||
#endif
|
||||
New<v8::String>("x").ToLocalChecked());
|
||||
Reference in New Issue
Block a user