tor-browser

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

hid-allowed-by-permissions-policy.https.sub.html (1802B)


      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 'use strict';
      8 const sub = 'https://{{domains[www]}}:{{ports[https][0]}}';
      9 const same_origin_src = '/permissions-policy/resources/permissions-policy-hid.html';
     10 const cross_origin_src = sub + same_origin_src;
     11 const same_origin_worker_frame_src =
     12    '/permissions-policy/resources/permissions-policy-hid-worker.html';
     13 const cross_origin_worker_frame_src = sub + same_origin_worker_frame_src;
     14 const header = 'Permissions-Policy header hid=*';
     15 
     16 promise_test(
     17    () => navigator.hid.getDevices(),
     18    header + ' allows the top-level document.');
     19 
     20 async_test(t => {
     21  test_feature_availability('hid.getDevices()', t, same_origin_src,
     22      expect_feature_available_default);
     23 }, header + ' allows same-origin iframes.');
     24 
     25 async_test(t => {
     26  test_feature_availability('hid.getDevices()', t, same_origin_worker_frame_src,
     27      expect_feature_available_default);
     28 }, header + ' allows workers in same-origin iframes.');
     29 
     30 // Set allow="hid" on iframe element to delegate 'hid' to cross origin subframe.
     31 async_test(t => {
     32  test_feature_availability('hid.getDevices()', t, cross_origin_src,
     33      expect_feature_available_default, 'hid');
     34 }, header + ' allows cross-origin iframes.');
     35 
     36 // Set allow="hid" on iframe element to delegate 'hid' to cross origin subframe.
     37 async_test(t => {
     38  test_feature_availability('hid.getDevices()', t,
     39      cross_origin_worker_frame_src,
     40      expect_feature_available_default, 'hid');
     41 }, header + ' allows workers in cross-origin iframes.');
     42 
     43 fetch_tests_from_worker(new Worker(
     44    '/webhid/resources/hid-allowed-by-permissions-policy-worker.js'));
     45 </script>
     46 </body>