summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/cross-origin-opener-policy/coep-redirect.https.html
blob: 83f8f8a33d4b2c9c7f23c02011bcc568836e62ea (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<!doctype html>
<title>Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy: redirects</title>
<meta name=timeout content=long>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/common.js"></script>
<script>
const coopCOEPPath = new URL("resources/coop-coep.py", window.location).pathname;

[
  {
    "title": "coop/coep to coop/coep",
    "redirectCOOP": "same-origin",
    "redirectCOEP": "require-corp",
    "coop": "same-origin",
    "coep": "require-corp",
    "opener": true
  },
  {
    "title": "coop/coep to no coop/coep",
    "redirectCOOP": "same-origin",
    "redirectCOEP": "require-corp",
    "coop": "",
    "coep": "require-corp",
    "opener": false
  },
  {
    "title": "no coop/no coep to coop/coep",
    "redirectCOOP": "",
    "redirectCOEP": "",
    "coop": "same-origin",
    "coep": "require-corp",
    "opener": false
  },
  {
    "title": "coop/no coep to coop/coep",
    "redirectCOOP": "same-origin",
    "redirectCOEP": "",
    "coop": "same-origin",
    "coep": "require-corp",
    "opener": false
  },
  {
    "title": "coop unsafe-none/coep to coop/coep",
    "redirectCOOP": "unsafe-none",
    "redirectCOEP": "require-corp",
    "coop": "same-origin",
    "coep": "require-corp",
    "opener": false
  },
  {
    "title": "coop unsafe-none/coep to coop unsafe-inherit/coep",
    "redirectCOOP": "unsafe-none",
    "redirectCOEP": "require-corp",
    "coop": "unsafe-none",
    "coep": "require-corp",
    "opener": false
  }
].forEach(variant => {
  const title = `Redirect from ${variant.title}`;
  async_test(t => {
    const channel = title.replace(/ /g,"-");
    const redirectLocation = `${SAME_ORIGIN.origin}${coopCOEPPath}?coop=${variant.coop}&coep=${variant.coep}&channel=${channel}`;
    url_test(t, `${SAME_ORIGIN.origin}${coopCOEPPath}?coop=${variant.redirectCOOP}&coep=${variant.redirectCOEP}&redirect=${encodeURIComponent(redirectLocation)}`, channel, variant.opener);
  }, title);
});
</script>