Implement Same-Site cookies
[WebKit-https.git] / LayoutTests / http / tests / cookies / same-site / popup-same-site-via-same-site-redirect.html
1 <!DOCTYPE html>
2 <script src="/js-test-resources/testharness.js"></script>
3 <script src="/js-test-resources/testharnessreport.js"></script>
4 <script src="../resources/testharness-helpers.js"></script>
5 <script>
6 async_test(t => {
7     clearKnownCookies();
8     document.cookie = STRICT_DOM + "=1; SameSite=Strict; Max-Age=100; path=/";
9     document.cookie = IMPLICIT_STRICT_DOM + "=1; SameSite; Max-Age=100; path=/";
10     document.cookie = STRICT_BECAUSE_INVALID_SAMESITE_VALUE + "=1; SameSite=invalid; Max-Age=100; path=/";
11     document.cookie = LAX_DOM + "=1; SameSite=Lax; Max-Age=100; path=/";
12     document.cookie = NORMAL_DOM + "=1; Max-Age=100; path=/";
13
14     window.addEventListener("message", t.step_func_done(e => {
15         assert_equals(e.data.http[STRICT_DOM], "1", "strict");
16         assert_equals(e.data.http[IMPLICIT_STRICT_DOM], "1", "implicit-strict");
17         assert_equals(e.data.http[STRICT_BECAUSE_INVALID_SAMESITE_VALUE], "1", "strict-because-invalid-SameSite-value");
18         assert_equals(e.data.http[LAX_DOM], "1", "lax");
19         assert_equals(e.data.http[NORMAL_DOM], "1", "normal");
20         assert_equals(normalizeCookie(e.data.document), normalizeCookie(STRICT_BECAUSE_INVALID_SAMESITE_VALUE + "=1; " + IMPLICIT_STRICT_DOM + "=1; " + STRICT_DOM + "=1; " + LAX_DOM + "=1; " + NORMAL_DOM + "=1"));
21     }));
22
23     var i = window.open("http://127.0.0.1:8000/resources/redirect.php?url=http://127.0.0.1:8000/cookies/resources/post-cookies-to-opener.php");
24 }, "'127.0.0.1' is same-site with itself, so samesite cookies are sent.");
25 </script>