REGRESSION(r230367): a "." is prepended before cookies set without an explicit domain
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 May 2019 21:59:09 +0000 (21:59 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 May 2019 21:59:09 +0000 (21:59 +0000)
commite209ebdafa3ef53c1222aa3c3e3d12a27e92dc25
tree7f3f412b34a40a27a8ad4bb3d071d0adaf63ada5
parentf7a145c9917017ada275a49863b75bd21a928f48
REGRESSION(r230367): a "." is prepended before cookies set without an explicit domain
https://bugs.webkit.org/show_bug.cgi?id=197268
<rdar://problem/49767847>

Reviewed by Alex Christensen.

RFC 2965 states "If an explicitly specified value does not start with a dot, the user agent
supplies a leading dot.", so we should only be adding a leading "." if a `domain` is provided.

In order to not regress r230367, also delete all cookies for the non-"."-prefixed domain.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::addSingleCookie):
(WebKit::WebAutomationSession::deleteAllCookies):

* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::deleteCookiesForHostnames): Added.
(WebKit::WebCookieManagerProxy::deleteCookiesForHostname): Deleted.
* UIProcess/API/C/WKCookieManager.cpp:
(WKCookieManagerDeleteCookiesForHostname):
* NetworkProcess/Cookies/WebCookieManager.messages.in:
* NetworkProcess/Cookies/WebCookieManager.h:
* NetworkProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::deleteCookiesForHostnames): Added.
(WebKit::WebCookieManager::deleteCookiesForHostname): Deleted.
Since the underlying `NetworkStorageSession` accepts a list of domains, extend that support
to allow the IPC to send a list of domains as well, but still keep the C API the same.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244924 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp
Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h
Source/WebKit/NetworkProcess/Cookies/WebCookieManager.messages.in
Source/WebKit/UIProcess/API/C/WKCookieManager.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit/UIProcess/WebCookieManagerProxy.h