| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <body> | 2 <body> |
| 3 <p>Test that 'Origin' is not included in Access-Control-Request-Headers in a pre
flight request. Should print PASS.</p> | 3 <p>Test that text/plain;charset=UTF-8 is set as default Content-Type for POST re
quests<br>with text content. Should print PASS.</p> |
| 4 <div id="log"></div> | 4 <div id="log"></div> |
| 5 <script> | 5 <script> |
| 6 function log(message) { | 6 function log(message) { |
| 7 document.getElementById("log").innerHTML += message + "<br>"; | 7 document.getElementById("log").innerHTML += message + "<br>"; |
| 8 } | 8 } |
| 9 | 9 |
| 10 if (window.layoutTestController) { | 10 if (window.layoutTestController) { |
| 11 layoutTestController.dumpAsText(); | 11 layoutTestController.dumpAsText(); |
| 12 layoutTestController.waitUntilDone(); | 12 layoutTestController.waitUntilDone(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 var xhr = new XMLHttpRequest(); | 15 var xhr = new XMLHttpRequest(); |
| 16 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-control-p
reflight-request-headers-origin.php"); | 16 |
| 17 xhr.setRequestHeader("X-Custom-Header", "PASS"); | 17 xhr.open("POST", "resources/xmlhttprequest-no-content-type-with-text.php"); |
| 18 xhr.onerror = function () { | 18 xhr.onerror = function () { |
| 19 log("FAIL"); | 19 log("FAIL"); |
| 20 if (window.layoutTestController) | 20 if (window.layoutTestController) |
| 21 layoutTestController.notifyDone(); | 21 layoutTestController.notifyDone(); |
| 22 }; | 22 }; |
| 23 xhr.onreadystatechange = function () { | 23 xhr.onload = function () { |
| 24 if (xhr.readyState == 4) { | 24 if (xhr.readyState == 4) { |
| 25 log(xhr.responseText); | 25 log(xhr.responseText); |
| 26 if (window.layoutTestController) | 26 if (window.layoutTestController) |
| 27 layoutTestController.notifyDone(); | 27 layoutTestController.notifyDone(); |
| 28 } | 28 } |
| 29 }; | 29 }; |
| 30 xhr.send(); | 30 xhr.send('Test'); |
| 31 | |
| 32 </script> | 31 </script> |
| 33 </html> | 32 </html> |
| OLD | NEW |