https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 933c42829a0b57ae83016a14eaafb152d37d343b authored by Yoav Weiss on 21 December 2018, 21:00:08 UTC
Fix resource-timing.html document.domain test
Tip revision: 933c428
access-control-preflight-headers-sync.htm
<!DOCTYPE html>
<html>
  <head>
    <title>Test that sync CORS requests with custom headers are not sent with OPTIONS preflight</title>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/common/get-host-info.sub.js"></script>
    <script src="/common/utils.js"></script>
  </head>
  <body>
    <script type="text/javascript">
    test(function() {
      let xhr = new XMLHttpRequest;
      const uuid = token();

      xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN +
          "/xhr/resources/reset-token.py?token=" + uuid, false);
      xhr.send();

      xhr = new XMLHttpRequest;
      xhr.open("GET", get_host_info().HTTP_REMOTE_ORIGIN +
          "/xhr/resources/no-custom-header-on-preflight.py?token=" + uuid, false);
      xhr.setRequestHeader("x-test", "foobar");
      xhr.send();
      assert_equals(xhr.responseText, "PASS");
    }, "Preflighted sync request with custom header");
    </script>
  </body>
</html>
back to top