File: history-length-fenced-navigations-replace-do-not-contribute-to-joint.https.html

package info (click to toggle)
thunderbird 1%3A128.14.0esr-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 4,334,824 kB
  • sloc: cpp: 7,391,917; javascript: 5,617,271; ansic: 3,833,216; python: 1,230,742; xml: 619,690; asm: 456,022; java: 179,892; sh: 118,796; makefile: 21,908; perl: 14,825; objc: 12,399; yacc: 4,583; pascal: 2,973; lex: 1,720; ruby: 1,190; exp: 762; sql: 674; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (55 lines) | stat: -rw-r--r-- 2,685 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
<!DOCTYPE html>
<title>Test history.length in outermost document</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>
promise_test(async () => {
  const kInnerAssertion = "Navigations inside of a fenced frame are always " +
                          "replacement navigations and never increase " +
                          "`history.length` inside the fence: ";
  const kOuterAssertion = "Navigations inside of a fenced frame never " +
                          "contribute to joint session history, or increase " +
                          "`history.length` outside the fence: ";
  // This is used by
  // `resources/history-length-fenced-navigations-replace-do-not-contribute-to-joint-inner.html`
  // to let us know once a navigation is complete inside the fence. The inner
  // page will test its `history.length` and report to us "PASS <frame type>" or
  // "FAIL <frame type>" (the history length should be unaffected by the
  // navigation). If the inner test passes, then we will check our
  // `history.length` and ensure that the inner fenced navigation did not
  // contribute to the joint session history.
  const fenced_navigation_complete_key = token();
  // This is sent by us to the inner page to let it know that we're finished
  // observing the effects of the last navigation, and that it should perform
  // the next one for us to observe.
  const outer_page_ready_for_next_fenced_navigation_key = token();

  const level = "top-level-fenced-frame";

  attachFencedFrame(generateURL(
      "resources/history-length-fenced-navigations-replace-do-" +
      "not-contribute-to-joint-inner.html",
      [fenced_navigation_complete_key,
       outer_page_ready_for_next_fenced_navigation_key,
       level]));

  const tests = ["top-level-fenced-frame", "nested-fenced-frame", "nested-iframe"];
  for (test_type of tests) {
    // Wait for the fenced navigations to complete, and then see if they
    // observable via the outermost `history.length`.
    let result = await nextValueFromServer(fenced_navigation_complete_key);
    assert_equals(result, "PASS > " + test_type, kInnerAssertion + test_type);
    assert_equals(history.length, 1, kOuterAssertion + test_type);

    // Acknowledge the results, and let the fenced frame know that we're ready
    // to observe more fenced navigations.
    writeValueToServer(outer_page_ready_for_next_fenced_navigation_key, "READY");
  }
}, "All fenced navigations should be replace-only and not contribute to joint " +
   "session history");
</script>
</body>