tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

response-stream-disturbed-by-pipe.any.js (666B)


      1 // META: global=window,worker
      2 
      3 test(() => {
      4  const r = new Response(new ReadableStream());
      5  // highWaterMark: 0 means that nothing will actually be read from the body.
      6  r.body.pipeTo(new WritableStream({}, {highWaterMark: 0}));
      7  assert_true(r.bodyUsed, 'bodyUsed should be true');
      8 }, 'using pipeTo on Response body should disturb it synchronously');
      9 
     10 test(() => {
     11  const r = new Response(new ReadableStream());
     12  r.body.pipeThrough({
     13    writable: new WritableStream({}, {highWaterMark: 0}),
     14    readable: new ReadableStream()
     15  });
     16  assert_true(r.bodyUsed, 'bodyUsed should be true');
     17 }, 'using pipeThrough on Response body should disturb it synchronously');