File: popup-noopener.https.html

package info (click to toggle)
firefox-esr 115.15.0esr-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,659,216 kB
  • sloc: cpp: 6,676,686; javascript: 5,690,965; ansic: 3,328,546; python: 1,120,594; asm: 397,163; xml: 180,531; java: 178,838; sh: 68,930; makefile: 20,999; perl: 12,595; objc: 12,561; yacc: 4,583; cs: 3,846; pascal: 2,840; lex: 1,720; ruby: 1,079; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (57 lines) | stat: -rw-r--r-- 2,030 bytes parent folder | download | duplicates (18)
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
49
50
51
52
53
54
55
56
57
<!DOCTYPE html>
<title>Test popup created from a Fenced Frame Tree</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/utils.js"></script>
<script src="/common/utils.js"></script>

<body>
<script>
// This key is used by `resources/popup-noopener-destination.html` to let us know if a
// a new popup window is correctly opened without an opener.
const popup_noopener_key = token();
const kAssertion = "window.opener is null ";

// This key is used by `resources/popup-noopener-inner.html` and
// `resources/create-popup.html to let us know if a
// a new popup window is correctly opened without an openee reference.
const popup_openee_key = token();
const kAssertion_openee = "openee is null ";

// This key is used by `resources/popup-noopener-destination.html` to let us know if a
// a new popup window is correctly opened without a name.
const popup_name_key = token();
const kAssertion_name = "window.name is empty string ";

async function runTest(test_type) {
  const fenced_frame =
    attachFencedFrame(generateURL(
        `resources/popup-noopener-inner.html`,
        [popup_noopener_key, popup_openee_key, popup_name_key, test_type]));

  result = await nextValueFromServer(popup_openee_key);
  assert_equals(result, "PASS", kAssertion_openee + test_type);

  result = await nextValueFromServer(popup_noopener_key);
  assert_equals(result, "PASS", kAssertion + test_type);

  result = await nextValueFromServer(popup_name_key);
  assert_equals(result, "PASS", kAssertion + test_type);

  // Clean up the fenced frame
  document.body.removeChild(fenced_frame);
}

promise_test(async () => {
  return runTest("top-level fenced frame");
}, "Create popup from top-level fenced frame");

promise_test(async () => {
  return runTest("nested iframe");
}, "Create popup from iframe nested in a fenced frame");

promise_test(async () => {
  return runTest("nested fenced frame");
}, "Create popup from nested fenced frame");
</script>
</body>