summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/compute-pressure/resources/compute-pressure-allowed-by-permissions-policy-worker.js
blob: 590ac52cfd06ef2b496d0decc70291fe32843b68 (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 "compute-pressure=*"';
let workerType;

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

promise_test(async () => {
  try {
    const observer = new PressureObserver(() => {});
    await observer.observe('cpu');
    observer.disconnect();
  } catch (e) {
    assert_unreached('expected promise to resolve.');
  }
}, `$Inherited ${header} allows ${workerType} workers.`);

done();