WKWebView provides no access to cookies.
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Mar 2017 23:00:49 +0000 (23:00 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 13 Mar 2017 23:00:49 +0000 (23:00 +0000)
commit30b36038f5185c37f93318f1996e1094d3932321
tree3b2a06b04bb5d9b8a269d065de41e68d9f837283
parentb9bfffbfe37f6184720d49ad67f0530b4a1d72a6
WKWebView provides no access to cookies.
https://bugs.webkit.org/show_bug.cgi?id=140191

Reviewed by Tim Horton.

Source/WebCore:

Covered by API tests.

* platform/Cookie.h:

* platform/network/NetworkStorageSession.h:
* platform/network/cocoa/NetworkStorageSessionCocoa.mm:
(WebCore::NetworkStorageSession::setCookie):
(WebCore::NetworkStorageSession::deleteCookie):
(WebCore::nsCookiesToCookieVector):
(WebCore::NetworkStorageSession::getAllCookies):
(WebCore::NetworkStorageSession::getCookies):

* platform/network/soup/NetworkStorageSessionSoup.cpp:
(WebCore::NetworkStorageSession::deleteCookie):
(WebCore::NetworkStorageSession::getAllCookies):
(WebCore::NetworkStorageSession::getCookies):

Source/WebKit2:

This adds a new WKHTTPCookieManager SPI.
It follows the NSHTTPCookieStorage API but asynchronous (with completion handlers).

* CMakeLists.txt:
* WebKit2.xcodeproj/project.pbxproj:

* Shared/API/APIObject.h:
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):

* UIProcess/API/APIHTTPCookieStorage.cpp: Added.
(API::HTTPCookieStorage::HTTPCookieStorage):
(API::HTTPCookieStorage::~HTTPCookieStorage):
(API::HTTPCookieStorage::cookies):
(API::HTTPCookieStorage::setCookie):
(API::HTTPCookieStorage::setCookies):
(API::HTTPCookieStorage::deleteCookie):
(API::HTTPCookieStorage::removeCookiesSinceDate):
(API::HTTPCookieStorage::setHTTPCookieAcceptPolicy):
(API::HTTPCookieStorage::getHTTPCookieAcceptPolicy):
* UIProcess/API/APIHTTPCookieStorage.h: Added.

* UIProcess/API/APIWebsiteDataStore.cpp:
(API::WebsiteDataStore::defaultDataStore):
(API::WebsiteDataStore::httpCookieStorage):
* UIProcess/API/APIWebsiteDataStore.h:

* UIProcess/API/C/WKCookieManager.cpp:
(WKCookieManagerDeleteAllCookiesModifiedAfterDate):
(WKCookieManagerSetHTTPCookieAcceptPolicy):
(WKCookieManagerGetHTTPCookieAcceptPolicy):

* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreGetDefaultDataStore):

* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool _setCookieAcceptPolicy:]):

* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(+[WKWebsiteDataStore defaultDataStore]):
(-[WKWebsiteDataStore _httpCookieStorage]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:

* UIProcess/API/Cocoa/WKHTTPCookieStorage.h:
* UIProcess/API/Cocoa/WKHTTPCookieStorage.mm: Added.
(coreCookiesToNSCookies):
(-[WKHTTPCookieStorage dealloc]):
(-[WKHTTPCookieStorage fetchCookies:]):
(-[WKHTTPCookieStorage fetchCookiesForURL:completionHandler:]):
(-[WKHTTPCookieStorage setCookie:completionHandler:]):
(-[WKHTTPCookieStorage deleteCookie:completionHandler:]):
(-[WKHTTPCookieStorage setCookies:forURL:mainDocumentURL:completionHandler:]):
(-[WKHTTPCookieStorage removeCookiesSinceDate:completionHandler:]):
(-[WKHTTPCookieStorage setCookieAcceptPolicy:completionHandler:]):
(kitCookiePolicyToNSCookiePolicy):
(-[WKHTTPCookieStorage fetchCookieAcceptPolicy:]):
(-[WKHTTPCookieStorage _apiObject]):
* UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h: Copied from Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h.
(WebKit::wrapper):

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

* UIProcess/WebCookieManagerProxy.cpp:
(WebKit::WebCookieManagerProxy::getHostnamesWithCookies):
(WebKit::WebCookieManagerProxy::deleteCookiesForHostname):
(WebKit::WebCookieManagerProxy::deleteAllCookies):
(WebKit::WebCookieManagerProxy::deleteCookie):
(WebKit::WebCookieManagerProxy::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManagerProxy::setCookie):
(WebKit::WebCookieManagerProxy::setCookies):
(WebKit::WebCookieManagerProxy::getAllCookies):
(WebKit::WebCookieManagerProxy::getCookies):
(WebKit::WebCookieManagerProxy::didSetCookies):
(WebKit::WebCookieManagerProxy::didGetCookies):
(WebKit::WebCookieManagerProxy::didDeleteCookies):
(WebKit::WebCookieManagerProxy::startObservingCookieChanges):
(WebKit::WebCookieManagerProxy::stopObservingCookieChanges):
(WebKit::WebCookieManagerProxy::setCookieObserverCallback):
(WebKit::WebCookieManagerProxy::cookiesDidChange):
(WebKit::WebCookieManagerProxy::setHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::getHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy):
(WebKit::WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy):
* UIProcess/WebCookieManagerProxy.h:
* UIProcess/WebCookieManagerProxy.messages.in:

* UIProcess/WebFrameProxy.h:

* UIProcess/WebProcessPool.cpp:
* UIProcess/WebProcessPool.h:

* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::processPoolForCookieStorageOperations):
(WebKit::WebsiteDataStore::processPools):
* UIProcess/WebsiteData/WebsiteDataStore.h:

* WebProcess/Cookies/WebCookieManager.cpp:
(WebKit::WebCookieManager::deleteCookie):
(WebKit::WebCookieManager::deleteAllCookiesModifiedSince):
(WebKit::WebCookieManager::getAllCookies):
(WebKit::WebCookieManager::getCookies):
(WebKit::WebCookieManager::setCookie):
(WebKit::WebCookieManager::setCookies):
(WebKit::WebCookieManager::setHTTPCookieAcceptPolicy):
* WebProcess/Cookies/WebCookieManager.h:
* WebProcess/Cookies/WebCookieManager.messages.in:

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@213877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
39 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/Cookie.h
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm
Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp
Source/WebKit2/Shared/API/APIObject.h
Source/WebKit2/Shared/Cocoa/APIObject.mm
Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp
Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h
Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp
Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.mm [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp
Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp
Source/WebKit2/UIProcess/WebCookieManagerProxy.h
Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in
Source/WebKit2/UIProcess/WebFrameProxy.h
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp
Source/WebKit2/WebProcess/Cookies/WebCookieManager.h
Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStorage.mm [new file with mode: 0644]