tor-browser

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

access-control-response-with-body.htm (920B)


      1 <!DOCTYPE html>
      2 <html>
      3  <head>
      4    <title>Tests that XHR doesn't prepend the body from CORS preflight response to the actual response</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 async_test((test) => {
     12  const xhr = new XMLHttpRequest;
     13 
     14  xhr.onerror = test.unreached_func("Unexpected error.");
     15 
     16  xhr.onload = test.step_func_done(() => {
     17    assert_equals(xhr.status, 200);
     18    assert_equals(xhr.responseText, "PASS");
     19  });
     20 
     21  xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN +
     22      "/xhr/resources/access-control-allow-with-body.py");
     23  xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     24  xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
     25  xhr.send();
     26 });
     27    </script>
     28  </body>
     29 </html>