Bug 188080 - Add tests to ensure that Same-Site cookies are stored when set as the first party
Summary: Add tests to ensure that Same-Site cookies are stored when set as the first p...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-07-26 14:58 PDT by Daniel Bates
Modified: 2018-08-06 16:48 PDT (History)
3 users (show)

See Also:


Attachments
Layout tests (10.61 KB, patch)
2018-07-26 15:47 PDT, Daniel Bates
ap: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-07-26 14:58:59 PDT
Add a tests to ensure that same-site cookies are stored when set as the first party to ensure we do not regress such behavior.
Comment 1 Daniel Bates 2018-07-26 15:47:53 PDT
Created attachment 345884 [details]
Layout tests
Comment 2 Alexey Proskuryakov 2018-07-27 10:04:17 PDT
Comment on attachment 345884 [details]
Layout tests

View in context: https://bugs.webkit.org/attachment.cgi?id=345884&action=review

> LayoutTests/ChangeLog:11
> +        * http/tests/cookies/resources/cookie-utilities.php: Added.

I’m not sure why the new file was needed, we certainly have these utilities already available.
Comment 3 Daniel Bates 2018-08-06 15:11:54 PDT
(In reply to Alexey Proskuryakov from comment #2)
> Comment on attachment 345884 [details]
> Layout tests
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=345884&action=review
> 
> > LayoutTests/ChangeLog:11
> > +        * http/tests/cookies/resources/cookie-utilities.php: Added.
> 
> I’m not sure why the new file was needed, we certainly have these utilities
> already available.

I could not find such a library. I found many one-off scripts:

$ grep -R "setcookie" LayoutTests/http/
LayoutTests/http//tests/blink/sendbeacon/resources/save-beacon.php:      setcookie($name, "deleted", time() - 60, "/");
LayoutTests/http//tests/misc/resources/prefetch-purpose.php:<?php setcookie("Purpose", $_SERVER["HTTP_PURPOSE"]);
LayoutTests/http//tests/misc/resources/prefetch-purpose.php:    setcookie("Purpose", "", time() - 3600);
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies-worker.php:    setcookie("WK-websocket-test", "0", time()-1);
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies-worker.php:    setcookie("WK-websocket-test-httponly", "0", time()-1, "", "", false, true);
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies-worker.php:    setcookie("WK-websocket-test", "1");
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies-worker.php:    setcookie("WK-websocket-test-httponly", "1", time()+3600, "", "", false, true);
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies.php:    setcookie("WK-websocket-test", "0", time()-1);
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies.php:    setcookie("WK-websocket-test-httponly", "0", time()-1, "", "", false, true);
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies.php:    setcookie("WK-websocket-test", "1");
LayoutTests/http//tests/websocket/tests/hybi/contentextensions/block-cookies.php:    setcookie("WK-websocket-test-httponly", "1", time()+3600, "", "", false, true);
LayoutTests/http//tests/loading/resourceLoadStatistics/resources/set-cookie.php:setcookie($_GET["name"], $_GET["value"], (time()+60*60*24*30), "/");
LayoutTests/http//tests/cache/disk-cache/resources/json.php:setcookie($id, $count + 1);
LayoutTests/http//tests/security/contentSecurityPolicy/resources/save-report.php:        setcookie($name, "deleted", time() - 60, "/");
LayoutTests/http//tests/security/resources/set-cookie.php:setcookie($_GET["name"], $_GET["value"], 0, "/");
LayoutTests/http//tests/security/cookies/resources/set-a-cookie.php:    setcookie("test_cookie", "1", 0, "/");
LayoutTests/http//tests/storageAccess/resources/set-cookie.php:setcookie($_GET["name"], $_GET["value"], (time()+60*60*24*30), "/");
LayoutTests/http//tests/navigation/resources/save-Ping.php:        setcookie($name, "deleted", time() - 60, "/");
LayoutTests/http//tests/contentextensions/resources/save-ping.php:        setcookie($name, "deleted", time() - 60, "/");
LayoutTests/http//tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php:  setcookie("test_cookie", "1", time() + 86400);
LayoutTests/http//tests/resourceLoadStatistics/resources/set-cookie-on-redirect.php:    setcookie("test_cookie", "", time() - 86400);
LayoutTests/http//tests/resourceLoadStatistics/resources/set-cookie.php:setcookie($_GET["name"], $_GET["value"], (time()+60*60*24*30), "/");
LayoutTests/http//tests/appcache/document-cookie.php:setcookie("foo", "bar", 0, "/");
LayoutTests/http//tests/appcache/document-cookie-http-only.php:setcookie("scope", "manifest", 0, "/appcache/resources/scope1", null, null, true);
LayoutTests/http//tests/appcache/document-cookie-http-only.php:setcookie("scope", "script", 0, "/appcache/resources/scope2", null, null, true);
LayoutTests/http//tests/appcache/document-cookie-http-only.php:setcookie("foo", "bar");
LayoutTests/http//tests/cookies/resources/setArraycookies.php:setcookie("setArraycookie[three]", "cookiethree");
LayoutTests/http//tests/cookies/resources/setArraycookies.php:setcookie("setArraycookie[two]", "cookietwo");
LayoutTests/http//tests/cookies/resources/setArraycookies.php:setcookie("setArraycookie[one]", "cookieone");
LayoutTests/http//tests/cookies/resources/set-cookie-on-redirect.php:  setcookie("test_cookie", "1", time() + 86400);
LayoutTests/http//tests/cookies/resources/set-cookie-on-redirect.php:    setcookie("test_cookie", "", time() - 86400);
LayoutTests/http//tests/cookies/resources/cookie-utility.php:    setcookie($name, "deleted", time() - 86400, '/');
LayoutTests/http//tests/cookies/resources/cookie-utility.php:    setcookie("foo", "awesomevalue", time() + 86400, '/');
LayoutTests/http//tests/cookies/resources/cookie-utility.php:    setcookie("foo", "awesomevalue", time() + 86400, '/');
LayoutTests/http//tests/cookies/resources/cookie-utility.php:    setcookie("bar", "anotherawesomevalue", time() + 86400, '/');
LayoutTests/http//tests/cookies/resources/setUtf8Cookies.php:    setcookie("php_cookie", "UTF-8 æøå 中国");
Comment 4 Daniel Bates 2018-08-06 15:21:38 PDT
Committed r234629: <https://trac.webkit.org/changeset/234629>
Comment 5 Radar WebKit Bug Importer 2018-08-06 16:48:53 PDT
<rdar://problem/42986878>