summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/workers/same-site-cookies/resources/iframe-iframe.html
blob: 0c5582176d4fe04e47f7f5f106a855f289107c79 (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
<!doctype html>
<meta charset="utf-8">
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<body>
<script>
// Step 3 (workers/same-site-cookies/third-party.{})
test_driver.set_test_context(window.top);
const type = (new URLSearchParams(window.location.search)).get("type");
let options = {};
switch (type) {
    case "default":
        break;
    case "all":
        options.sameSiteCookies = "all";
        break;
    case "none":
        options.sameSiteCookies = "none";
        break;
}
// Step 5 (workers/same-site-cookies/third-party.{})
try {
    const worker = new SharedWorker("/workers/same-site-cookies/resources/worker.js", options);
    worker.port.onmessage = (e) => {
        window.top.postMessage(e.data, "*");
    };
} catch (_) {
    window.top.postMessage("DidNotStart", "*");
}
</script>
</body>