OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <!-- No 'treat-as-public-address' CSP directive, so we count as internal. --
> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="./resources/preflight.js"></script> |
| 8 </head> |
| 9 <body> |
| 10 <script> |
| 11 async_test(function (t) { |
| 12 var xhr = new XMLHttpRequest; |
| 13 xhr.responseType = "json"; |
| 14 xhr.onload = t.step_func_done(function (e) { |
| 15 assert_equals('success', xhr.response.jsonpResult); |
| 16 }); |
| 17 xhr.onerror = t.unreached_func("The load should not fail."); |
| 18 |
| 19 xhr.open("GET", preflightURL('fail-with-500', 'json'), true); |
| 20 xhr.send(); |
| 21 }, "XHR should pass on failed preflight (because no preflight is sent)")
; |
| 22 |
| 23 async_test(function (t) { |
| 24 var xhr = new XMLHttpRequest; |
| 25 xhr.responseType = "json"; |
| 26 xhr.onload = t.step_func_done(function (e) { |
| 27 assert_equals('success', xhr.response.jsonpResult); |
| 28 }); |
| 29 xhr.onerror = t.unreached_func("The load should not fail."); |
| 30 |
| 31 xhr.open("GET", preflightURL('fail-without-allow', 'json'), true); |
| 32 xhr.send(); |
| 33 }, "XHR should pass on failed preflight (because no preflight is sent)")
; |
| 34 |
| 35 |
| 36 async_test(function (t) { |
| 37 var xhr = new XMLHttpRequest; |
| 38 xhr.responseType = "json"; |
| 39 xhr.onload = t.step_func_done(function (e) { |
| 40 assert_equals('success', xhr.response.jsonpResult); |
| 41 }); |
| 42 xhr.onerror = t.unreached_func("The load should not fail."); |
| 43 |
| 44 xhr.open("GET", preflightURL('pass', 'json'), true); |
| 45 xhr.send(); |
| 46 }, "XHR should pass on successful preflight"); |
| 47 </script> |
| 48 </body> |
| 49 </html> |
OLD | NEW |