summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/resources/popup-noopener-inner.html
blob: 6a79fd21b297c626db6e032ec9f4efd9d1a957aa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="utils.js"></script>
<title>Fenced frame creating popups</title>

<body>
<script>
async function init() {
  // This file is meant to run in a <fencedframe>. It sets up multiple frames
  // in the following arrangements:
  //   1.) A top-level fenced frame
  //   2.) An iframe within a fenced frame
  //   3.) A nested fenced frame
  // All of the above frames create a popup which should not return a reference
  // to the new window.

  const [popup_noopener_key, popup_openee_key, popup_name_key, test_type] =
      parseKeylist();

  switch (test_type) {
    case "top-level fenced frame":
      src_popup = generateURL(`popup-noopener-destination.html`,
          [popup_noopener_key, popup_name_key]);
      const popup = window.open(src_popup, "foo");
      if (popup) {
        writeValueToServer(popup_openee_key, "FAIL");
      } else {
        writeValueToServer(popup_openee_key, "PASS");
      }
      break;
    case "nested iframe":
      const iframe = document.createElement('iframe');
      document.body.append(iframe);
      iframe.src = generateURL(`create-popup.html`,
          [popup_noopener_key, popup_openee_key, popup_name_key]);
      break;
    case "nested fenced frame":
      const ff =
          attachFencedFrame(generateURL(`create-popup.html`,
              [popup_noopener_key, popup_openee_key, popup_name_key]));
      break;
  }

}

init();
</script>
</body>