| <html> | |
| <head> | |
| </head> | |
| <body> | |
| <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=18421">bug 18421</a>: | |
| XMLHttpRequest does not properly encode & and < in outgoing messages.</p> | |
| </body> | |
| <script type="text/javascript"> | |
| if (window.testRunner) | |
| testRunner.dumpAsText(); | |
| // Create a new document | |
| var dom = document.implementation.createDocument("","", null); | |
| // Create the root node | |
| var root = dom.appendChild(dom.createElement("foo")); | |
| // Add an attribute | |
| root.setAttribute("foo", "a&b"); | |
| // Add a text node | |
| var txt = dom.createTextNode("a&b"); | |
| // Append it | |
| root.appendChild(txt); | |
| // Create the XHR object | |
| var xhr = new XMLHttpRequest(); | |
| xhr.open("POST", "resources/post-echo.cgi", false); | |
| xhr.send(dom); | |
| if (xhr.responseText == '<foo foo="a&b">a&b</foo>') | |
| document.body.innerHTML +="PASS"; | |
| else | |
| document.body.innerHTML +="FAIL: <xmp>" + xhr.responseText + "</xmp>"; | |
| </script> | |
| </html> |