Skip to content

Commit 2aa101b

Browse files
committed
src: allow Blob reader setWakeup(undefined) to clear wakeup
Backport prerequisite for the previous commit (backport of #63577). The Blob.stream() leak fix clears the reader's wakeup handle by calling reader.setWakeup(undefined) on every terminal/idle path. On main the C++ Blob::Reader::SetWakeup already tolerates an undefined argument (resetting the strong wakeup_ handle), but that guard is not present on v24.x -- it landed incidentally in the large QUIC implementation commit cf91d18 (#62876), which is not itself being backported. Extract only the minimal node_blob.cc SetWakeup hunk from that commit so the JS fix works on v24.x. Without it, setWakeup(undefined) aborts with `Assertion failed: args[0]->IsFunction()` at src/node_blob.cc. The NotifyPull(fin)/pull_pending_ coalescing from the same upstream commit is QUIC-specific, not required by the leak fix, and is intentionally omitted. Refs: #63577 Refs: #62876 Signed-off-by: Gabe Bryk <gbryk11@gmail.com>
1 parent 1c0975c commit 2aa101b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/node_blob.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ void Blob::Reader::Pull(const FunctionCallbackInfo<Value>& args) {
414414
void Blob::Reader::SetWakeup(const FunctionCallbackInfo<Value>& args) {
415415
Blob::Reader* reader;
416416
ASSIGN_OR_RETURN_UNWRAP(&reader, args.This());
417+
if (args[0]->IsUndefined()) {
418+
reader->wakeup_.Reset();
419+
return;
420+
}
417421
CHECK(args[0]->IsFunction());
418422
reader->wakeup_.Reset(args.GetIsolate(), args[0].As<Function>());
419423
}

0 commit comments

Comments
 (0)