tor-browser

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

echo-large-bidirectional-streams.https.any.js (904B)


      1 // META: global=window,worker
      2 // META: script=/common/get-host-info.sub.js
      3 // META: script=resources/webtransport-test-helpers.sub.js
      4 
      5 // A test that aims to reproduce https://crbug.com/1369030 -- note that since
      6 // the bug in question is a race condition, this test will probably be flaky if
      7 // this is actually broken.
      8 promise_test(async t => {
      9  const wt = new WebTransport(webtransport_url('echo.py'));
     10  await wt.ready;
     11 
     12  const numBytes = 1024 * 1024;
     13  const numStreams = 5;
     14  for (let i = 0; i < numStreams; i++) {
     15    const stream = await wt.createBidirectionalStream();
     16    const writer = stream.writable.getWriter();
     17    await writer.write(new Uint8Array(numBytes));
     18    await writer.close();
     19    const response = await (new Response(stream.readable).arrayBuffer());
     20    assert_equals(response.byteLength, numBytes);
     21  }
     22 }, 'Ensure large bidirectional streams does not cause race condition');