| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <body> | 2 <body> |
| 3 <p>Test for bug 452391: Header names in Access-Control-Request-Headers must be s
orted.</p> | 3 <p>Test for bug 452391: Header names in Access-Control-Request-Headers must be s
orted.</p> |
| 4 <script> | 4 <script> |
| 5 if (window.testRunner) { | 5 if (window.testRunner) { |
| 6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
| 7 testRunner.waitUntilDone(); | 7 testRunner.waitUntilDone(); |
| 8 } | 8 } |
| 9 | 9 |
| 10 function sendRequest() | 10 function sendRequest() |
| 11 { | 11 { |
| 12 var xhr = new XMLHttpRequest; | 12 var xhr = new XMLHttpRequest; |
| 13 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-contr
ol-preflight-request-header-sorted.php"); | 13 xhr.open("GET", "http://localhost:8000/xmlhttprequest/resources/access-contr
ol-preflight-request-header-sorted.php"); |
| 14 xhr.setRequestHeader("X-Custom-Test", "foobar"); | 14 xhr.setRequestHeader("X-Custom-Test", "foobar"); |
| 15 xhr.setRequestHeader("X-Custom-ua", "foobar"); | 15 xhr.setRequestHeader("X-Custom-ua", "foobar"); |
| 16 xhr.setRequestHeader("X-Custom-V", "foobar"); | 16 xhr.setRequestHeader("X-Custom-V", "foobar"); |
| 17 xhr.setRequestHeader("X-Custom-s", "foobar"); | 17 xhr.setRequestHeader("X-Custom-s", "foobar"); |
| 18 xhr.setRequestHeader("X-Custom-U", "foobar"); | 18 xhr.setRequestHeader("X-Custom-U", "foobar"); |
| 19 // Check that a simple header is also included in the |
| 20 // Access-Control-Request-Headers header. |
| 21 xhr.setRequestHeader("Content-Type", "text/plain"); |
| 19 xhr.onerror = function() { | 22 xhr.onerror = function() { |
| 20 document.body.appendChild(document.createTextNode("FAIL: onerror called"
)); | 23 document.body.appendChild(document.createTextNode("FAIL: onerror called"
)); |
| 21 if (window.testRunner) | 24 if (window.testRunner) |
| 22 testRunner.notifyDone(); | 25 testRunner.notifyDone(); |
| 23 } | 26 } |
| 24 | 27 |
| 25 xhr.onreadystatechange=function() { | 28 xhr.onreadystatechange=function() { |
| 26 if (xhr.readyState==4) { | 29 if (xhr.readyState==4) { |
| 27 document.body.appendChild(document.createTextNode(xhr.responseText))
; | 30 document.body.appendChild(document.createTextNode(xhr.responseText))
; |
| 28 if (window.testRunner) | 31 if (window.testRunner) |
| 29 testRunner.notifyDone(); | 32 testRunner.notifyDone(); |
| 30 } | 33 } |
| 31 } | 34 } |
| 32 xhr.send(); | 35 xhr.send(); |
| 33 } | 36 } |
| 34 sendRequest(); | 37 sendRequest(); |
| 35 </script> | 38 </script> |
| 36 </body> | 39 </body> |
| 37 </html> | 40 </html> |
| OLD | NEW |