blob: a54c308d9f1190ea23a0df460f78fe76964c018e [file] [log] [blame]
Austin James Ahlstrom2f1518d2017-09-07 02:58:241<!DOCTYPE html>
2<html>
3 <head>
4 <title>Sync request denied at preflight because of non-CORS-safelisted method</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 <script src="/common/utils.js"></script>
9 </head>
10 <body>
11 <script type="text/javascript">
12const uuid = token();
13const url = get_host_info().HTTP_REMOTE_ORIGIN +
Philip Jägenstedt2cb86af2018-01-06 16:35:2714 "/xhr/resources/access-control-preflight-denied.py?token=" + uuid;
Austin James Ahlstrom2f1518d2017-09-07 02:58:2415
16test(() => {
17 let xhr = new XMLHttpRequest;
18 xhr.open("GET", url + "&command=reset", false);
19 xhr.send();
20
21 xhr = new XMLHttpRequest;
22 xhr.open("DELETE", url + "&command=method", false);
23
Anne van Kesteren9b96b142018-05-08 17:30:4824 assert_throws("NetworkError", () => xhr.send());
Austin James Ahlstrom2f1518d2017-09-07 02:58:2425
Anne van Kesteren9b96b142018-05-08 17:30:4826 xhr = new XMLHttpRequest;
27 xhr.open("GET", url + "&command=complete", false);
28 xhr.send();
29 assert_equals(xhr.responseText, "Request successfully blocked.");
Austin James Ahlstrom2f1518d2017-09-07 02:58:2430});
31 </script>
32 </body>
33</html>