tor-browser

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

huge-fetch.any.js (661B)


      1 // META: global=window,worker
      2 
      3 'use strict';
      4 
      5 promise_test(async t => {
      6  const response = await fetch('../resources/huge-response.py');
      7  const reader = response.body.getReader();
      8  // Read one chunk just to show willing.
      9  const { value, done } = await reader.read();
     10  assert_false(done, 'there should be some data');
     11  assert_greater_than(value.byteLength, 0, 'the chunk should be non-empty');
     12  // Wait 2 seconds to give it a chance to crash.
     13  await new Promise(resolve => t.step_timeout(resolve, 2000));
     14  // If we get here without crashing we passed the test.
     15  reader.cancel();
     16 }, 'fetching a huge cacheable file but not reading it should not crash');