blob: 031cc94d10cef22852f0939fb9a63b2f2f11cae6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
<script>
window.onmessage = async (e) => {
if (e.data.type === "run") {
let token = e.data.token;
const test_url =
`http://{{hosts[alt][]}}:{{ports[http][0]}}/cors/resources/preflight-partitioning.py?token=${token}`;
let response = await fetch(
new Request(test_url, {
mode: "cors",
method: "GET",
headers: [["x-print", token]],
})
);
let result = await response.text();
if (result === "1") {
parent.postMessage({ type: "pass", msg: "The CORS preflight was sent" }, "*");
} else {
parent.postMessage({ type: "fail", msg: "The CORS preflight wasn't sent" }, "*");
}
}
};
parent.postMessage({ type: "loaded" }, "*");
</script>
|