tor-browser

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

cache-storage-reporting-dedicated-worker.https.html (1975B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4  <title>
      5    Check COEP report are send for CacheStorage requests in DedicatedWorker
      6  </title>
      7  <meta name="timeout" content="long">
      8  <script src="/resources/testharness.js"></script>
      9  <script src="/resources/testharnessreport.js"></script>
     10  <script src="/common/get-host-info.sub.js"></script>
     11  <script src="/common/utils.js"></script>
     12  <script src="/service-workers/service-worker/resources/test-helpers.sub.js">
     13  </script>
     14  <script src="./resources/cache-storage-reporting.js"> </script>
     15 </head>
     16 <script>
     17 
     18 promise_test(async (t) => {
     19  const worker_url = local(encode(worker_path + header_coep));
     20  const worker = new Worker(worker_url);
     21  const mc = new MessageChannel();
     22  worker.postMessage({script: eval_script, port: mc.port2}, [mc.port2]);
     23  const reports = (await new Promise(r => mc.port1.onmessage = r)).data;
     24  assert_equals(reports.length, 1);
     25  const report = reports[0];
     26  assert_equals(report.body.blockedURL, image_url);
     27  assert_equals(report.body.type, "corp");
     28  assert_equals(report.body.disposition, "enforce");
     29  assert_equals(report.body.destination, "");
     30  assert_equals(report.type, "coep");
     31  assert_equals(report.url, worker_url);
     32 }, "COEP support on DedicatedWorker.")
     33 
     34 promise_test(async (t) => {
     35  const worker_url = local(encode(worker_path + header_coep_report_only));
     36  const worker = new Worker(worker_url);
     37  const mc = new MessageChannel();
     38  worker.postMessage({script: eval_script, port: mc.port2}, [mc.port2]);
     39  const reports = (await new Promise(r => mc.port1.onmessage = r)).data;
     40  assert_equals(reports.length, 1);
     41  const report = reports[0];
     42  assert_equals(report.body.blockedURL, image_url);
     43  assert_equals(report.body.type, "corp");
     44  assert_equals(report.body.disposition, "reporting");
     45  assert_equals(report.body.destination, "");
     46  assert_equals(report.type, "coep");
     47  assert_equals(report.url, worker_url);
     48 }, "COEP-Report-Only support on DedicatedWorker.")
     49 
     50 </script>
     51 </html>