WebKit Bugzilla
Attachment 339385 Details for
Bug 185235
: Add tests to ensure Same-Site cookies are included when performing a top-level redirect
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Layout tests
bug-185235-20180502210934.patch (text/plain), 8.89 KB, created by
Daniel Bates
on 2018-05-02 21:09:34 PDT
(
hide
)
Description:
Layout tests
Filename:
MIME Type:
Creator:
Daniel Bates
Created:
2018-05-02 21:09:34 PDT
Size:
8.89 KB
patch
obsolete
>Subversion Revision: 231280 >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4da6e7c805c4f55f5f91e40f76c65da3ba3d6b9e..a0941ad4495ea31b71864d7bf3c018fb8a6d6c3a 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,17 @@ >+2018-05-02 Daniel Bates <dabates@apple.com> >+ >+ Add tests to ensure Same-Site cookies are included when performing a top-level redirect >+ https://bugs.webkit.org/show_bug.cgi?id=185235 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt: Added. >+ * http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html: Added. >+ * http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt: Added. >+ * http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html: Added. >+ * http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php: Added. >+ * http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php: Added. >+ > 2018-05-02 Ross Kirsling <ross.kirsling@sony.com> > > [WinCairo] Unreviewed gardening. Add missing Skip for http/wpt. >diff --git a/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8a2b89f2067ee2ec75f7afaee115e262be628a39 >--- /dev/null >+++ b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt >@@ -0,0 +1,20 @@ >+Tests that a SameSite Lax cookie for 127.0.0.1 is sent with a redirect from a page with a different origin. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Cookies sent with HTTP request: >+PASS Do not have cookie "strict". >+PASS Do not have cookie "implicit-strict". >+PASS Do not have cookie "strict-because-invalid-SameSite-value". >+PASS Has cookie "lax" with value 19. >+ >+Cookies visible in DOM: >+PASS Do not have DOM cookie "strict". >+PASS Do not have DOM cookie "implicit-strict". >+PASS Do not have DOM cookie "strict-because-invalid-SameSite-value". >+PASS Has DOM cookie "lax" with value 19. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3ac00723409b9708f6b40c6589ed0d14d718113e >--- /dev/null >+++ b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html >@@ -0,0 +1,19 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../resources/cookie-utilities.js"></script> >+<body> >+<script> >+async function runTest() >+{ >+ await resetCookies(); >+ await setCookie("strict", "19", {"SameSite": "Strict", "Max-Age": 100, "path": "/"}); >+ await setCookie("implicit-strict", "19", {"SameSite": null, "Max-Age": 100, "path": "/"}); >+ await setCookie("strict-because-invalid-SameSite-value", "19", {"SameSite": "invalid", "Max-Age": 100, "path": "/"}); >+ await setCookie("lax", "19", {"SameSite": "Lax", "Max-Age": 100, "path": "/"}); >+ window.location.href = "http://localhost:8000/resources/redirect.php?url=http://127.0.0.1:8000/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php"; >+} >+runTest(); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..a6751306d3a9a2f3420f05a1e5f5fd39e2d115ea >--- /dev/null >+++ b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt >@@ -0,0 +1,20 @@ >+Tests that a SameSite Lax cookie for 127.0.0.1 is sent with a redirect from a page with the same origin. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+Cookies sent with HTTP request: >+PASS Has cookie "strict" with value 20. >+PASS Has cookie "implicit-strict" with value 20. >+PASS Has cookie "strict-because-invalid-SameSite-value" with value 20. >+PASS Has cookie "lax" with value 20. >+ >+Cookies visible in DOM: >+PASS Has DOM cookie "strict" with value 20. >+PASS Has DOM cookie "implicit-strict" with value 20. >+PASS Has DOM cookie "strict-because-invalid-SameSite-value" with value 20. >+PASS Has DOM cookie "lax" with value 20. >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >diff --git a/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html >new file mode 100644 >index 0000000000000000000000000000000000000000..ba109a393247bb365a650b8801e04d05ac0d912f >--- /dev/null >+++ b/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html >@@ -0,0 +1,19 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="../resources/cookie-utilities.js"></script> >+<body> >+<script> >+async function runTest() >+{ >+ await resetCookies(); >+ await setCookie("strict", "20", {"SameSite": "Strict", "Max-Age": 100, "path": "/"}); >+ await setCookie("implicit-strict", "20", {"SameSite": null, "Max-Age": 100, "path": "/"}); >+ await setCookie("strict-because-invalid-SameSite-value", "20", {"SameSite": "invalid", "Max-Age": 100, "path": "/"}); >+ await setCookie("lax", "20", {"SameSite": "Lax", "Max-Age": 100, "path": "/"}); >+ window.location.href = "http://127.0.0.1:8000/resources/redirect.php?url=http://127.0.0.1:8000/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php"; >+} >+runTest(); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php b/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php >new file mode 100644 >index 0000000000000000000000000000000000000000..fd94b7e0f0b45d353b05a434eeff82d2302174c0 >--- /dev/null >+++ b/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="/js-test-resources/js-test.js"></script> >+<script src="../../resources/cookie-utilities.js"></script> >+<script>_setCachedCookiesJSON('<?php echo json_encode($_COOKIE); ?>')</script> >+</head> >+<body> >+<script> >+window.jsTestIsAsync = true; >+ >+description("Tests that a SameSite Lax cookie for 127.0.0.1 is sent with a redirect from a page with a different origin."); >+ >+async function checkResult() >+{ >+ debug("Cookies sent with HTTP request:"); >+ await shouldNotHaveCookie("strict"); >+ await shouldNotHaveCookie("implicit-strict"); >+ await shouldNotHaveCookie("strict-because-invalid-SameSite-value"); >+ await shouldHaveCookieWithValue("lax", "19"); >+ >+ debug("<br>Cookies visible in DOM:"); >+ shouldNotHaveDOMCookie("strict"); >+ shouldNotHaveDOMCookie("implicit-strict"); >+ shouldNotHaveDOMCookie("strict-because-invalid-SameSite-value"); >+ shouldHaveDOMCookieWithValue("lax", "19"); >+ >+ await resetCookies(); >+ finishJSTest(); >+} >+ >+checkResult(); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php b/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php >new file mode 100644 >index 0000000000000000000000000000000000000000..640697a3d99f098c89734aaf9cc07a93d046e484 >--- /dev/null >+++ b/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php >@@ -0,0 +1,35 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<script src="/js-test-resources/js-test.js"></script> >+<script src="../../resources/cookie-utilities.js"></script> >+<script>_setCachedCookiesJSON('<?php echo json_encode($_COOKIE); ?>')</script> >+</head> >+<body> >+<script> >+window.jsTestIsAsync = true; >+ >+description("Tests that a SameSite Lax cookie for 127.0.0.1 is sent with a redirect from a page with the same origin."); >+ >+async function checkResult() >+{ >+ debug("Cookies sent with HTTP request:"); >+ await shouldHaveCookieWithValue("strict", "20"); >+ await shouldHaveCookieWithValue("implicit-strict", "20"); >+ await shouldHaveCookieWithValue("strict-because-invalid-SameSite-value", "20"); >+ await shouldHaveCookieWithValue("lax", "20"); >+ >+ debug("<br>Cookies visible in DOM:"); >+ shouldHaveDOMCookieWithValue("strict", "20"); >+ shouldHaveDOMCookieWithValue("implicit-strict", "20"); >+ shouldHaveDOMCookieWithValue("strict-because-invalid-SameSite-value", "20"); >+ shouldHaveDOMCookieWithValue("lax", "20"); >+ >+ await resetCookies(); >+ finishJSTest(); >+} >+ >+checkResult(); >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185235
: 339385