tor-browser

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

send-authentication-basic-cors-not-enabled.htm (1434B)


      1 <!doctype html>
      2 <html>
      3  <head>
      4    <title>XMLHttpRequest: send() - "Basic" authenticated CORS requests with user name and password passed to open() (asserts failure)</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <script src="/common/utils.js"></script>
      8    <script src="/common/get-host-info.sub.js"></script>
      9    <link rel="help" href="https://xhr.spec.whatwg.org/#the-open()-method" data-tested-assertations="following::ol[1]/li[9]/ol[1]/li[1] following::ol[1]/li[9]/ol[1]/li[2]" />
     10    <link rel="help" href="https://xhr.spec.whatwg.org/#the-send()-method" data-tested-assertations="following::code[contains(@title,'http-authorization')]/.." />
     11  </head>
     12  <body>
     13    <div id="log"></div>
     14    <script>
     15      test(function() {
     16        var client = new XMLHttpRequest(),
     17          urlstart = get_host_info().REMOTE_ORIGIN + location.pathname.replace(/\/[^\/]*$/, '/')
     18        client.withCredentials = true
     19        user = token()
     20        client.open("GET", urlstart + "resources/auth10/auth.py", false, user, 'pass')
     21        client.setRequestHeader("x-user", user)
     22        assert_throws_dom("NetworkError", function(){ client.send(null) })
     23        assert_equals(client.responseText, '')
     24        assert_equals(client.status, 0)
     25        assert_equals(client.getResponseHeader('x-challenge'), null)
     26      }, document.title)
     27    </script>
     28  </body>
     29 </html>