5 Check COEP report are send for CacheStorage requests in DedicatedWorker
7 <script src=
"/resources/testharness.js"></script>
8 <script src=
"/resources/testharnessreport.js"></script>
9 <script src=
"/common/get-host-info.sub.js"></script>
10 <script src=
"/common/utils.js"></script>
11 <script src=
"/service-workers/service-worker/resources/test-helpers.sub.js">
13 <script src=
"./resources/cache-storage-reporting.js"> </script>
17 promise_test(async (t
) => {
18 const worker_url
= local(encode(worker_path
));
20 local(encode(iframe_path
+ header_coep
+ header_report_to
));
21 dedicated_worker_script
= `
23 const w = new Worker('${worker_url}');
24 w.postMessage(\`${eval_script}
\`);
27 const iframe
= await
makeIframe(t
, iframe_url
);
28 iframe
.contentWindow
.postMessage(dedicated_worker_script
);
29 const report
= await
fetchReport();
30 assert_equals(report
["body"]["blocked-url"], image_url
.toString());
31 assert_equals(report
["body"]["type"], "corp");
32 assert_equals(report
["type"], "coep");
33 assert_equals(normalize(report
["url"]), normalize(worker_url
.toString()));
34 }, "COEP support on DedicatedWorker.")
36 promise_test(async (t
) => {
37 const worker_url
= local(encode(worker_path
));
39 local(encode(iframe_path
+ header_coep_report_only
+ header_report_to
));
40 dedicated_worker_script
= `
42 const w = new Worker('${worker_url}');
43 w.postMessage(\`${eval_script}
\`);
46 const iframe
= await
makeIframe(t
, iframe_url
);
47 iframe
.contentWindow
.postMessage(dedicated_worker_script
);
48 const report
= await
fetchReport();
49 assert_equals(report
["body"]["blocked-url"], image_url
.toString());
50 assert_equals(report
["body"]["type"], "corp");
51 assert_equals(report
["type"], "coep");
52 assert_equals(normalize(report
["url"]), normalize(worker_url
.toString()));
53 }, "COEP-Report-Only support on DedicatedWorker.")