tor-browser

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

permissions-policy-header-policy-allowed-for-malformed-wildcard.https.sub.html (2544B)


      1 <!DOCTYPE html>
      2 <body>
      3  <script src=/resources/testharness.js></script>
      4  <script src=/resources/testharnessreport.js></script>
      5  <script src=/permissions-policy/resources/permissions-policy.js></script>
      6  <!-- Permissions-Policy: fullscreen=$MALFORMED_WILDCARD_ORIGINS self; -->
      7  <script>
      8  'use strict';
      9  var same_origin = 'https://{{domains[]}}:{{ports[https][0]}}';
     10  var cross_origin = 'https://{{domains[www]}}:{{ports[https][0]}}';
     11  var cross_origin1 = 'https://{{domains[www1]}}:{{ports[https][0]}}';
     12  var same_origin_src = '/permissions-policy/resources/permissions-policy-allowedfeatures.html';
     13  var cross_origin_src = cross_origin + same_origin_src;
     14  var cross_origin_src1 = cross_origin1 + same_origin_src;
     15  var header_policy = `Permissions-Policy: fullscreen=("$MALFORMED_WILDCARD_ORIGINS self")`;
     16 
     17  // Test that fullscreen's allowlist lists all the malformed wildcards and self.
     18  test(function() {
     19    assert_array_equals(
     20      document.featurePolicy.getAllowlistForFeature('fullscreen').sort(),
     21      ["https://*.example.com", "https://{{domains[]}}:{{ports[https][0]}}"].sort());
     22  }, header_policy + ' -- test allowlist lists all the malformed wildcards and self.');
     23 
     24  // Test that fullscreen is allowed on same-origin subframes with or without an allow attribute.
     25  test_allowed_feature_for_subframe(
     26    header_policy + ' -- test fullscreen is allowed on same-origin subframe',
     27    'fullscreen',
     28    same_origin_src);
     29  test_allowed_feature_for_subframe(
     30    header_policy + ' -- test fullscreen is allowed on same-origin subframe with allow attribute',
     31    'fullscreen',
     32    same_origin_src,
     33    "fullscreen " + same_origin);
     34 
     35  // Test that fullscreen is disallowed on cross-origin subframes without an allow attribute.
     36  test_disallowed_feature_for_subframe(
     37    header_policy + ' -- test fullscreen is disallowed on cross-origin subframe',
     38    'fullscreen',
     39    cross_origin_src);
     40  test_disallowed_feature_for_subframe(
     41    header_policy + ' -- test fullscreen is disallowed on cross-origin subframe allow attribute',
     42    'fullscreen',
     43    cross_origin_src,
     44    "fullscreen " + cross_origin);
     45  test_disallowed_feature_for_subframe(
     46    header_policy + ' -- test fullscreen is disallowed on another cross-origin subframe',
     47    'fullscreen',
     48    cross_origin_src1);
     49  test_disallowed_feature_for_subframe(
     50    header_policy + ' -- test fullscreen is disallowed on another cross-origin subframe allow attribute',
     51    'fullscreen',
     52    cross_origin_src1,
     53    "fullscreen " + cross_origin1);
     54  </script>
     55 </body>