cache-storage-reporting-shared-worker.https.html (1897B)
1 <!doctype html> 2 <html> 3 <head> 4 <title> 5 Check COEP report are send for CacheStorage requests in SharedWorker 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="./resources/cache-storage-reporting.js"> </script> 13 </head> 14 <script> 15 16 promise_test(async (t) => { 17 const worker_url = local(encode(worker_path + header_coep)); 18 const worker = new SharedWorker(worker_url); 19 const mc = new MessageChannel(); 20 worker.port.postMessage({script: eval_script, port: mc.port2}, [mc.port2]); 21 const reports = (await new Promise(r => mc.port1.onmessage = r)).data; 22 assert_equals(reports.length, 1); 23 const report = reports[0]; 24 assert_equals(report.body.blockedURL, image_url); 25 assert_equals(report.body.type, "corp"); 26 assert_equals(report.body.disposition, "enforce"); 27 assert_equals(report.body.destination, ""); 28 assert_equals(report.type, "coep"); 29 assert_equals(report.url, worker_url); 30 }, "COEP support on SharedWorker.") 31 32 promise_test(async (t) => { 33 const worker_url = local(encode(worker_path + header_coep_report_only)); 34 const worker = new SharedWorker(worker_url); 35 const mc = new MessageChannel(); 36 worker.port.postMessage({script: eval_script, port: mc.port2}, [mc.port2]); 37 const reports = (await new Promise(r => mc.port1.onmessage = r)).data; 38 assert_equals(reports.length, 1); 39 const report = reports[0]; 40 assert_equals(report.body.blockedURL, image_url); 41 assert_equals(report.body.type, "corp"); 42 assert_equals(report.body.disposition, "reporting"); 43 assert_equals(report.body.destination, ""); 44 assert_equals(report.type, "coep"); 45 assert_equals(report.url, worker_url); 46 }, "COEP-Report-Only support on SharedWorker.") 47 48 </script> 49 </html>