tor-browser

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

header-referrer-inner.html (1389B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="utils.js"></script>
      4 <title>Fenced frame content to report the value of header.referrer</title>
      5 
      6 <body>
      7 <script>
      8 async function init() { // Needed in order to use top-level await.
      9  // This file is meant to run in a <fencedframe>. It reports back to the
     10  // outermost page the value of `referer` in the request header:
     11  //   1.) Nested iframes inside a fenced frame
     12  //   2.) Nested fenced frames
     13  //   3.) Top-level fenced frames (aka this frame) after initial navigation
     14  const [referrer_key, referrer_ack_key] = parseKeylist();
     15 
     16  const referrer_url = generateURL("check-header-referrer.py",
     17      [referrer_key, referrer_ack_key]);
     18 
     19  const iframe = document.createElement('iframe');
     20  iframe.src = referrer_url;
     21  document.body.append(iframe);
     22 
     23  // Wait for ACK, so we know that the outer page has read the last value from
     24  // the `referrer_key` stash that the iframe above wrote to, and we can write
     25  // to it again.
     26  await nextValueFromServer(referrer_ack_key);
     27 
     28  attachFencedFrame(referrer_url);
     29 
     30  // Wait for ACK, so we know that the outer page has read the last value from
     31  // the `referrer_key` stash that the nested fenced frame wrote to, and we can
     32  // can write to it again.
     33  await nextValueFromServer(referrer_ack_key);
     34 
     35  location.href = referrer_url;
     36 }
     37 
     38 init();
     39 </script>
     40 </body>