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