;

iframe.addEventListener("load", function() {
  const iframe_script = iframe.contentDocument.createElement('script');
  iframe_script.textContent = `
    // Test fetch() API with default "client" referrer.
    fetch("${location.origin}/common/security-features/subresource/xhr.py?name=testFetchClientReferrer")
      .then(r => r.json())
      .then(j => {
          top.postMessage({test: "testFetchClientReferrer", referrer: j.headers.referer}, "*")
        }).catch(e => {
          top.postMessage({test: "