tor-browser

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

default-enabled-features-allow-self.https.html (2838B)


      1 <!DOCTYPE html>
      2 <title>Test default permission policy features gating (self)</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, false, get_host_info().ORIGIN);
     15  await runDefaultEnabledFeaturesTest(t, false, get_host_info().ORIGIN,
     16      generator_api="sharedstorage");
     17 }, 'Same-origin fenced frame does not load when feature policies are self');
     18 
     19 promise_test(async(t) => {
     20  await runDefaultEnabledFeaturesTest(t, false, get_host_info().REMOTE_ORIGIN);
     21  await runDefaultEnabledFeaturesTest(t, false, get_host_info().REMOTE_ORIGIN,
     22      generator_api="sharedstorage");
     23 }, 'Cross-origin fenced frame does not load when feature policies are self');
     24 
     25 promise_test(async(t) => {
     26  const fencedframe = await attachFencedFrameContext({
     27        origin: get_host_info().ORIGIN});
     28 
     29  await fencedframe.execute(async () => {
     30    assert_true(
     31        document.featurePolicy.allowsFeature('shared-storage'),
     32        "Shared storage should be allowed in the fenced frame.");
     33    assert_true(
     34        document.featurePolicy.allowsFeature('private-aggregation'),
     35        "Private aggregation should be allowed in the fenced frame.");
     36    assert_false(
     37        document.featurePolicy.allowsFeature('attribution-reporting'),
     38        "Attribution reporting should be disallowed in the fenced frame.");
     39    assert_false(
     40        document.featurePolicy.allowsFeature('sync-xhr'),
     41        "USB access should be disallowed in the fenced frame.");
     42  }, []);
     43 }, 'Fenced frames default feature policies should inherit from parent.');
     44 
     45 promise_test(async(t) => {
     46  const fencedframe = await attachFencedFrameContext({
     47        origin: get_host_info().REMOTE_ORIGIN});
     48 
     49  await fencedframe.execute(async () => {
     50    assert_false(
     51        document.featurePolicy.allowsFeature('shared-storage'),
     52        "Shared storage should be disallowed in the fenced frame.");
     53    assert_false(
     54        document.featurePolicy.allowsFeature('private-aggregation'),
     55        "Private aggregation should be disallowed in the fenced frame.");
     56    assert_false(
     57        document.featurePolicy.allowsFeature('attribution-reporting'),
     58        "Attribution reporting should be disallowed in the fenced frame.");
     59    assert_false(
     60        document.featurePolicy.allowsFeature('sync-xhr'),
     61        "USB access should be disallowed in the fenced frame.");
     62  }, []);
     63 }, 'Cross-origin fenced frames default feature policies follow inheritance rules.');
     64 
     65 </script>
     66 </body>
     67 </html>