sync-xhr-report-only.html (861B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <script src='/resources/testharness.js'></script> 5 <script src='/resources/testharnessreport.js'></script> 6 </head> 7 <body> 8 <script> 9 const check_report_format = ([reports, observer]) => { 10 const report = reports[0]; 11 assert_equals(report.type, "document-policy-violation"); 12 assert_equals(report.body.featureId, "sync-xhr"); 13 assert_equals(report.body.disposition, "report"); 14 }; 15 16 promise_test(async t => { 17 const report = new Promise(resolve => { 18 new ReportingObserver((reports, observer) => resolve([reports, observer]), 19 {types: ['document-policy-violation']}).observe(); 20 }); 21 const xhr = new XMLHttpRequest(); 22 xhr.open("GET", document.location.href, false); 23 xhr.send(); 24 check_report_format(await report); 25 }, "Sync-xhr report only mode"); 26 </script> 27 </body> 28 </html>