cache-storage-reporting-document.https.html (1936B)
1 <!doctype html> 2 <html> 3 <head> 4 <title> 5 Check COEP report are send for CacheStorage requests in Document. 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> 13 <script src="./resources/cache-storage-reporting.js"></script> 14 </head> 15 <script> 16 17 async function waitReports(frame) { 18 return await new Promise((resolve) => { 19 const observer = new frame.contentWindow.ReportingObserver((reports) => { 20 observer.disconnect(); 21 resolve(reports.map(r => r.toJSON())); 22 }); 23 observer.observe(); 24 25 frame.contentWindow.eval(eval_script); 26 }); 27 } 28 29 promise_test(async (t) => { 30 const iframe_url = local(encode(iframe_path + header_coep)); 31 const iframe = await makeIframe(t, iframe_url); 32 const reports = await waitReports(iframe); 33 assert_equals(reports.length, 1); 34 const report = reports[0]; 35 assert_equals(report.body.blockedURL, image_url); 36 assert_equals(report.body.type, "corp"); 37 assert_equals(report.body.disposition, "enforce"); 38 assert_equals(report.body.destination, ""); 39 assert_equals(report.type, "coep"); 40 assert_equals(report.url, iframe_url); 41 }, "COEP support on document.") 42 43 promise_test(async (t) => { 44 const iframe_url = local(encode(iframe_path + header_coep_report_only)); 45 const iframe = await makeIframe(t, iframe_url); 46 const reports = await waitReports(iframe); 47 assert_equals(reports.length, 1); 48 const report = reports[0]; 49 assert_equals(report.body.blockedURL, image_url); 50 assert_equals(report.body.type, "corp"); 51 assert_equals(report.body.disposition, "reporting"); 52 assert_equals(report.body.destination, ""); 53 assert_equals(report.type, "coep"); 54 assert_equals(report.url, iframe_url); 55 }, "COEP-Report-Only support on document.") 56 57 </script> 58 </html>