Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / extra-parameters.html
blobb6684138b485230e495d7919e560b2b1ad1a7e06
1 <html>
2 <head>
3 <meta http-equiv="content-type" content="text/html;charset=utf-8">
4 <body>
5 <p>Test that XMLHttpRequest tolerates extra parameters to its methods.</p>
6 <script>
8 if (window.testRunner)
9 testRunner.dumpAsText();
11 var console_messages = document.createElement("ul");
12 document.body.appendChild(console_messages);
14 function log(message)
16 var item = document.createElement("li");
17 item.appendChild(document.createTextNode(message));
18 console_messages.appendChild(item);
21 function prettyPrintText(text) {
22 if (text == null)
23 return text;
24 return '"' + text + '"';
27 function dumpResponse() {
29 try { log ("  Status: " + req.status); } catch (ex) { log("  Exception getting status: " + ex.message); }
30 try { log ("  StatusText: " + prettyPrintText(req.statusText)); } catch (ex) { log("  Exception getting StatusText: " + ex.message); }
31 try { log ("  ResponseText: " + prettyPrintText(req.responseText)); } catch (ex) { log("  Exception getting ResponseText: " + ex.message); }
34 try {
36 if (window.XMLHttpRequest) {
37 req = new XMLHttpRequest();
38 } else {
39 try {
40 req = new ActiveXObject("Msxml2.XMLHTTP");
41 } catch (ex) {
42 req = new ActiveXObject("Microsoft.XMLHTTP");
46 req.open('POST', 'resources/post-echo.cgi', false, null, null, null);
48 req.setRequestHeader('foo', 'bar', null);
49 req.overrideMimeType('text/xml', null);
51 req.send('SUCCESS', null);
53 req.getResponseHeader('Date', null);
54 req.getAllResponseHeaders(null);
56 dumpResponse();
58 } catch (ex) {
59 log("FAILURE: " + ex);
62 </script>
63 </body>
64 </html>