tor-browser

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

access-control-preflight-credential-sync.htm (772B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Tests proper handling of cross-origin sync request with credentials</title>
      5    <script src="/resources/testharness.js"></script>
      6    <script src="/resources/testharnessreport.js"></script>
      7    <script src="/common/get-host-info.sub.js"></script>
      8  </head>
      9  <body>
     10    <script type="text/javascript">
     11    test(() => {
     12      const xhr = new XMLHttpRequest;
     13 
     14      xhr.open("PUT", get_host_info().HTTP_REMOTE_ORIGIN + "/xhr/resources/access-control-auth-basic.py?uid=fooUser", false, "fooUser", "barPass");
     15 
     16      xhr.withCredentials = true;
     17 
     18      xhr.send();
     19 
     20      assert_equals(xhr.status, 401, "Request raises HTTP 401: Unauthorized error.");
     21    }, "CORS sync request with URL credentials");
     22    </script>
     23  </body>
     24 </html>