Diff
Modified: trunk/LayoutTests/ChangeLog (231443 => 231444)
--- trunk/LayoutTests/ChangeLog 2018-05-07 17:41:50 UTC (rev 231443)
+++ trunk/LayoutTests/ChangeLog 2018-05-07 17:47:52 UTC (rev 231444)
@@ -1,3 +1,17 @@
+2018-05-07 Daniel Bates <[email protected]>
+
+ 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 Alex Christensen.
+
+ * 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-06 Dean Jackson <[email protected]>
WebGL: Reset simulated values after validation fails
Added: trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt (0 => 231444)
--- trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect-expected.txt 2018-05-07 17:47:52 UTC (rev 231444)
@@ -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
+
Added: trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html (0 => 231444)
--- trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-cross-origin-redirect.html 2018-05-07 17:47:52 UTC (rev 231444)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<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 = ""
+}
+runTest();
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt (0 => 231444)
--- trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect-expected.txt 2018-05-07 17:47:52 UTC (rev 231444)
@@ -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
+
Added: trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html (0 => 231444)
--- trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/same-site/fetch-after-top-level-same-origin-redirect.html 2018-05-07 17:47:52 UTC (rev 231444)
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<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 = ""
+}
+runTest();
+</script>
+</body>
+</html>
Added: trunk/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php (0 => 231444)
--- trunk/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-cross-origin-redirect.php 2018-05-07 17:47:52 UTC (rev 231444)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<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>
Added: trunk/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php (0 => 231444)
--- trunk/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php (rev 0)
+++ trunk/LayoutTests/http/tests/cookies/same-site/resources/fetch-after-top-level-same-origin-redirect.php 2018-05-07 17:47:52 UTC (rev 231444)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+<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>