tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

send-entity-body-document-bogus.htm (950B)


      1 <!doctype html>
      2 <title>XMLHttpRequest: send() - Document with serialization errors</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <div id="log"></div>
      6 <script>
      7 function serialize(input, output) {
      8  async_test(t => {
      9    const client = new XMLHttpRequest
     10    client.open("POST", "resources/content.py")
     11    client.send(input)
     12    client.onload = t.step_func_done(() => {
     13      assert_equals(client.responseText, output)
     14    })
     15  }, "Serializing documents through XMLHttpRequest: '" + output + "'")
     16 }
     17 
     18 var doc = document.implementation.createDocument(null, null, null)
     19 serialize(doc, "")
     20 doc.appendChild(doc.createElement("test:test"))
     21 serialize(doc, "<test:test/>")
     22 doc.childNodes[0].setAttribute("test:test", "gee")
     23 serialize(doc, "<test:test test:test=\"gee\"/>")
     24 doc.childNodes[0].setAttribute("x", "\uD800")
     25 serialize(doc, "<test:test test:test=\"gee\" x=\"\uFFFD\"/>")
     26 </script>