Implement Same-Site cookies
[WebKit-https.git] / LayoutTests / http / tests / cookies / same-site / resources / fetch-in-cross-origin-service-worker.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 <script src="../../resources/cookie-utilities.js"></script>
6 </head>
7 <body>
8 <script>
9 window.jsTestIsAsync = true;
10
11 description("Tests that Same-Site cookies for 127.0.0.1 are not sent with a request initiated from an iframe- and processed by a service worker- with a different origin.");
12
13 async function checkResult()
14 {
15     setBaseURLWhenFetchingCookies("http://127.0.0.1:8000");
16
17     debug("Cookies sent with HTTP request:");
18     await shouldNotHaveCookie("strict");
19     await shouldNotHaveCookie("implicit-strict");
20     await shouldNotHaveCookie("strict-because-invalid-SameSite-value");
21     await shouldNotHaveCookie("lax");
22
23     debug("<br>Cookies visible in DOM:");
24     shouldNotHaveDOMCookie("strict");
25     shouldNotHaveDOMCookie("implicit-strict");
26     shouldNotHaveDOMCookie("strict-because-invalid-SameSite-value");
27     shouldNotHaveDOMCookie("lax");
28
29     await resetCookies();
30     finishJSTest();
31 }
32
33 checkResult();
34 </script>
35 </body>
36 </html>