tor-browser

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

responseurl.html (1225B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>XMLHttpRequest: responseURL test</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-responseurl-attribute"/>
      8  </head>
      9  <body>
     10    <div id="log"></div>
     11    <script>
     12      test(function() {
     13        var client = new XMLHttpRequest()
     14        assert_equals(client.responseURL, "")
     15 
     16        client.open("GET", "foo.html", false)
     17        client.send()
     18 
     19        expected = location.href.replace(/[^/]*$/, 'foo.html')
     20        assert_equals(client.status, 404)
     21        assert_equals(client.responseURL, expected)
     22      }, "404 response has proper responseURL")
     23      test(function() {
     24        var client = new XMLHttpRequest()
     25        assert_equals(client.responseURL, "")
     26 
     27        target = "image.gif"
     28        client.open("GET", "resources/redirect.py?location=" + target, false)
     29        client.send()
     30 
     31        expected = location.href.replace(/[^/]*$/, "resources/" + target)
     32        assert_equals(client.status, 200)
     33        assert_equals(client.responseURL, expected)
     34      }, "Redirected response has proper responseURL")
     35    </script>
     36  </body>
     37 </html>