tor-browser

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

compute-pressure-allowed-on-self-origin-by-permissions-policy.https.html (1221B)


      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 src="/common/get-host-info.sub.js"></script>
      7 <script>
      8 "use strict";
      9 
     10 const same_origin_src =
     11  '/permissions-policy/resources/permissions-policy-compute-pressure.html';
     12 const cross_origin_src = get_host_info().HTTPS_REMOTE_ORIGIN + same_origin_src;
     13 const header = 'permissions policy header "compute-pressure=self"';
     14 
     15 promise_test(async () => {
     16  try {
     17    const observer = new PressureObserver(() => {});
     18    await observer.observe("cpu");
     19    observer.disconnect();
     20  } catch (e) {
     21    assert_unreached('expected promise to resolve.');
     22  }
     23 }, `${header} allows the top-level document.`);
     24 
     25 async_test(t => {
     26  test_feature_availability(
     27    'ComputePressure.observe()',
     28    t,
     29    same_origin_src,
     30    expect_feature_available_default
     31  );
     32 }, `${header} allows same-origin iframes.`);
     33 
     34 async_test(t => {
     35  test_feature_availability(
     36    'ComputePressure.observe()',
     37    t,
     38    cross_origin_src,
     39    expect_feature_unavailable_default
     40  );
     41 }, `${header} disallows cross-origin iframes.`);
     42 
     43 </script>
     44 </body>