From 4b6f839983551b337d154009556927f8135e58f3 Mon Sep 17 00:00:00 2001 From: Georgi Davidkov Date: Wed, 18 Mar 2026 10:59:18 +0200 Subject: [PATCH] Fix nan_weak.h for V8 >= 14.2.194 (missing EmbedderDataTypeTag) Commit fcc7b7d added V8 >= 14.2.194 compatibility guards to nan.h for GetAlignedPointerFromInternalField and SetAlignedPointerInInternalField which now require an additional v8::kEmbedderDataTypeTagDefault tag parameter. However, the same unguarded calls in nan_weak.h were missed, causing build failures with Electron 41+ / V8 >= 14.2.194. Apply the exact same preprocessor guard pattern to all occurrences in nan_weak.h. --- nan_weak.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nan_weak.h b/nan_weak.h index 7e7ab07b..5a3a3707 100644 --- a/nan_weak.h +++ b/nan_weak.h @@ -276,7 +276,15 @@ inline void Persistent::SetWeak( int count = self->InternalFieldCount(); void *internal_fields[kInternalFieldsInWeakCallback] = {0, 0}; for (int i = 0; i < count && i < kInternalFieldsInWeakCallback; i++) { +#if (V8_MAJOR_VERSION > 14) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION > 2) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && V8_BUILD_NUMBER >= 194) + internal_fields[i] = self->GetAlignedPointerFromInternalField( + i, v8::kEmbedderDataTypeTagDefault + ); +# else internal_fields[i] = self->GetAlignedPointerFromInternalField(i); +# endif } wcbd = new WeakCallbackInfo

( reinterpret_cast*>(this) @@ -284,7 +292,15 @@ inline void Persistent::SetWeak( , 0 , internal_fields[0] , internal_fields[1]); +#if (V8_MAJOR_VERSION > 14) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION > 2) || \ + (V8_MAJOR_VERSION == 14 && V8_MINOR_VERSION == 2 && V8_BUILD_NUMBER >= 194) + self->SetAlignedPointerInInternalField( + 0, wcbd, v8::kEmbedderDataTypeTagDefault + ); +# else self->SetAlignedPointerInInternalField(0, wcbd); +# endif v8::PersistentBase::SetWeak( static_cast*>(0) , WeakCallbackInfo

::template invoketwofield