File e33-nan-IdleNotificationDeadline.patch of Package code
From a7df36eda8a7fe8581c00a18590f5e4faafca7ae Mon Sep 17 00:00:00 2001
From: Toshiyuki Ogawa <toshi@oc-soft.net>
Date: Thu, 10 Oct 2024 08:39:41 +0900
Subject: [PATCH] Support for node version 20.17.0 (#976)
* Support for electron 32
refs #973
---
README.md | 2 +-
doc/v8_internals.md | 8 +--
nan.h | 64 ++++++++++++++++-
nan_callbacks.h | 38 +++++++++-
nan_callbacks_12_inl.h | 158 ++++++++++++++++++++++++++++++++++++++++-
nan_scriptorigin.h | 19 ++++-
6 files changed, 278 insertions(+), 11 deletions(-)
diff --git a/nan.h b/nan.h
index decc804c..ca11a77a 100644
--- a/build/node_modules/nan/nan.h
+++ b/build/node_modules/nan/nan.h
@@ -694,14 +694,21 @@ 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 > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && \
+ V8_MINOR_VERSION >= 7))
+ NAN_DEPRECATED inline bool IdleNotification(int) {
+ 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) {
+ NAN_DEPRECATED inline bool IdleNotification(int idle_time_in_ms) {
return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
idle_time_in_ms * 0.001);
}
# else
- inline bool IdleNotification(int idle_time_in_ms) {
+ NAN_DEPRECATED inline bool IdleNotification(int idle_time_in_ms) {
return v8::Isolate::GetCurrent()->IdleNotification(idle_time_in_ms);
}
#endif
@@ -1546,11 +1553,23 @@ typedef void NAN_SETTER_RETURN_TYPE;
typedef const PropertyCallbackInfo<v8::Value>&
NAN_PROPERTY_GETTER_ARGS_TYPE;
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_PROPERTY_GETTER_RETURN_TYPE;
+#else
typedef void NAN_PROPERTY_GETTER_RETURN_TYPE;
+#endif
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef const PropertyCallbackInfo<void>&
+ NAN_PROPERTY_SETTER_ARGS_TYPE;
+typedef v8::Intercepted NAN_PROPERTY_SETTER_RETURN_TYPE;
+#else
typedef const PropertyCallbackInfo<v8::Value>&
NAN_PROPERTY_SETTER_ARGS_TYPE;
typedef void NAN_PROPERTY_SETTER_RETURN_TYPE;
+#endif
typedef const PropertyCallbackInfo<v8::Array>&
NAN_PROPERTY_ENUMERATOR_ARGS_TYPE;
@@ -1558,29 +1577,68 @@ typedef void NAN_PROPERTY_ENUMERATOR_RETURN_TYPE;
typedef const PropertyCallbackInfo<v8::Boolean>&
NAN_PROPERTY_DELETER_ARGS_TYPE;
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_PROPERTY_DELETER_RETURN_TYPE;
+#else
typedef void NAN_PROPERTY_DELETER_RETURN_TYPE;
+#endif
+
typedef const PropertyCallbackInfo<v8::Integer>&
NAN_PROPERTY_QUERY_ARGS_TYPE;
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_PROPERTY_QUERY_RETURN_TYPE;
+#else
typedef void NAN_PROPERTY_QUERY_RETURN_TYPE;
+#endif
typedef const PropertyCallbackInfo<v8::Value>& NAN_INDEX_GETTER_ARGS_TYPE;
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_INDEX_GETTER_RETURN_TYPE;
+#else
typedef void NAN_INDEX_GETTER_RETURN_TYPE;
+#endif
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef const PropertyCallbackInfo<void>& NAN_INDEX_SETTER_ARGS_TYPE;
+typedef v8::Intercepted NAN_INDEX_SETTER_RETURN_TYPE;
+#else
typedef const PropertyCallbackInfo<v8::Value>& NAN_INDEX_SETTER_ARGS_TYPE;
typedef void NAN_INDEX_SETTER_RETURN_TYPE;
+#endif
typedef const PropertyCallbackInfo<v8::Array>&
NAN_INDEX_ENUMERATOR_ARGS_TYPE;
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_INDEX_ENUMERATOR_RETURN_TYPE;
+#else
typedef void NAN_INDEX_ENUMERATOR_RETURN_TYPE;
+#endif
typedef const PropertyCallbackInfo<v8::Boolean>&
NAN_INDEX_DELETER_ARGS_TYPE;
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_INDEX_DELETER_RETURN_TYPE;
+#else
typedef void NAN_INDEX_DELETER_RETURN_TYPE;
+#endif
typedef const PropertyCallbackInfo<v8::Integer>&
NAN_INDEX_QUERY_ARGS_TYPE;
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted NAN_INDEX_QUERY_RETURN_TYPE;
+#else
typedef void NAN_INDEX_QUERY_RETURN_TYPE;
+#endif
#define NAN_METHOD(name) \
Nan::NAN_METHOD_RETURN_TYPE name(Nan::NAN_METHOD_ARGS_TYPE info)
diff --git a/nan_callbacks.h b/nan_callbacks.h
index 93eb2ab4..2c54857f 100644
--- a/build/node_modules/nan/nan_callbacks.h
+++ b/build/node_modules/nan/nan_callbacks.h
@@ -20,6 +20,17 @@ typedef void(*SetterCallback)(
v8::Local<v8::String>,
v8::Local<v8::Value>,
const PropertyCallbackInfo<void>&);
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted(*PropertyGetterCallback)(
+ v8::Local<v8::String>,
+ const PropertyCallbackInfo<v8::Value>&);
+typedef v8::Intercepted(*PropertySetterCallback)(
+ v8::Local<v8::String>,
+ v8::Local<v8::Value>,
+ const PropertyCallbackInfo<void>&);
+#else
typedef void(*PropertyGetterCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Value>&);
@@ -27,8 +38,33 @@ typedef void(*PropertySetterCallback)(
v8::Local<v8::String>,
v8::Local<v8::Value>,
const PropertyCallbackInfo<v8::Value>&);
+#endif
typedef void(*PropertyEnumeratorCallback)
(const PropertyCallbackInfo<v8::Array>&);
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+typedef v8::Intercepted(*PropertyDeleterCallback)(
+ v8::Local<v8::String>,
+ const PropertyCallbackInfo<v8::Boolean>&);
+typedef v8::Intercepted(*PropertyQueryCallback)(
+ v8::Local<v8::String>,
+ const PropertyCallbackInfo<v8::Integer>&);
+typedef v8::Intercepted(*IndexGetterCallback)(
+ uint32_t,
+ const PropertyCallbackInfo<v8::Value>&);
+typedef v8::Intercepted(*IndexSetterCallback)(
+ uint32_t,
+ v8::Local<v8::Value>,
+ const PropertyCallbackInfo<void>&);
+typedef v8::Intercepted(*IndexEnumeratorCallback)
+ (const PropertyCallbackInfo<v8::Array>&);
+typedef v8::Intercepted(*IndexDeleterCallback)(
+ uint32_t,
+ const PropertyCallbackInfo<v8::Boolean>&);
+typedef v8::Intercepted(*IndexQueryCallback)(
+ uint32_t,
+ const PropertyCallbackInfo<v8::Integer>&);
+#else
typedef void(*PropertyDeleterCallback)(
v8::Local<v8::String>,
const PropertyCallbackInfo<v8::Boolean>&);
@@ -50,7 +86,7 @@ typedef void(*IndexDeleterCallback)(
typedef void(*IndexQueryCallback)(
uint32_t,
const PropertyCallbackInfo<v8::Integer>&);
-
+#endif
namespace imp {
#if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION)
typedef v8::Local<v8::AccessorSignature> Sig;
diff --git a/nan_callbacks_12_inl.h b/nan_callbacks_12_inl.h
index bbcde4d6..f953989a 100644
--- a/build/node_modules/nan/nan_callbacks_12_inl.h
+++ b/build/node_modules/nan/nan_callbacks_12_inl.h
@@ -256,6 +256,47 @@ typedef void (*NativeSetter)(
#endif
#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+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()));
+ return callback(property.As<v8::String>(), cbinfo);
+}
+
+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()));
+ return callback(property.As<v8::String>(), value, cbinfo);
+}
+
+typedef v8::Intercepted (*NativePropertySetter)(
+ v8::Local<v8::Name>
+ , v8::Local<v8::Value>
+ , const v8::PropertyCallbackInfo<void> &);
+
+#else
static
void PropertyGetterCallbackWrapper(
v8::Local<v8::Name> property
@@ -292,6 +333,7 @@ typedef void (*NativePropertySetter)(
v8::Local<v8::Name>
, v8::Local<v8::Value>
, const v8::PropertyCallbackInfo<v8::Value> &);
+#endif
static
void PropertyEnumeratorCallbackWrapper(
@@ -309,6 +351,43 @@ void PropertyEnumeratorCallbackWrapper(
typedef void (*NativePropertyEnumerator)
(const v8::PropertyCallbackInfo<v8::Array> &);
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+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()));
+ return callback(property.As<v8::String>(), cbinfo);
+}
+
+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()));
+ return callback(property.As<v8::String>(), cbinfo);
+}
+
+typedef v8::Intercepted (*NativePropertyQuery)
+ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
+#else
static
void PropertyDeleterCallbackWrapper(
v8::Local<v8::Name> property
@@ -342,6 +421,7 @@ void PropertyQueryCallbackWrapper(
typedef void (*NativePropertyQuery)
(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
+#endif
#else
static
void PropertyGetterCallbackWrapper(
@@ -431,6 +511,45 @@ typedef void (*NativePropertyQuery)
(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &);
#endif
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+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()));
+ return callback(index, cbinfo);
+}
+
+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()));
+ return callback(index, value, cbinfo);
+}
+
+typedef v8::Intercepted (*NativeIndexSetter)(
+ uint32_t
+ , v8::Local<v8::Value>
+ , const v8::PropertyCallbackInfo<void> &);
+
+#else
static
void IndexGetterCallbackWrapper(
uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
@@ -446,7 +565,6 @@ void IndexGetterCallbackWrapper(
typedef void (*NativeIndexGetter)
(uint32_t, const v8::PropertyCallbackInfo<v8::Value> &);
-
static
void IndexSetterCallbackWrapper(
uint32_t index
@@ -467,6 +585,8 @@ typedef void (*NativeIndexSetter)(
, v8::Local<v8::Value>
, const v8::PropertyCallbackInfo<v8::Value> &);
+#endif
+
static
void IndexEnumeratorCallbackWrapper(
const v8::PropertyCallbackInfo<v8::Array> &info) {
@@ -484,6 +604,40 @@ void IndexEnumeratorCallbackWrapper(
typedef void (*NativeIndexEnumerator)
(const v8::PropertyCallbackInfo<v8::Array> &);
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
+ (V8_MAJOR_VERSION == 12 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 4))
+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()));
+ return callback(index, cbinfo);
+}
+
+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()));
+ return callback(index, cbinfo);
+}
+
+typedef v8::Intercepted (*NativeIndexQuery)
+ (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
+#else
static
void IndexDeleterCallbackWrapper(
uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
@@ -515,6 +669,8 @@ void IndexQueryCallbackWrapper(
typedef void (*NativeIndexQuery)
(uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
+
+#endif
} // end of namespace imp
#endif // NAN_CALLBACKS_12_INL_H_
diff --git a/nan_scriptorigin.h b/nan_scriptorigin.h
index ce79cdf8..04e55cf5 100644
--- a/build/node_modules/nan/nan_scriptorigin.h
+++ b/build/node_modules/nan/nan_scriptorigin.h
@@ -11,7 +11,24 @@
class ScriptOrigin : public v8::ScriptOrigin {
public:
-#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \
+
+#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 11 \
+ && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION > 7)
+ 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)))))