tor-browser

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

open-url-fragment.htm (1606B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>XMLHttpRequest: open() resolving URLs - fragment identifier</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[7]" />
      8  </head>
      9  <body>
     10    <div id="log"></div>
     11    <script>
     12      test(function() {
     13        var client = new XMLHttpRequest()
     14        client.open("GET", "folder.txt#foobar", false)
     15        client.send(null)
     16        assert_equals(client.responseText, "top\n")
     17      })
     18      test(function() {
     19        var client = new XMLHttpRequest()
     20        client.open("GET", "resources/requri.py#foobar", false)
     21        client.send(null)
     22        assert_regexp_match(client.responseText, /xhr\/resources\/requri\.py$/)
     23      }, 'make sure fragment is removed from URL before request')
     24      test(function() {
     25        var client = new XMLHttpRequest()
     26        client.open("GET", "resources/requri.py?help=#foobar", false)
     27        client.send(null)
     28        assert_regexp_match(client.responseText, /xhr\/resources\/requri\.py\?help=$/)
     29      }, 'make sure fragment is removed from URL before request (with query string)')
     30      test(function() {
     31        var client = new XMLHttpRequest()
     32        client.open("GET", "resources/requri.py?" +encodeURIComponent("#foobar"), false)
     33        client.send(null)
     34        assert_regexp_match(client.responseText, /xhr\/resources\/requri\.py\?%23foobar$/)
     35      }, 'make sure escaped # is not removed')
     36    </script>
     37  </body>
     38 </html>