Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / xmlhttprequest / serialize-document.html
blob0e93e9a1d52e75cb621ed04a5ded769dca0dfe5e
1 <html>
2 <head>
3 </head>
5 <body>
6 <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=18421">bug 18421</a>:
7 XMLHttpRequest does not properly encode &amp; and &lt; in outgoing messages.</p>
8 </body>
9 <script type="text/javascript">
10 if (window.testRunner)
11 testRunner.dumpAsText();
13 // Create a new document
14 var dom = document.implementation.createDocument("","", null);
16 // Create the root node
17 var root = dom.appendChild(dom.createElement("foo"));
19 // Add an attribute
20 root.setAttribute("foo", "a&b");
22 // Add a text node
23 var txt = dom.createTextNode("a&b");
25 // Append it
26 root.appendChild(txt);
28 // Create the XHR object
29 var xhr = new XMLHttpRequest();
30 xhr.open("POST", "resources/post-echo.cgi", false);
31 xhr.send(dom);
33 if (xhr.responseText == '<foo foo="a&amp;b">a&amp;b</foo>')
34 document.body.innerHTML +="PASS";
35 else
36 document.body.innerHTML +="FAIL: <xmp>" + xhr.responseText + "</xmp>";
37 </script>
39 </html>