tor-browser

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

ch-ua-high-entropy-values-disabled-by-permissions-policy.https.sub.html (1890B)


      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  <script>
      7    const same_origin_src =
      8      "/permissions-policy/resources/permissions-policy-ch-ua-high-entropy-values.html";
      9    const cross_origin_src =
     10      "https://{{hosts[alt][]}}:{{ports[https][0]}}" + same_origin_src;
     11      const header = 'Permissions policy header "ch-ua-high-entropy-values=()"';
     12 
     13    promise_test(async () => {
     14      // bitness is a high-entropy hint: we expect it to not be returned due to
     15      // Permissions-Policy, but instead just the low-entropy hints
     16      return navigator.userAgentData.getHighEntropyValues(["bitness"]).then(
     17        hints => {
     18          assert_own_property(hints, "brands");
     19          assert_own_property(hints, "mobile");
     20          assert_own_property(hints, "platform");
     21          assert_not_own_property(hints, "bitness");
     22        }
     23      );
     24    }, `${header} disallows high-entropy values via getHighEntropyValues() in top-level document.`);
     25 
     26    async_test((test) => {
     27      return test_feature_availability({
     28        feature_description: "navigator.userAgentData.getHighEntropyValues()",
     29        test,
     30        src: same_origin_src,
     31        expect_feature_available: expect_feature_unavailable_default,
     32      });
     33    }, `${header} disallows high-entropy values via getHighEntropyValues() in same-origin iframes.`);
     34 
     35    async_test((test) => {
     36      return test_feature_availability({
     37        feature_description: "navigator.userAgentData.getHighEntropyValues()",
     38        test,
     39        src: cross_origin_src,
     40        expect_feature_available: expect_feature_unavailable_default,
     41      });
     42    }, `${header} disallows high-entropy values via getHighEntropyValues() in cross-origin iframes.`);
     43  </script>
     44 </body>