summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/idle-detection/resources/idle-detection-disabled-by-permissions-policy-worker.js
blob: c30f7c188e747eaf4b43dacaba21fd17d2d5af81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';

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

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

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

promise_test(async () => {
  try {
    await new IdleDetector().start();
    assert_unreached('expected start() to throw with SecurityError');
  } catch (error) {
    assert_equals(error.name, 'SecurityError');
  }
},
`Inherited ${header} disallows ${workerType} workers.`);

done();