1
0
Fork 0
firefox/testing/web-platform/tests/fetch/api/basic/gc.any.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

19 lines
530 B
JavaScript

// META: global=window,worker
// META: script=/common/gc.js
promise_test(async () => {
let i = 0;
const repeat = 5;
const buffer = await new Response(new ReadableStream({
pull(c) {
if (i >= repeat) {
c.close();
return;
}
++i;
c.enqueue(new Uint8Array([0]))
garbageCollect();
}
})).arrayBuffer();
assert_equals(buffer.byteLength, repeat, `The buffer should be ${repeat}-byte long`);
}, "GC/CC should not abruptly close the stream while being consumed by Response");