chromium/third_party/blink/web_tests/http/tests/xmlhttprequest/workers/resources/sync-cors-after-redirect-on-worker-worker.js

const url =
    '/xmlhttprequest/resources/redirect.php?url=' +
    'http://localhost:8000/xmlhttprequest/resources/access-control-basic-allow.cgi';
try {
  const xhr = new XMLHttpRequest;
  xhr.open('GET', url, false);
  xhr.send(null);
  self.postMessage(xhr.responseText);
} catch (e) {
  self.postMessage("Failed");
}