| <!doctype html> |
| <script src="/resources/testharness.js"></script> |
| <script src="/resources/testharnessreport.js"></script> |
| <script src="/cookies/resources/testharness-helpers.js"></script> |
| <script> |
| // Set cookies on ORIGINAL_HOST, then move ourselves to TEST_ROOT so |
| // we can verify cross-origin behavior. |
| if (window.location.hostname == "127.0.0.1") { |
| window.location.hostname = ORIGINAL_HOST; |
| } else if (window.location.hostname == ORIGINAL_HOST) { |
| clearKnownCookies(); |
| document.cookie = STRICT_DOM + "=1; SameSite=Strict; 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.location.hostname = TEST_HOST; |
| } else { |
| async_test(t => { |
| var i = window.open("http://" + ORIGINAL_HOST + ":8000/cookies/resources/post-cookies-to-opener.php"); |
| window.addEventListener("message", t.step_func_done(e => { |
| assert_equals(e.data.http[STRICT_DOM], undefined, "strict"); |
| assert_equals(e.data.http[LAX_DOM], "1", "lax"); |
| assert_equals(e.data.http[NORMAL_DOM], "1", "normal"); |
| // TODO(mkwst): This should exclude the strict cookie. |
| assert_equals(e.data.document, STRICT_DOM + "=1; " + LAX_DOM + "=1; " + NORMAL_DOM + "=1"); |
| })); |
| }, "'" + ORIGINAL_HOST + "' is not same-site with '" + TEST_HOST + "', so strict samesite cookies are not sent."); |
| } |
| </script> |