summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webusb/resources/usb-disabled-by-permissions-policy-worker.js
blob: caf2727cd13cbb4570b1c7d1afa984ad02a96266 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';

importScripts('/resources/testharness.js');

const header = 'Permissions-Policy header usb=()';
let workerType;

if (typeof postMessage === 'function') {
  workerType = 'dedicated';
}

promise_test(() => navigator.usb.getDevices().then(
        () => assert_unreached('expected promise to reject with SecurityError'),
        error => assert_equals(error.name, 'SecurityError')),
    `Inherited ${header} disallows ${workerType} workers.`);

done();