Skip to content

Commit

Permalink
Keep UnderlyingSourceAlgorithms alive until it's explicitly closed
Browse files Browse the repository at this point in the history
1. Adding mAsyncWaitAlgorithms to match mAsyncWaitWorkerRef and keep the algorithms object just like how the workerref is kept right now.
2. Closing mInput also on the window teardown, to prevent memory leak as Fetch does not close the stream automatically.

Depends on D193295

Differential Revision: https://phabricator.services.mozilla.com/D190058

bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1849860
gecko-commit: b81979c8bd150c344ec943a6ccb0c14b39371478
gecko-reviewers: smaug, asuth
  • Loading branch information
saschanaz authored and moz-wptsync-bot committed Nov 24, 2023
1 parent c9ee8a3 commit b8302fc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion FileAPI/blob/Blob-stream.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ promise_test(async() => {
await garbageCollect();
const chunks = await read_all_chunks(stream, { perform_gc: true });
assert_array_equals(chunks, input_arr);
}, "Blob.stream() garbage collection of blob shouldn't break stream" +
}, "Blob.stream() garbage collection of blob shouldn't break stream " +
"consumption")

promise_test(async() => {
const input_arr = [8, 241, 48, 123, 151];
const typed_arr = new Uint8Array(input_arr);
let blob = new Blob([typed_arr]);
const chunksPromise = read_all_chunks(blob.stream());
// It somehow matters to do GC here instead of doing `perform_gc: true`
await garbageCollect();
assert_array_equals(await chunksPromise, input_arr);
}, "Blob.stream() garbage collection of stream shouldn't break stream " +
"consumption")

promise_test(async () => {
Expand Down

0 comments on commit b8302fc

Please sign in to comment.