tor-browser

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

general.window.js (1207B)


      1 // META: script=resources/utils.js
      2 // META: script=/common/utils.js
      3 
      4 const onload = new Promise(r => window.addEventListener('load', r));
      5 
      6 // It's weird that browsers do this, but it should continue to work.
      7 promise_test(async t => {
      8  await loadScript('resources/partial-script.py?pretend-offset=90000');
      9  assert_true(self.scriptExecuted);
     10 }, `Script executed from partial response`);
     11 
     12 promise_test(async () => {
     13  const wavURL = new URL('resources/long-wav.py', location);
     14  const stashTakeURL = new URL('resources/stash-take.py', location);
     15  const stashToken = token();
     16  wavURL.searchParams.set('accept-encoding-key', stashToken);
     17  stashTakeURL.searchParams.set('key', stashToken);
     18 
     19  // The testing framework waits for window onload. If the audio element
     20  // is appended before onload, it extends it, and the test times out.
     21  await onload;
     22 
     23  const audio = appendAudio(document, wavURL);
     24  await new Promise(r => audio.addEventListener('progress', r));
     25  audio.remove();
     26 
     27  const response = await fetch(stashTakeURL);
     28  assert_equals(await response.json(), 'identity', `Expect identity accept-encoding on media request`);
     29 }, `Fetch with range header will be sent with Accept-Encoding: identity`);