--- remote/node_modules/nan/nan_callbacks_12_inl.h.orig 2026-06-04 08:41:57 UTC +++ remote/node_modules/nan/nan_callbacks_12_inl.h @@ -178,14 +178,27 @@ class PropertyCallbackInfo { NAN_DISALLOW_ASSIGN_COPY_MOVE(PropertyCallbackInfo) }; +// Gated on V8_EXTERNAL_POINTER_TAG_COUNT (defined alongside the tagged +// Value() API) rather than a V8_MAJOR_VERSION cutoff, since Node and +// Chromium/Electron ship divergent V8 snapshots under the same major. +// Tag must match the one used by imp::NewExternal. +inline void* GetExternalValue(v8::Local ext) { +#ifdef V8_EXTERNAL_POINTER_TAG_COUNT + return ext->Value(v8::kExternalPointerTypeTagDefault); +#else + return ext->Value(); +#endif +} + namespace imp { + static void FunctionCallbackWrapper(const v8::FunctionCallbackInfo &info) { v8::Local obj = info.Data().As(); FunctionCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kFunctionIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kFunctionIndex) + .As().As()))); FunctionCallbackInfo cbinfo(info, obj->GetInternalField(kDataIndex).As()); callback(cbinfo); @@ -203,8 +216,8 @@ void GetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); GetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kGetterIndex) + .As().As()))); callback(property.As(), cbinfo); } @@ -221,8 +234,8 @@ void SetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); SetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kSetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kSetterIndex) + .As().As()))); callback(property.As(), value, cbinfo); } @@ -240,8 +253,8 @@ void GetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); GetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kGetterIndex) + .As().As()))); callback(property, cbinfo); } @@ -258,8 +271,8 @@ void SetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); SetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kSetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kSetterIndex) + .As().As()))); callback(property, value, cbinfo); } @@ -282,8 +295,8 @@ v8::Intercepted PropertyGetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyGetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyGetterIndex) + .As().As()))); return callback(property.As(), cbinfo); } @@ -300,8 +313,8 @@ v8::Intercepted PropertySetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertySetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertySetterIndex) + .As().As()))); return callback(property.As(), value, cbinfo); } @@ -320,8 +333,8 @@ void PropertyGetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyGetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyGetterIndex) + .As().As()))); callback(property.As(), cbinfo); } @@ -338,8 +351,8 @@ void PropertySetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertySetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertySetterIndex) + .As().As()))); callback(property.As(), value, cbinfo); } @@ -357,8 +370,8 @@ void PropertyEnumeratorCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyEnumeratorCallback callback = reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyEnumeratorIndex) + .As().As()))); callback(cbinfo); } @@ -376,8 +389,8 @@ v8::Intercepted PropertyDeleterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyDeleterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyDeleterIndex) + .As().As()))); return callback(property.As(), cbinfo); } @@ -394,8 +407,8 @@ v8::Intercepted PropertyQueryCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyQueryCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyQueryIndex) + .As().As()))); return callback(property.As(), cbinfo); } @@ -411,8 +424,8 @@ void PropertyDeleterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyDeleterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyDeleterIndex) + .As().As()))); callback(property.As(), cbinfo); } @@ -428,8 +441,8 @@ void PropertyQueryCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyQueryCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyQueryIndex) + .As().As()))); callback(property.As(), cbinfo); } @@ -446,8 +459,8 @@ void PropertyGetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyGetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyGetterIndex) + .As().As()))); callback(property, cbinfo); } @@ -464,8 +477,8 @@ void PropertySetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertySetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertySetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertySetterIndex) + .As().As()))); callback(property, value, cbinfo); } @@ -482,8 +495,8 @@ void PropertyEnumeratorCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyEnumeratorCallback callback = reinterpret_cast(reinterpret_cast( - obj->GetInternalField(kPropertyEnumeratorIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyEnumeratorIndex) + .As().As()))); callback(cbinfo); } @@ -499,8 +512,8 @@ void PropertyDeleterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyDeleterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyDeleterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyDeleterIndex) + .As().As()))); callback(property, cbinfo); } @@ -516,8 +529,8 @@ void PropertyQueryCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); PropertyQueryCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kPropertyQueryIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kPropertyQueryIndex) + .As().As()))); callback(property, cbinfo); } @@ -535,8 +548,8 @@ v8::Intercepted IndexGetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexGetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kIndexPropertyGetterIndex) + .As().As()))); return callback(index, cbinfo); } @@ -553,8 +566,8 @@ v8::Intercepted IndexSetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexSetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kIndexPropertySetterIndex) + .As().As()))); return callback(index, value, cbinfo); } @@ -572,8 +585,8 @@ void IndexGetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexGetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertyGetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kIndexPropertyGetterIndex) + .As().As()))); callback(index, cbinfo); } @@ -589,8 +602,8 @@ void IndexSetterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexSetterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertySetterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kIndexPropertySetterIndex) + .As().As()))); callback(index, value, cbinfo); } @@ -609,9 +622,9 @@ void IndexEnumeratorCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexEnumeratorCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField( + Nan::GetExternalValue(obj->GetInternalField( kIndexPropertyEnumeratorIndex) - .As().As()->Value())); + .As().As()))); callback(cbinfo); } @@ -628,8 +641,9 @@ v8::Intercepted IndexDeleterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexDeleterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField( + kIndexPropertyDeleterIndex) + .As().As()))); return callback(index, cbinfo); } @@ -644,8 +658,8 @@ v8::Intercepted IndexQueryCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexQueryCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kIndexPropertyQueryIndex) + .As().As()))); return callback(index, cbinfo); } @@ -660,8 +674,9 @@ void IndexDeleterCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexDeleterCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertyDeleterIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField( + kIndexPropertyDeleterIndex) + .As().As()))); callback(index, cbinfo); } @@ -676,8 +691,8 @@ void IndexQueryCallbackWrapper( cbinfo(info, obj->GetInternalField(kDataIndex).As()); IndexQueryCallback callback = reinterpret_cast( reinterpret_cast( - obj->GetInternalField(kIndexPropertyQueryIndex) - .As().As()->Value())); + Nan::GetExternalValue(obj->GetInternalField(kIndexPropertyQueryIndex) + .As().As()))); callback(index, cbinfo); }