tor-browser

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

credentialless_worker.sjs (664B)


      1 /* Any copyright is dedicated to the Public Domain.
      2    http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const WORKER = `
      7   onmessage = function(event) {
      8     fetch(event.data, {
      9       mode: "no-cors",
     10       credentials: "include"
     11     }).then(function() {
     12       postMessage("fetch done");
     13     });
     14   }
     15 `;
     16 
     17 function handleRequest(request, response) {
     18   if (request.queryString === "credentialless") {
     19     response.setHeader("Cross-Origin-Embedder-Policy", "credentialless", true);
     20   }
     21 
     22   response.setHeader("Content-Type", "application/javascript", false);
     23   response.setStatusLine(request.httpVersion, "200", "Found");
     24   response.write(WORKER);
     25 }