OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <body> |
| 3 <p>Test that preflight requests with invalid status code results in error. Shoul
d print PASS.</p> |
| 4 <div id="log"></div> |
| 5 <script> |
| 6 function log(message) { |
| 7 document.getElementById("log").innerHTML += message + "<br>"; |
| 8 } |
| 9 |
| 10 if (window.layoutTestController) { |
| 11 layoutTestController.dumpAsText(); |
| 12 layoutTestController.waitUntilDone(); |
| 13 } |
| 14 |
| 15 var xhr = new XMLHttpRequest(); |
| 16 |
| 17 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-p
reflight-request-invalid-status.php?code=501"); |
| 18 xhr.setRequestHeader("X-Custom-Header", "PASS"); |
| 19 xhr.onerror = function () { |
| 20 log("PASS"); |
| 21 if (window.layoutTestController) |
| 22 layoutTestController.notifyDone(); |
| 23 }; |
| 24 xhr.onload = function () { |
| 25 log("FAIL"); |
| 26 if (window.layoutTestController) |
| 27 layoutTestController.notifyDone(); |
| 28 }; |
| 29 xhr.send(); |
| 30 </script> |
| 31 </html> |
OLD | NEW |