gc.any.js (530B)
1 // META: global=window,worker 2 // META: script=/common/gc.js 3 4 promise_test(async () => { 5 let i = 0; 6 const repeat = 5; 7 const buffer = await new Response(new ReadableStream({ 8 pull(c) { 9 if (i >= repeat) { 10 c.close(); 11 return; 12 } 13 ++i; 14 c.enqueue(new Uint8Array([0])) 15 garbageCollect(); 16 } 17 })).arrayBuffer(); 18 assert_equals(buffer.byteLength, repeat, `The buffer should be ${repeat}-byte long`); 19 }, "GC/CC should not abruptly close the stream while being consumed by Response");