File: going-back.sub.https.html

package info (click to toggle)
firefox 144.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,637,504 kB
  • sloc: cpp: 7,576,692; javascript: 6,430,831; ansic: 3,748,119; python: 1,398,978; xml: 628,810; asm: 438,679; java: 186,194; sh: 63,212; makefile: 19,159; objc: 13,086; perl: 12,986; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 53; csh: 10
file content (62 lines) | stat: -rw-r--r-- 2,242 bytes parent folder | download | duplicates (22)
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
58
59
60
61
62
<!DOCTYPE html>
<meta charset="utf-8">
<title>Parent is origin-keyed, child1 is site-keyed, child1 navigates to a different site, child2 gets inserted and is origin-keyed, child1 navigates back</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<div id="log"></div>

<script type="module">
import {
  insertIframe,
  navigateIframe,
  waitForIframe,
  setBothDocumentDomains,
  testDifferentAgentClusters,
  testSameAgentCluster,
} from "./resources/helpers.mjs";

let frame1;
promise_setup(async () => {
  frame1 = await insertIframe("{{hosts[][www]}}");
});

// Since they're different-origin, the parent's origin-keying request is
// respected, as is the child's non-request. So the parent ends up in the
// origin-keyed agent cluster and the child ends up in the site-keyed one.
testDifferentAgentClusters([self, 0], "Before navigation: parent to child1");

// Navigate the iframe to a different site. These, of course, must not be in the
// same agent cluster.

promise_test(async () => {
  await navigateIframe(frame1, "{{hosts[alt][]}}");
}, "Navigation");

// Now insert a second iframe, pointing to the same place as the first one
// originally did, but this time with origin-keying requested. Because of the
// historical map of agent cluster keys for the browsing context group, the new
// iframe should still end up in the site-keyed agent cluster.

promise_test(async () => {
  await insertIframe("{{hosts[][www]}}", "?1");
}, "Inserting a second iframe");

testDifferentAgentClusters([self, 1], "After navigation: parent to child2");

// Now navigate the first iframe back. The resulting Document should be put in
// the site-keyed agent cluster, together with the second iframe's Document.

promise_test(async () => {
  const waitPromise = waitForIframe(frame1);
  history.back();
  await waitPromise;

  await setBothDocumentDomains(frames[0]);
}, "Going back in history (navigating back the first iframe)");

testDifferentAgentClusters([self, 0], "After back: parent to child1");
testDifferentAgentClusters([self, 1], "After back: parent to child2");
testSameAgentCluster([0, 1], "child1 to child2");
testSameAgentCluster([1, 0], "child2 to child1");
</script>