tor-browser

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

usb-disabled-by-permissions-policy-worker.js (465B)


      1 'use strict';
      2 
      3 importScripts('/resources/testharness.js');
      4 
      5 const header = 'Permissions-Policy header usb=()';
      6 let workerType;
      7 
      8 if (typeof postMessage === 'function') {
      9  workerType = 'dedicated';
     10 }
     11 
     12 promise_test(() => navigator.usb.getDevices().then(
     13        () => assert_unreached('expected promise to reject with SecurityError'),
     14        error => assert_equals(error.name, 'SecurityError')),
     15    `Inherited ${header} disallows ${workerType} workers.`);
     16 
     17 done();