mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-02 09:18:36 +02:00
Nothing strongly grabs ReadableStream nor FetchStreamReader while waiting for nsIAsyncOutputStream to respond. mAsyncWaitReader should now strongly grab the reader until the output stream responds. Differential Revision: https://phabricator.services.mozilla.com/D234031
19 lines
530 B
JavaScript
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");
|