tor-browser

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

popup-noopener-inner.html (1478B)


      1 <!DOCTYPE html>
      2 <script src="/resources/testharness.js"></script>
      3 <script src="utils.js"></script>
      4 <title>Fenced frame creating popups</title>
      5 
      6 <body>
      7 <script>
      8 async function init() {
      9  // This file is meant to run in a <fencedframe>. It sets up multiple frames
     10  // in the following arrangements:
     11  //   1.) A top-level fenced frame
     12  //   2.) An iframe within a fenced frame
     13  //   3.) A nested fenced frame
     14  // All of the above frames create a popup which should not return a reference
     15  // to the new window.
     16 
     17  const [popup_noopener_key, popup_openee_key, popup_name_key, test_type] =
     18      parseKeylist();
     19 
     20  switch (test_type) {
     21    case "top-level fenced frame":
     22      src_popup = generateURL(`popup-noopener-destination.html`,
     23          [popup_noopener_key, popup_name_key]);
     24      const popup = window.open(src_popup, "foo");
     25      if (popup) {
     26        writeValueToServer(popup_openee_key, "FAIL");
     27      } else {
     28        writeValueToServer(popup_openee_key, "PASS");
     29      }
     30      break;
     31    case "nested iframe":
     32      const iframe = document.createElement('iframe');
     33      document.body.append(iframe);
     34      iframe.src = generateURL(`create-popup.html`,
     35          [popup_noopener_key, popup_openee_key, popup_name_key]);
     36      break;
     37    case "nested fenced frame":
     38      const ff =
     39          attachFencedFrame(generateURL(`create-popup.html`,
     40              [popup_noopener_key, popup_openee_key, popup_name_key]));
     41      break;
     42  }
     43 
     44 }
     45 
     46 init();
     47 </script>
     48 </body>