response-from-stream.any.js (809B)
1 // META: global=window,worker 2 3 "use strict"; 4 5 test(() => { 6 const stream = new ReadableStream(); 7 stream.getReader(); 8 assert_throws_js(TypeError, () => new Response(stream)); 9 }, "Constructing a Response with a stream on which getReader() is called"); 10 11 test(() => { 12 const stream = new ReadableStream(); 13 stream.getReader().read(); 14 assert_throws_js(TypeError, () => new Response(stream)); 15 }, "Constructing a Response with a stream on which read() is called"); 16 17 promise_test(async () => { 18 const stream = new ReadableStream({ pull: c => c.enqueue(new Uint8Array()) }), 19 reader = stream.getReader(); 20 await reader.read(); 21 reader.releaseLock(); 22 assert_throws_js(TypeError, () => new Response(stream)); 23 }, "Constructing a Response with a stream on which read() and releaseLock() are called");