tor-browser

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

not-send-after-abort.https.window.js (804B)


      1 // META: script=/common/utils.js
      2 // META: script=/fetch/fetch-later/resources/fetch-later-helper.js
      3 
      4 'use strict';
      5 
      6 parallelPromiseTest(async t => {
      7  const uuid = token();
      8  const url = generateSetBeaconURL(uuid);
      9 
     10  // Loads an iframe that creates 2 fetchLater requests. One of them is aborted.
     11  const iframe = await loadScriptAsIframe(`
     12    const url = '${url}';
     13    const controller = new AbortController();
     14    fetchLater(url, {signal: controller.signal});
     15    fetchLater(url, {method: 'POST'});
     16    controller.abort();
     17  `);
     18  // Delete the iframe to trigger deferred request sending.
     19  document.body.removeChild(iframe);
     20 
     21  // The iframe should not send the aborted request.
     22  await expectBeacon(uuid, {count: 1});
     23 }, 'A discarded document does not send an already aborted fetchLater request.');