tor-browser

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

deferred-fetch-allowed-by-permissions-policy.https.window.js (1644B)


      1 // META: title=Permissions Policy "deferred-fetch" is allowed
      2 // META: script=/permissions-policy/resources/permissions-policy.js
      3 // META: script=/common/utils.js
      4 // META: script=/common/get-host-info.sub.js
      5 // META: script=/fetch/fetch-later/resources/fetch-later-helper.js
      6 // META: script=/fetch/fetch-later/permissions-policy/resources/helper.js
      7 // META: timeout=long
      8 'use strict';
      9 
     10 const {
     11  HTTPS_ORIGIN,
     12  HTTPS_NOTSAMESITE_ORIGIN,
     13 } = get_host_info();
     14 
     15 const description = 'Permissions policy header: "deferred-fetch=*"';
     16 
     17 parallelPromiseTest(async _ => {
     18  const uuid = token();
     19  const url = generateSetBeaconURL(uuid);
     20 
     21  // Request the browser to fetchLater() immediately.
     22  fetchLater(url, {activateAfter: 0});
     23 
     24  await expectBeacon(uuid, {count: 1});
     25 }, `${description} allows fetchLater() in the top-level document.`);
     26 
     27 async_test(t => {
     28  test_feature_availability(
     29      'fetchLater()', t, getDeferredFetchPolicyInIframeHelperUrl(HTTPS_ORIGIN),
     30      expect_feature_available_default);
     31 }, `${description} allows fetchLater() in the same-origin iframe.`);
     32 
     33 async_test(t => {
     34  test_feature_availability(
     35      'fetchLater()', t,
     36      getDeferredFetchPolicyInIframeHelperUrl(HTTPS_NOTSAMESITE_ORIGIN),
     37      expect_feature_available_default);
     38 }, `${description} allows fetchLater() in the cross-origin iframe.`);
     39 
     40 async_test(t => {
     41  test_feature_availability(
     42      'fetchLater()', t,
     43      getDeferredFetchPolicyInIframeHelperUrl(HTTPS_NOTSAMESITE_ORIGIN),
     44      expect_feature_available_default, /*feature_name=*/ 'deferred-fetch');
     45 }, `${description} allow="deferred-fetch" allows fetchLater() in the cross-origin iframe.`);