| <!DOCTYPE html> |
| <script src="/js-test-resources/testharness.js"></script> |
| <script src="/js-test-resources/testharnessreport.js"></script> |
| <script src="../resources/testharness-helpers.js"></script> |
| <body> |
| <script> |
| async_test(t => { |
| clearKnownCookies(); |
| document.cookie = STRICT_DOM + "=1; SameSite=Strict; Max-Age=100; path=/"; |
| document.cookie = IMPLICIT_STRICT_DOM + "=1; SameSite; Max-Age=100; path=/"; |
| document.cookie = STRICT_BECAUSE_INVALID_SAMESITE_VALUE + "=1; SameSite=invalid; Max-Age=100; path=/"; |
| document.cookie = LAX_DOM + "=1; SameSite=Lax; Max-Age=100; path=/"; |
| document.cookie = NORMAL_DOM + "=1; Max-Age=100; path=/"; |
| |
| window.addEventListener("message", t.step_func_done(e => { |
| assert_equals(e.data.http[STRICT_DOM], "1", "strict"); |
| assert_equals(e.data.http[IMPLICIT_STRICT_DOM], "1", "implicit-strict"); |
| assert_equals(e.data.http[STRICT_BECAUSE_INVALID_SAMESITE_VALUE], "1", "strict-because-invalid-SameSite-value"); |
| assert_equals(e.data.http[LAX_DOM], "1", "lax"); |
| assert_equals(e.data.http[NORMAL_DOM], "1", "normal"); |
| 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")); |
| e.source.close(); |
| })); |
| |
| var f = document.createElement('form'); |
| f.action = "http://127.0.0.1:8000/cookies/resources/post-cookies-to-opener.py"; |
| f.method = "POST"; |
| f.target = "_blank"; |
| f.rel = "opener"; |
| window.onload = t.step_func(f.submit.bind(f)); |
| document.body.appendChild(f); |
| }, "'127.0.0.1' is same-site with itself, so samesite cookies are sent via POST."); |
| </script> |
| </body> |