Skip to content

Commit 414f10a

Browse files
committed
fix the API call to mark the buffer as untransferable
nodejs#47557 removed the mark_arraybuffer_as_untransferable API, do it manually instead
1 parent 2dbecd9 commit 414f10a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/js_native_api_v8.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3185,7 +3185,12 @@ napi_create_external_arraybuffer(napi_env env,
31853185
nullptr);
31863186
v8::Local<v8::ArrayBuffer> buffer =
31873187
v8::ArrayBuffer::New(isolate, std::move(backing));
3188-
v8::Maybe<bool> marked = env->mark_arraybuffer_as_untransferable(buffer);
3188+
3189+
// https://github.com/nodejs/node/pull/47557 removed the mark_arraybuffer_as_untransferable API
3190+
// do it manually instead
3191+
v8::Maybe<bool> marked = buffer->SetPrivate(env->context(),
3192+
env->node_env()->untransferable_object_private_symbol(),
3193+
v8::True(isolate));
31893194
CHECK_MAYBE_NOTHING(env, marked, napi_generic_failure);
31903195

31913196
if (finalize_cb != nullptr) {

0 commit comments

Comments
 (0)