Skip to content

Commit 743db02

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 f4bda29 commit 743db02

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
@@ -3119,7 +3119,12 @@ napi_create_external_arraybuffer(napi_env env,
31193119
nullptr);
31203120
v8::Local<v8::ArrayBuffer> buffer =
31213121
v8::ArrayBuffer::New(isolate, std::move(backing));
3122-
v8::Maybe<bool> marked = env->mark_arraybuffer_as_untransferable(buffer);
3122+
3123+
// https://github.com/nodejs/node/pull/47557 removed the mark_arraybuffer_as_untransferable API
3124+
// do it manually instead
3125+
v8::Maybe<bool> marked = buffer->SetPrivate(env->context(),
3126+
env->node_env()->untransferable_object_private_symbol(),
3127+
v8::True(isolate));
31233128
CHECK_MAYBE_NOTHING(env, marked, napi_generic_failure);
31243129

31253130
if (finalize_cb != nullptr) {

0 commit comments

Comments
 (0)