tor-browser

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

preflight-cache-partitioning-iframe.sub.html (719B)


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