tor-browser

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

default-enabled-features-attribute-allow.https.html (2967B)


      1 <!DOCTYPE html>
      2 <title>Test default permission policy features with allow="" attribute</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/common/utils.js"></script>
      6 <script src="/common/dispatcher/dispatcher.js"></script>
      7 <script src="resources/utils.js"></script>
      8 <script src="/common/get-host-info.sub.js"></script>
      9 <script src="resources/default-enabled-features-helper.js"></script>
     10 
     11 <body>
     12 <script>
     13 promise_test(async(t) => {
     14  await runDefaultEnabledFeaturesTest(t, /*should_load=*/true,
     15      get_host_info().ORIGIN,
     16      generator_api="fledge",
     17      allow="shared-storage *; attribution-reporting *");
     18  await runDefaultEnabledFeaturesTest(t, /*should_load=*/true,
     19      get_host_info().ORIGIN,
     20      generator_api="sharedstorage",
     21      allow="shared-storage *; attribution-reporting *");
     22 }, 'Same-origin fenced frame with allow attribute enabling required features');
     23 
     24 promise_test(async(t) => {
     25  await runDefaultEnabledFeaturesTest(t, /*should_load=*/true,
     26      get_host_info().REMOTE_ORIGIN,
     27      generator_api="fledge",
     28      allow="shared-storage *; attribution-reporting *");
     29  await runDefaultEnabledFeaturesTest(t, /*should_load=*/true,
     30      get_host_info().REMOTE_ORIGIN,
     31      generator_api="sharedstorage",
     32      allow="shared-storage *; attribution-reporting *");
     33 }, 'Cross-origin fenced frame with allow attribute enabling required features');
     34 
     35 promise_test(async(t) => {
     36  const fencedframe = await attachFencedFrameContext({
     37        generator_api: "fledge",
     38        headers: [["Permissions-Policy", "attribution-reporting=()"]],
     39        origin: get_host_info().ORIGIN});
     40 
     41  await fencedframe.execute(async () => {
     42    assert_false(document.featurePolicy.allowsFeature('attribution-reporting'),
     43        "Attribution reporting should NOT be allowed in the fenced frame.");
     44  }, []);
     45 }, 'Delivered policies can further restrict permissions of a fixed ' +
     46   'permissions fenced frame');
     47 
     48 promise_test(async(t) => {
     49  const fencedframe = await attachFencedFrameContext({
     50      headers: [["Permissions-Policy", "shared-storage=()"]],
     51      origin: get_host_info().ORIGIN});
     52 
     53  await fencedframe.execute(async () => {
     54    assert_false(
     55        document.featurePolicy.allowsFeature('shared-storage'),
     56        "Shared storage should not be allowed in the fenced frame.");
     57    assert_true(
     58        document.featurePolicy.allowsFeature('private-aggregation'),
     59        "Private aggregation should be allowed in the fenced frame.");
     60    assert_false(
     61        document.featurePolicy.allowsFeature('attribution-reporting'),
     62        "Attribution reporting should be disallowed in the fenced frame.");
     63    assert_false(
     64        document.featurePolicy.allowsFeature('sync-xhr'),
     65        "USB access should be disallowed in the fenced frame.");
     66  }, []);
     67 }, 'Delivered policies can further restrict permissions of a non-opaque ' +
     68   'fenced frame');
     69 
     70 </script>
     71 </body>
     72 </html>