| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html lang="en"> |
| <head> |
| <title>setRequestHeader at odd times</title> |
| </head> |
| <body> |
| <p>FAIL: Script did not run.</p> |
| <script type="text/javascript"> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var p = document.getElementsByTagName('p')[0]; |
| p.firstChild.data = 'FAIL: Test script did not finish.'; |
| window.onerror = function (error, file, line) { p.firstChild.data = 'ERROR: ' + error + ' (line ' + line + ')'; } |
| if (!window.XMLHttpRequest) |
| window.XMLHttpRequest = function () { return new ActiveXObject("Microsoft.XMLHTTP"); } |
| var r = new XMLHttpRequest(); |
| r.open('GET', '004-test.cgi', false); |
| r.setRequestHeader('X-Test-Header1', 'YES'); |
| r.setRequestHeader('X-Test-Header2', 'NO'); |
| r.send(null); |
| r.open('GET', '004-test.cgi', false); |
| r.setRequestHeader('X-Test-Header2', 'YES'); |
| r.send(null); |
| if (r.responseText == 'RESULT:[][YES]') { |
| p.firstChild.data = 'PASS'; |
| } else { |
| p.firstChild.data = 'FAIL (' + r.responseText + ')'; |
| } |
| </script> |
| </body> |
| </html> |