tor-browser

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

idle-detection-disabled-by-permissions-policy-worker.js (495B)


      1 'use strict';
      2 
      3 importScripts('/resources/testharness.js');
      4 
      5 const header = 'Permissions-Policy header idle-detection=()';
      6 let workerType;
      7 
      8 if (typeof postMessage === 'function') {
      9  workerType = 'dedicated';
     10 }
     11 
     12 promise_test(async () => {
     13  try {
     14    await new IdleDetector().start();
     15    assert_unreached('expected start() to throw with SecurityError');
     16  } catch (error) {
     17    assert_equals(error.name, 'SecurityError');
     18  }
     19 },
     20 `Inherited ${header} disallows ${workerType} workers.`);
     21 
     22 done();