Skip to content

Commit ce32638

Browse files
targosnodejs-github-bot
authored andcommitted
[hack] fix ArrayBuffer::Detach deprecation
1 parent 1a767ce commit ce32638

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/js_native_api_v8.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -3239,7 +3239,7 @@ napi_status NAPI_CDECL napi_detach_arraybuffer(napi_env env,
32393239
RETURN_STATUS_IF_FALSE(
32403240
env, it->IsDetachable(), napi_detachable_arraybuffer_expected);
32413241

3242-
it->Detach();
3242+
it->Detach(v8::Local<v8::Value>()).Check();
32433243

32443244
return napi_clear_last_error(env);
32453245
}

src/node_blob.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void Blob::New(const FunctionCallbackInfo<Value>& args) {
107107
CHECK_EQ(view->ByteOffset(), 0);
108108
std::shared_ptr<BackingStore> store = view->Buffer()->GetBackingStore();
109109
size_t byte_length = view->ByteLength();
110-
view->Buffer()->Detach(); // The Blob will own the backing store now.
110+
view->Buffer()->Detach(Local<Value>()).Check(); // The Blob will own the backing store now.
111111
entries.emplace_back(BlobEntry{std::move(store), byte_length, 0});
112112
len += byte_length;
113113
} else {

src/node_buffer.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ Local<ArrayBuffer> CallbackInfo::CreateTrackedArrayBuffer(
125125
// V8 simply ignores the BackingStore deleter callback if data == nullptr,
126126
// but our API contract requires it being called.
127127
if (data == nullptr) {
128-
ab->Detach();
128+
ab->Detach(Local<Value>()).Check();
129129
self->OnBackingStoreFree(); // This calls `callback` asynchronously.
130130
} else {
131131
// Store the ArrayBuffer so that we can detach it later.
@@ -156,7 +156,7 @@ void CallbackInfo::CleanupHook(void* data) {
156156
HandleScope handle_scope(self->env_->isolate());
157157
Local<ArrayBuffer> ab = self->persistent_.Get(self->env_->isolate());
158158
if (!ab.IsEmpty() && ab->IsDetachable()) {
159-
ab->Detach();
159+
ab->Detach(Local<Value>()).Check();
160160
self->persistent_.Reset();
161161
}
162162
}
@@ -1255,7 +1255,7 @@ void DetachArrayBuffer(const FunctionCallbackInfo<Value>& args) {
12551255
Local<ArrayBuffer> buf = args[0].As<ArrayBuffer>();
12561256
if (buf->IsDetachable()) {
12571257
std::shared_ptr<BackingStore> store = buf->GetBackingStore();
1258-
buf->Detach();
1258+
buf->Detach(Local<Value>()).Check();
12591259
args.GetReturnValue().Set(ArrayBuffer::New(env->isolate(), store));
12601260
}
12611261
}

src/node_messaging.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ Maybe<bool> Message::Serialize(Environment* env,
516516
for (Local<ArrayBuffer> ab : array_buffers) {
517517
// If serialization succeeded, we render it inaccessible in this Isolate.
518518
std::shared_ptr<BackingStore> backing_store = ab->GetBackingStore();
519-
ab->Detach();
519+
ab->Detach(Local<Value>()).Check();
520520

521521
array_buffers_.emplace_back(std::move(backing_store));
522522
}

0 commit comments

Comments
 (0)