tor-browser

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

oversized-payload.https.window.js (862B)


      1 // META: script=/common/get-host-info.sub.js
      2 // META: script=/common/utils.js
      3 // META: script=/fetch/fetch-later/resources/fetch-later-helper.js
      4 // META: script=/fetch/fetch-later/quota/resources/helper.js
      5 'use strict';
      6 
      7 const OVERSIZED_REQUEST_BODY_SIZE = QUOTA_PER_ORIGIN + 1;
      8 
      9 for (const dataType in BeaconDataType) {
     10  // Test making a POST request with oversized payload, which should be rejected
     11  // by fetchLater API.
     12  test(() => {
     13    assert_throws_quotaexceedederror(() => {
     14      fetchLater('/', {
     15        activateAfter: 0,
     16        method: 'POST',
     17        body: makeBeaconData(
     18            generatePayload(OVERSIZED_REQUEST_BODY_SIZE), dataType),
     19      });
     20    }, null, null);
     21  }, `fetchLater() does not accept payload[size=${
     22          OVERSIZED_REQUEST_BODY_SIZE}] exceeding per-origin quota in a POST request body of ${
     23          dataType}.`);
     24 }