| <html> |
| <head> |
| <meta http-equiv="content-type" content="text/html;charset=utf-8"> |
| <body> |
| <p>Test that XMLHttpRequest tolerates extra parameters to its methods.</p> |
| <script> |
| |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| |
| var console_messages = document.createElement("ul"); |
| document.body.appendChild(console_messages); |
| |
| function log(message) |
| { |
| var item = document.createElement("li"); |
| item.appendChild(document.createTextNode(message)); |
| console_messages.appendChild(item); |
| } |
| |
| function prettyPrintText(text) { |
| if (text == null) |
| return text; |
| return '"' + text + '"'; |
| } |
| |
| function dumpResponse() { |
| |
| try { log (" Status: " + req.status); } catch (ex) { log(" Exception getting status: " + ex.message); } |
| try { log (" StatusText: " + prettyPrintText(req.statusText)); } catch (ex) { log(" Exception getting StatusText: " + ex.message); } |
| try { log (" ResponseText: " + prettyPrintText(req.responseText)); } catch (ex) { log(" Exception getting ResponseText: " + ex.message); } |
| } |
| |
| try { |
| |
| if (window.XMLHttpRequest) { |
| req = new XMLHttpRequest(); |
| } else { |
| try { |
| req = new ActiveXObject("Msxml2.XMLHTTP"); |
| } catch (ex) { |
| req = new ActiveXObject("Microsoft.XMLHTTP"); |
| } |
| } |
| |
| req.open('POST', 'resources/post-echo.cgi', false, null, null, null); |
| |
| req.setRequestHeader('foo', 'bar', null); |
| req.overrideMimeType('text/xml', null); |
| |
| req.send('SUCCESS', null); |
| |
| req.getResponseHeader('Date', null); |
| req.getAllResponseHeaders(null); |
| |
| dumpResponse(); |
| |
| } catch (ex) { |
| log("FAILURE: " + ex); |
| } |
| |
| </script> |
| </body> |
| </html> |