OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 |
| 4 <head> |
| 5 <!-- Programmatically converted from a WebKit Reftest, please forgive result
ing idiosyncracies.--> |
| 6 <title>shared-worker-connect-src-blocked</title> |
| 7 <script src="/resources/testharness.js"></script> |
| 8 <script src="/resources/testharnessreport.js"></script> |
| 9 <script src="../support/logTest.sub.js?logs=[]"></script> |
| 10 <script src='../support/alertAssert.sub.js?alerts=["xhr blocked","TEST COMPL
ETE"]'></script> |
| 11 <!-- enforcing policy: |
| 12 connect-src *; script-src 'self' 'unsafe-inline'; |
| 13 --> |
| 14 |
| 15 </head> |
| 16 |
| 17 <body> |
| 18 <p>This test loads a shared worker, delivered with its own |
| 19 policy. The worker should be blocked from making an XHR |
| 20 as that policy specifies a connect-src 'none', though |
| 21 this resource's policy is connect-src *. No report |
| 22 should be sent since the worker's policy doesn't specify |
| 23 a report-uri.</p> |
| 24 <script> |
| 25 if(typeof SharedWorker != 'function') { |
| 26 t_alert.set_status(t_alert.NOTRUN, "No SharedWorker, cannot run test."); |
| 27 t_alert.phase = t_alert.phases.HAS_RESULT; |
| 28 t_alert.done(); |
| 29 } else { |
| 30 try { |
| 31 var worker = new SharedWorker('http://{{host}}:{{ports[http][0]}}/co
ntent-security-policy/blink-contrib/resources/shared-worker-make-xhr-blocked.sub
.js'); |
| 32 worker.port.onmessage = function(event) { |
| 33 alert_assert(event.data); |
| 34 }; |
| 35 } catch (e) { |
| 36 alert_assert(e); |
| 37 } |
| 38 var report = document.createElement("script"); |
| 39 report.src = "../support/checkReport.sub.js?reportExists=false"; |
| 40 report.async = true; |
| 41 report.defer = true; |
| 42 document.body.appendChild(report); |
| 43 } |
| 44 |
| 45 |
| 46 </script> |
| 47 <div id="log"></div> |
| 48 </body> |
| 49 |
| 50 </html> |
OLD | NEW |