tor-browser

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

hid.https.html (1243B)


      1 <!DOCTYPE html>
      2 <title>Test of Web Bluetooth API</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="resources/utils.js"></script>
      8 <script src="/common/utils.js"></script>
      9 <script src="/common/dispatcher/dispatcher.js"></script>
     10 <script src="/resources/testdriver-actions.js"></script>
     11 
     12 <body>
     13 
     14 <script>
     15 promise_test(async () => {
     16  const frame = attachFencedFrameContext();
     17  await multiClick(10, 10, frame.element);
     18  const result = await frame.execute(async () => {
     19    try {
     20      await navigator.hid.getDevices();
     21      return 'HID getDevice succeeded';
     22    } catch(e) {
     23      if (e.name == 'SecurityError' &&
     24          e.message.includes(
     25          'Access to the feature "hid" is disallowed by permissions policy.')) {
     26        return 'HID getDevice failed';
     27      } else {
     28        return `HID getDevice failed with unknown error - ${e.name}: ${e.message}`;
     29      }
     30    }
     31  });
     32  assert_equals(result, 'HID getDevice failed',
     33                'HID getDevice must fail in a fenced frame.');
     34 }, 'HID getDevice must fail in a fenced frame');
     35 </script>
     36 
     37 </body>