<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[213877] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/213877">213877</a></dd>
<dt>Author</dt> <dd>beidson@apple.com</dd>
<dt>Date</dt> <dd>2017-03-13 16:00:49 -0700 (Mon, 13 Mar 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformCookieh">trunk/Source/WebCore/platform/Cookie.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkNetworkStorageSessionh">trunk/Source/WebCore/platform/network/NetworkStorageSession.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcocoaNetworkStorageSessionCocoamm">trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworksoupNetworkStorageSessionSoupcpp">trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2CMakeListstxt">trunk/Source/WebKit2/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesssoupNetworkProcessSoupcpp">trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedAPIAPIObjecth">trunk/Source/WebKit2/Shared/API/APIObject.h</a></li>
<li><a href="#trunkSourceWebKit2SharedCocoaAPIObjectmm">trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIWebsiteDataStorecpp">trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIWebsiteDataStoreh">trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKCookieManagercpp">trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICWKWebsiteDataStoreRefcpp">trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStoremm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStorePrivateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitCookieManagercpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAutomationWebAutomationSessioncpp">trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebCookieManagerProxycpp">trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebCookieManagerProxyh">trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebCookieManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebFrameProxyh">trunk/Source/WebKit2/UIProcess/WebFrameProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolcpp">trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebProcessPoolh">trunk/Source/WebKit2/UIProcess/WebProcessPool.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStoreh">trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessCookiesWebCookieManagercpp">trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessCookiesWebCookieManagerh">trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessCookiesWebCookieManagermessagesin">trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIHTTPCookieStoragecpp">trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIHTTPCookieStorageh">trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKHTTPCookieStorageh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKHTTPCookieStoragemm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKHTTPCookieStorageInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaWKHTTPCookieStoragemm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStorage.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebCore/ChangeLog        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2017-03-13  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        WKWebView provides no access to cookies.
+        https://bugs.webkit.org/show_bug.cgi?id=140191
+
+        Reviewed by Tim Horton.
+
+        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):
+
</ins><span class="cx"> 2017-03-13  Devin Rousso  &lt;webkit@devinrousso.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Event Listeners section is missing 'once', 'passive' event listener flags
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformCookieh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/Cookie.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/Cookie.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebCore/platform/Cookie.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> 
</span><span class="cx"> #ifdef __OBJC__
</span><span class="cx">     WEBCORE_EXPORT Cookie(NSHTTPCookie *);
</span><del>-    operator NSHTTPCookie *() const;
</del><ins>+    WEBCORE_EXPORT operator NSHTTPCookie *() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     String name;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkNetworkStorageSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -100,7 +100,11 @@
</span><span class="cx">     NetworkingContext* context() const;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT void setCookie(const Cookie&amp;);
</ins><span class="cx">     WEBCORE_EXPORT void setCookies(const Vector&lt;Cookie&gt;&amp;, const URL&amp;, const URL&amp; mainDocumentURL);
</span><ins>+    WEBCORE_EXPORT void deleteCookie(const Cookie&amp;);
+    WEBCORE_EXPORT Vector&lt;Cookie&gt; getAllCookies();
+    WEBCORE_EXPORT Vector&lt;Cookie&gt; getCookies(const URL&amp;);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     static HashMap&lt;SessionID, std::unique_ptr&lt;NetworkStorageSession&gt;&gt;&amp; globalSessionMap();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcocoaNetworkStorageSessionCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -32,6 +32,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><ins>+void NetworkStorageSession::setCookie(const Cookie&amp; cookie)
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    [nsCookieStorage() setCookie:(NSHTTPCookie *)cookie];
+    END_BLOCK_OBJC_EXCEPTIONS;
+}
+
</ins><span class="cx"> void NetworkStorageSession::setCookies(const Vector&lt;Cookie&gt;&amp; cookies, const URL&amp; url, const URL&amp; mainDocumentURL)
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSMutableArray&gt; nsCookies = adoptNS([[NSMutableArray alloc] initWithCapacity:cookies.size()]);
</span><span class="lines">@@ -43,6 +50,31 @@
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkStorageSession::deleteCookie(const Cookie&amp; cookie)
+{
+    [nsCookieStorage() deleteCookie:(NSHTTPCookie *)cookie];
+}
+
+static Vector&lt;Cookie&gt; nsCookiesToCookieVector(NSArray&lt;NSHTTPCookie *&gt; *nsCookies)
+{
+    Vector&lt;Cookie&gt; cookies;
+    cookies.reserveInitialCapacity(nsCookies.count);
+    for (NSHTTPCookie *nsCookie in nsCookies)
+        cookies.uncheckedAppend(nsCookie);
+
+    return cookies;
+}
+
+Vector&lt;Cookie&gt; NetworkStorageSession::getAllCookies()
+{
+    return nsCookiesToCookieVector(nsCookieStorage().cookies);
+}
+
+Vector&lt;Cookie&gt; NetworkStorageSession::getCookies(const URL&amp; url)
+{
+    return nsCookiesToCookieVector([nsCookieStorage() cookiesForURL:(NSURL *)url]);
+}
+
</ins><span class="cx"> NSHTTPCookieStorage *NetworkStorageSession::nsCookieStorage() const
</span><span class="cx"> {
</span><span class="cx">     auto cfCookieStorage = cookieStorage();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworksoupNetworkStorageSessionSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebCore/platform/network/soup/NetworkStorageSessionSoup.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -304,7 +304,21 @@
</span><span class="cx">         soup_cookie_jar_add_cookie(cookieStorage(), toSoupCookie(cookie));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void NetworkStorageSession::deleteCookie(const Cookie&amp;)
+{
+    // FIXME: Implement for WK2 to use.
+}
</ins><span class="cx"> 
</span><ins>+Vector&lt;Cookie&gt; NetworkStorageSession::getAllCookies()
+{
+    // FIXME: Implement for WK2 to use.
+}
+
+Vector&lt;Cookie&gt; NetworkStorageSession::getCookies(const URL&amp;)
+{
+    // FIXME: Implement for WK2 to use.
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // USE(SOUP)
</span></span></pre></div>
<a id="trunkSourceWebKit2CMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/CMakeLists.txt (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/CMakeLists.txt        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/CMakeLists.txt        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -333,6 +333,7 @@
</span><span class="cx">     UIProcess/API/APIContentExtensionStore.cpp
</span><span class="cx">     UIProcess/API/APIExperimentalFeature.cpp
</span><span class="cx">     UIProcess/API/APIFrameInfo.cpp
</span><ins>+    UIProcess/API/APIHTTPCookieStorage.cpp
</ins><span class="cx">     UIProcess/API/APIHitTestResult.cpp
</span><span class="cx">     UIProcess/API/APINavigation.cpp
</span><span class="cx">     UIProcess/API/APINavigationData.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/ChangeLog        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -1,3 +1,118 @@
</span><ins>+2017-03-13  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        WKWebView provides no access to cookies.
+        https://bugs.webkit.org/show_bug.cgi?id=140191
+
+        Reviewed by Tim Horton.
+
+        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:
+
</ins><span class="cx"> 2017-03-13  John Wilander  &lt;wilander@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Resource Load Statistics: More efficient network process messaging + Fix bug in user interaction reporting
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesssoupNetworkProcessSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -124,7 +124,7 @@
</span><span class="cx">         supplement&lt;WebCookieManager&gt;()-&gt;setCookiePersistentStorage(parameters.cookiePersistentStoragePath,
</span><span class="cx">             parameters.cookiePersistentStorageType);
</span><span class="cx">     }
</span><del>-    supplement&lt;WebCookieManager&gt;()-&gt;setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy);
</del><ins>+    supplement&lt;WebCookieManager&gt;()-&gt;setHTTPCookieAcceptPolicy(parameters.cookieAcceptPolicy, 0);
</ins><span class="cx"> 
</span><span class="cx">     if (!parameters.languages.isEmpty())
</span><span class="cx">         userPreferredLanguagesChanged(parameters.languages);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedAPIAPIObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/API/APIObject.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/API/APIObject.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/Shared/API/APIObject.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx">         FullScreenManager,
</span><span class="cx">         GeolocationManager,
</span><span class="cx">         GeolocationPermissionRequest,
</span><ins>+        HTTPCookieStorage,
</ins><span class="cx">         HitTestResult,
</span><span class="cx">         GeolocationPosition,
</span><span class="cx">         GrammarDetail,
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCocoaAPIObjectmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/Shared/Cocoa/APIObject.mm        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #import &quot;WKContentExtensionInternal.h&quot;
</span><span class="cx"> #import &quot;WKContentExtensionStoreInternal.h&quot;
</span><span class="cx"> #import &quot;WKFrameInfoInternal.h&quot;
</span><ins>+#import &quot;WKHTTPCookieStorageInternal.h&quot;
</ins><span class="cx"> #import &quot;WKNSArray.h&quot;
</span><span class="cx"> #import &quot;WKNSData.h&quot;
</span><span class="cx"> #import &quot;WKNSDictionary.h&quot;
</span><span class="lines">@@ -178,6 +179,10 @@
</span><span class="cx">         wrapper = [WKFrameInfo alloc];
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+    case Type::HTTPCookieStorage:
+        wrapper = [WKHTTPCookieStorage alloc];
+        break;
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     case Type::HitTestResult:
</span><span class="cx">         wrapper = [_WKHitTestResult alloc];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIHTTPCookieStoragecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.cpp (0 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.cpp                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -0,0 +1,138 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;APIHTTPCookieStorage.h&quot;
+
+#include &quot;APIWebsiteDataStore.h&quot;
+#include &quot;WebCookieManagerProxy.h&quot;
+#include &quot;WebProcessPool.h&quot;
+#include &lt;WebCore/Cookie.h&gt;
+
+using namespace WebKit;
+
+namespace API {
+
+HTTPCookieStorage::HTTPCookieStorage(WebsiteDataStore&amp; websiteDataStore)
+    : m_owningDataStore(websiteDataStore)
+{
+}
+
+HTTPCookieStorage::~HTTPCookieStorage()
+{
+}
+
+void HTTPCookieStorage::cookies(Function&lt;void (const Vector&lt;WebCore::Cookie&gt;&amp;)&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;getAllCookies(dataStore.sessionID(), [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](const Vector&lt;WebCore::Cookie&gt;&amp; cookies, CallbackBase::Error error) {
+        completionHandler(cookies);
+    });
+}
+
+void HTTPCookieStorage::cookies(const WebCore::URL&amp; url, Function&lt;void (const Vector&lt;WebCore::Cookie&gt;&amp;)&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;getCookies(dataStore.sessionID(), url, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](const Vector&lt;WebCore::Cookie&gt;&amp; cookies, CallbackBase::Error error) {
+        completionHandler(cookies);
+    });
+}
+
+void HTTPCookieStorage::setCookie(const WebCore::Cookie&amp; cookie, Function&lt;void ()&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;setCookie(dataStore.sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) {
+        completionHandler();
+    });
+}
+
+void HTTPCookieStorage::setCookies(const Vector&lt;WebCore::Cookie&gt;&amp; cookies, const WebCore::URL&amp; url, const WebCore::URL&amp; mainDocumentURL, Function&lt;void ()&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;setCookies(dataStore.sessionID(), cookies, url, mainDocumentURL, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) {
+        completionHandler();
+    });
+}
+
+void HTTPCookieStorage::deleteCookie(const WebCore::Cookie&amp; cookie, Function&lt;void ()&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;deleteCookie(dataStore.sessionID(), cookie, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) {
+        completionHandler();
+    });
+}
+
+void HTTPCookieStorage::removeCookiesSinceDate(std::chrono::system_clock::time_point date, Function&lt;void ()&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;deleteAllCookiesModifiedSince(dataStore.sessionID(), date, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) {
+        completionHandler();
+    });
+}
+
+void HTTPCookieStorage::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy, Function&lt;void ()&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;setHTTPCookieAcceptPolicy(dataStore.sessionID(), policy, [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](CallbackBase::Error error) {
+        completionHandler();
+    });
+}
+
+void HTTPCookieStorage::getHTTPCookieAcceptPolicy(Function&lt;void (HTTPCookieAcceptPolicy)&gt;&amp;&amp; completionHandler)
+{
+    auto&amp; dataStore = m_owningDataStore.websiteDataStore();
+    auto pool = dataStore.processPoolForCookieStorageOperations();
+    auto* cookieManager = pool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;();
+
+    cookieManager-&gt;getHTTPCookieAcceptPolicy(dataStore.sessionID(), [pool = WTFMove(pool), completionHandler = WTFMove(completionHandler)](HTTPCookieAcceptPolicy policy, CallbackBase::Error error) {
+        if (error != CallbackBase::Error::None)
+            policy = HTTPCookieAcceptPolicyNever;
+
+        completionHandler(policy);
+    });
+}
+
+} // namespace API
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIHTTPCookieStorageh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.h (0 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/APIHTTPCookieStorage.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;APIObject.h&quot;
+#include &quot;HTTPCookieAcceptPolicy.h&quot;
+#include &lt;wtf/Function.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+class URL;
+struct Cookie;
+}
+
+namespace API {
+
+class WebsiteDataStore;
+
+class HTTPCookieStorage final : public ObjectImpl&lt;Object::Type::HTTPCookieStorage&gt; {
+public:
+    static Ref&lt;HTTPCookieStorage&gt; create(WebsiteDataStore&amp; websiteDataStore)
+    {
+        return adoptRef(*new HTTPCookieStorage(websiteDataStore));
+    }
+
+    virtual ~HTTPCookieStorage();
+
+    void cookies(Function&lt;void (const Vector&lt;WebCore::Cookie&gt;&amp;)&gt;&amp;&amp; completionHandler);
+    void cookies(const WebCore::URL&amp;, Function&lt;void (const Vector&lt;WebCore::Cookie&gt;&amp;)&gt;&amp;&amp; completionHandler);
+
+    void setCookie(const WebCore::Cookie&amp;, Function&lt;void ()&gt;&amp;&amp; completionHandler);
+    void setCookies(const Vector&lt;WebCore::Cookie&gt;&amp;, const WebCore::URL&amp;, const WebCore::URL&amp; mainDocumentURL, Function&lt;void ()&gt;&amp;&amp; completionHandler);
+    void deleteCookie(const WebCore::Cookie&amp;, Function&lt;void ()&gt;&amp;&amp; completionHandler);
+
+    void removeCookiesSinceDate(std::chrono::system_clock::time_point, Function&lt;void ()&gt;&amp;&amp; completionHandler);
+
+    void setHTTPCookieAcceptPolicy(WebKit::HTTPCookieAcceptPolicy, Function&lt;void ()&gt;&amp;&amp; completionHandler);
+    void getHTTPCookieAcceptPolicy(Function&lt;void (WebKit::HTTPCookieAcceptPolicy)&gt;&amp;&amp; completionHandler);
+    
+private:
+    HTTPCookieStorage(WebsiteDataStore&amp;);
+
+    WebsiteDataStore&amp; m_owningDataStore;
+};
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -31,13 +31,13 @@
</span><span class="cx"> 
</span><span class="cx"> namespace API {
</span><span class="cx"> 
</span><del>-RefPtr&lt;WebsiteDataStore&gt; WebsiteDataStore::defaultDataStore()
</del><ins>+Ref&lt;WebsiteDataStore&gt; WebsiteDataStore::defaultDataStore()
</ins><span class="cx"> {
</span><span class="cx">     WebKit::InitializeWebKit2();
</span><span class="cx"> 
</span><span class="cx">     static WebsiteDataStore* defaultDataStore = adoptRef(new WebsiteDataStore(defaultDataStoreConfiguration())).leakRef();
</span><span class="cx"> 
</span><del>-    return defaultDataStore;
</del><ins>+    return *defaultDataStore;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Ref&lt;WebsiteDataStore&gt; WebsiteDataStore::createNonPersistentDataStore()
</span><span class="lines">@@ -64,6 +64,14 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+HTTPCookieStorage&amp; WebsiteDataStore::httpCookieStorage()
+{
+    if (!m_apiHTTPCookieStorage)
+        m_apiHTTPCookieStorage = HTTPCookieStorage::create(*this);
+
+    return *m_apiHTTPCookieStorage;
+}
+
</ins><span class="cx"> bool WebsiteDataStore::isPersistent()
</span><span class="cx"> {
</span><span class="cx">     return m_websiteDataStore-&gt;isPersistent();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/APIWebsiteDataStore.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> #ifndef APIWebsiteDataStore_h
</span><span class="cx"> #define APIWebsiteDataStore_h
</span><span class="cx"> 
</span><del>-#include &quot;APIObject.h&quot;
</del><ins>+#include &quot;APIHTTPCookieStorage.h&quot;
</ins><span class="cx"> #include &quot;WebsiteDataStore.h&quot;
</span><span class="cx"> #include &lt;WebCore/SessionID.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> class WebsiteDataStore final : public ObjectImpl&lt;Object::Type::WebsiteDataStore&gt; {
</span><span class="cx"> public:
</span><del>-    static RefPtr&lt;WebsiteDataStore&gt; defaultDataStore();
</del><ins>+    static Ref&lt;WebsiteDataStore&gt; defaultDataStore();
</ins><span class="cx">     static Ref&lt;WebsiteDataStore&gt; createNonPersistentDataStore();
</span><span class="cx">     static Ref&lt;WebsiteDataStore&gt; create(WebKit::WebsiteDataStore::Configuration);
</span><span class="cx"> 
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx">     void registerSharedResourceLoadObserver();
</span><span class="cx"> 
</span><span class="cx">     WebKit::WebsiteDataStore&amp; websiteDataStore() { return *m_websiteDataStore; }
</span><ins>+    HTTPCookieStorage&amp; httpCookieStorage();
</ins><span class="cx"> 
</span><span class="cx">     static String defaultApplicationCacheDirectory();
</span><span class="cx">     static String defaultNetworkCacheDirectory();
</span><span class="lines">@@ -74,6 +75,7 @@
</span><span class="cx">     static String websiteDataDirectoryFileSystemRepresentation(const String&amp; directoryName);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebKit::WebsiteDataStore&gt; m_websiteDataStore;
</span><ins>+    RefPtr&lt;HTTPCookieStorage&gt; m_apiHTTPCookieStorage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKCookieManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKCookieManager.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -61,17 +61,17 @@
</span><span class="cx">     using namespace std::chrono;
</span><span class="cx"> 
</span><span class="cx">     auto time = system_clock::time_point(duration_cast&lt;system_clock::duration&gt;(duration&lt;double&gt;(date)));
</span><del>-    toImpl(cookieManagerRef)-&gt;deleteAllCookiesModifiedSince(WebCore::SessionID::defaultSessionID(), time);
</del><ins>+    toImpl(cookieManagerRef)-&gt;deleteAllCookiesModifiedSince(WebCore::SessionID::defaultSessionID(), time, [](CallbackBase::Error){});
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WKCookieManagerSetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, WKHTTPCookieAcceptPolicy policy)
</span><span class="cx"> {
</span><del>-    toImpl(cookieManager)-&gt;setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy));
</del><ins>+    toImpl(cookieManager)-&gt;setHTTPCookieAcceptPolicy(WebCore::SessionID::defaultSessionID(), toHTTPCookieAcceptPolicy(policy), [](CallbackBase::Error){});
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WKCookieManagerGetHTTPCookieAcceptPolicy(WKCookieManagerRef cookieManager, void* context, WKCookieManagerGetHTTPCookieAcceptPolicyFunction callback)
</span><span class="cx"> {
</span><del>-    toImpl(cookieManager)-&gt;getHTTPCookieAcceptPolicy(toGenericCallbackFunction&lt;WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy&gt;(context, callback));
</del><ins>+    toImpl(cookieManager)-&gt;getHTTPCookieAcceptPolicy(WebCore::SessionID::defaultSessionID(), toGenericCallbackFunction&lt;WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy&gt;(context, callback));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WKCookieManagerSetCookieStoragePartitioningEnabled(WKCookieManagerRef cookieManager, bool enabled)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICWKWebsiteDataStoreRefcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKWebsiteDataStoreRef.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> WKWebsiteDataStoreRef WKWebsiteDataStoreGetDefaultDataStore()
</span><span class="cx"> {
</span><del>-    return WebKit::toAPI(API::WebsiteDataStore::defaultDataStore().get());
</del><ins>+    return WebKit::toAPI(API::WebsiteDataStore::defaultDataStore().ptr());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WKWebsiteDataStoreRef WKWebsiteDataStoreCreateNonPersistentDataStore()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKHTTPCookieStorageh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.h (0 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -0,0 +1,92 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &lt;WebKit/WKFoundation.h&gt;
+
+#if WK_API_ENABLED
+
+#import &lt;Foundation/Foundation.h&gt;
+
+NS_ASSUME_NONNULL_BEGIN
+
+/*!
+ A WKHTTPCookieStorage object allows managing the HTTP cookies associated with a particular WKWebsiteDataStore.
+ */
+WK_CLASS_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface WKHTTPCookieStorage : NSObject
+
+- (instancetype)init NS_UNAVAILABLE;
+
+/*! @abstract Fetches all stored cookies.
+ @param completionHandler A block to invoke with the fetched cookies.
+ */
+- (void)fetchCookies:(void (^)(NSArray&lt;NSHTTPCookie *&gt; *))completionHandler;
+
+/*! @abstract Fetches all of the stored cookies for the given URL.
+ @param completionHandler A block to invoke with the fetched cookies.
+ */
+- (void)fetchCookiesForURL:(NSURL *)url completionHandler:(void (^)(NSArray&lt;NSHTTPCookie *&gt; *))completionHandler;
+
+/*! @abstract Set a cookie.
+ @param cookie The cookie to set.
+ @param completionHandler A block to invoke once the cookie has been stored.
+ */
+- (void)setCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)())completionHandler;
+
+/*! @abstract Adds an array cookies to the cookie store, following the cookie accept policy.
+ @param cookies The cookies to set.
+ @param URL The URL from which the cookies were sent.
+ @param mainDocumentURL The main document URL to be used as a base for the &quot;same domain as main document&quot; policy.
+ @param completionHandler A block to invoke once the cookies have been stored.
+ */
+- (void)setCookies:(NSArray&lt;NSHTTPCookie *&gt; *)cookies forURL:(NSURL *)url mainDocumentURL:(nullable NSURL *)mainDocumentURL completionHandler:(nullable void (^)())completionHandler;
+
+/*! @abstract Delete the specified cookie.
+ @param completionHandler A block to invoke once the cookie has been deleted.
+ */
+- (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(nullable void (^)())completionHandler;
+
+/*! @abstract Delete all cookies from the cookie storage since the provided date.
+ @param date The date after which set cookies should be removed.
+ @param completionHandler A block to invoke once the cookies have been deleted.
+ */
+- (void)removeCookiesSinceDate:(NSDate *)date completionHandler:(nullable void (^)())completionHandler;
+
+/*! @abstract Sets the cookie accept policy preference of the receiver.
+ @param policy The cookie accept policy to set.
+ @param completionHandler A block to invoke once the policy has been set.
+ */
+- (void)setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy completionHandler:(nullable void (^)())completionHandler;
+
+/*! @abstract Fetches the cookie accept policy preference of the receiver.
+ @param completionHandler A block to invoke with the fetched policy.
+ */
+- (void)fetchCookieAcceptPolicy:(void (^)(NSHTTPCookieAcceptPolicy))completionHandler;
+
+@end
+
+NS_ASSUME_NONNULL_END
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKHTTPCookieStoragemm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.mm (0 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.mm                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorage.mm        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -0,0 +1,161 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;WKHTTPCookieStorageInternal.h&quot;
+
+#if WK_API_ENABLED
+
+#include &quot;HTTPCookieAcceptPolicy.h&quot;
+#include &lt;WebCore/CFNetworkSPI.h&gt;
+#include &lt;WebCore/Cookie.h&gt;
+#include &lt;WebCore/URL.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+static NSArray&lt;NSHTTPCookie *&gt; *coreCookiesToNSCookies(const Vector&lt;WebCore::Cookie&gt;&amp; coreCookies)
+{
+    NSMutableArray&lt;NSHTTPCookie *&gt; *nsCookies = [NSMutableArray arrayWithCapacity:coreCookies.size()];
+
+    for (auto&amp; cookie : coreCookies)
+        [nsCookies addObject:(NSHTTPCookie *)cookie];
+
+    return nsCookies;
+}
+
+@implementation WKHTTPCookieStorage
+
+- (void)dealloc
+{
+    _cookieStorage-&gt;API::HTTPCookieStorage::~HTTPCookieStorage();
+
+    [super dealloc];
+}
+
+- (void)fetchCookies:(void (^)(NSArray&lt;NSHTTPCookie *&gt; *))completionHandler
+{
+    _cookieStorage-&gt;cookies([handler = adoptNS([completionHandler copy])](const Vector&lt;WebCore::Cookie&gt;&amp; cookies) {
+        auto rawHandler = (void (^)(NSArray&lt;NSHTTPCookie *&gt; *))handler.get();
+        rawHandler(coreCookiesToNSCookies(cookies));
+    });
+}
+
+- (void)fetchCookiesForURL:(NSURL *)url completionHandler:(void (^)(NSArray&lt;NSHTTPCookie *&gt; *))completionHandler
+{
+    _cookieStorage-&gt;cookies(url, [handler = adoptNS([completionHandler copy])](const Vector&lt;WebCore::Cookie&gt;&amp; cookies) {
+        auto rawHandler = (void (^)(NSArray&lt;NSHTTPCookie *&gt; *))handler.get();
+        rawHandler(coreCookiesToNSCookies(cookies));
+    });
+}
+
+- (void)setCookie:(NSHTTPCookie *)cookie completionHandler:(void (^)())completionHandler
+{
+    _cookieStorage-&gt;setCookie(cookie, [handler = adoptNS([completionHandler copy])]() {
+        auto rawHandler = (void (^)())handler.get();
+        if (rawHandler)
+            rawHandler();
+    });
+
+}
+
+- (void)deleteCookie:(NSHTTPCookie *)cookie completionHandler:(void (^)())completionHandler
+{
+    _cookieStorage-&gt;deleteCookie(cookie, [handler = adoptNS([completionHandler copy])]() {
+        auto rawHandler = (void (^)())handler.get();
+        if (rawHandler)
+            rawHandler();
+    });
+}
+
+- (void)setCookies:(NSArray&lt;NSHTTPCookie *&gt; *)cookies forURL:(NSURL *)URL mainDocumentURL:(NSURL *)mainDocumentURL completionHandler:(void (^)())completionHandler
+{
+    Vector&lt;WebCore::Cookie&gt; coreCookies;
+    coreCookies.reserveInitialCapacity(cookies.count);
+    for (NSHTTPCookie *cookie : cookies)
+        coreCookies.uncheckedAppend(cookie);
+
+    _cookieStorage-&gt;setCookies(coreCookies, URL, mainDocumentURL, [handler = adoptNS([completionHandler copy])]() {
+        auto rawHandler = (void (^)())handler.get();
+        if (rawHandler)
+            rawHandler();
+    });
+}
+
+- (void)removeCookiesSinceDate:(NSDate *)date completionHandler:(void (^)())completionHandler
+{
+    auto systemClockTime = std::chrono::system_clock::time_point(std::chrono::duration_cast&lt;std::chrono::system_clock::duration&gt;(std::chrono::duration&lt;double&gt;(date.timeIntervalSince1970)));
+
+    _cookieStorage-&gt;removeCookiesSinceDate(systemClockTime, [handler = adoptNS([completionHandler copy])]() {
+        auto rawHandler = (void (^)())handler.get();
+        if (rawHandler)
+            rawHandler();
+    });
+}
+
+- (void)setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy completionHandler:(void (^)())completionHandler
+{
+    _cookieStorage-&gt;setHTTPCookieAcceptPolicy(policy, [handler = adoptNS([completionHandler copy])]() {
+        auto rawHandler = (void (^)())handler.get();
+        if (rawHandler)
+            rawHandler();
+    });
+}
+
+static NSHTTPCookieAcceptPolicy kitCookiePolicyToNSCookiePolicy(WebKit::HTTPCookieAcceptPolicy kitPolicy)
+{
+    switch (kitPolicy) {
+    case WebKit::HTTPCookieAcceptPolicyAlways:
+        return NSHTTPCookieAcceptPolicyAlways;
+    case WebKit::HTTPCookieAcceptPolicyNever:
+        return NSHTTPCookieAcceptPolicyNever;
+    case WebKit::HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+        return NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+    case WebKit::HTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
+        // Cast required because of CFNetworkSPI.
+        return static_cast&lt;NSHTTPCookieAcceptPolicy&gt;(NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain);
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    return NSHTTPCookieAcceptPolicyNever;
+}
+
+- (void)fetchCookieAcceptPolicy:(void (^)(NSHTTPCookieAcceptPolicy))completionHandler
+{
+    _cookieStorage-&gt;getHTTPCookieAcceptPolicy([handler = adoptNS([completionHandler copy])](WebKit::HTTPCookieAcceptPolicy policy) {
+        auto rawHandler = (void (^)(NSHTTPCookieAcceptPolicy))handler.get();
+        rawHandler(kitCookiePolicyToNSCookiePolicy(policy));
+    });
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&amp;)_apiObject
+{
+    return *_cookieStorage;
+}
+
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKHTTPCookieStorageInternalhfromrev213876trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStorePrivateh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h (from rev 213876, trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h) (0 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h                                (rev 0)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKHTTPCookieStorageInternal.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;WKHTTPCookieStorage.h&quot;
+
+#if WK_API_ENABLED
+
+#import &quot;APIHTTPCookieStorage.h&quot;
+#import &quot;WKObject.h&quot;
+
+namespace WebKit {
+
+inline WKHTTPCookieStorage *wrapper(API::HTTPCookieStorage&amp; cookieStorage)
+{
+    ASSERT([cookieStorage.wrapper() isKindOfClass:[WKHTTPCookieStorage class]]);
+    return (WKHTTPCookieStorage *)cookieStorage.wrapper();
+}
+
+}
+
+@interface WKHTTPCookieStorage () &lt;WKObject&gt; {
+@package
+    API::ObjectStorage&lt;API::HTTPCookieStorage&gt; _cookieStorage;
+}
+@end
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKProcessPoolmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -196,7 +196,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
</span><span class="cx"> {
</span><del>-    _processPool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;()-&gt;setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy));
</del><ins>+    _processPool-&gt;supplement&lt;WebKit::WebCookieManagerProxy&gt;()-&gt;setHTTPCookieAcceptPolicy(WebCore::SessionID::defaultSessionID(), toHTTPCookieAcceptPolicy(policy), [](WebKit::CallbackBase::Error){});
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id)_objectForBundleParameter:(NSString *)parameter
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStore.mm        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> 
</span><ins>+#import &quot;WKHTTPCookieStorageInternal.h&quot;
</ins><span class="cx"> #import &quot;WKNSArray.h&quot;
</span><span class="cx"> #import &quot;WKWebsiteDataRecordInternal.h&quot;
</span><span class="cx"> #import &quot;WebsiteDataFetchOption.h&quot;
</span><span class="lines">@@ -38,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx"> + (WKWebsiteDataStore *)defaultDataStore
</span><span class="cx"> {
</span><del>-    return WebKit::wrapper(*API::WebsiteDataStore::defaultDataStore().get());
</del><ins>+    return WebKit::wrapper(API::WebsiteDataStore::defaultDataStore().get());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (WKWebsiteDataStore *)nonPersistentDataStore
</span><span class="lines">@@ -194,6 +195,11 @@
</span><span class="cx">     _websiteDataStore-&gt;websiteDataStore().setResourceLoadStatisticsEnabled(enabled);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (WKHTTPCookieStorage *)_httpCookieStorage
+{
+    return WebKit::wrapper(_websiteDataStore-&gt;httpCookieStorage());
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebsiteDataStorePrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> 
</span><span class="cx"> NS_ASSUME_NONNULL_BEGIN
</span><span class="cx"> 
</span><ins>+@class WKHTTPCookieStorage;
</ins><span class="cx"> @class _WKWebsiteDataStoreConfiguration;
</span><span class="cx"> 
</span><span class="cx"> typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
</span><span class="lines">@@ -43,6 +44,9 @@
</span><span class="cx"> 
</span><span class="cx"> @property (nonatomic, setter=_setResourceLoadStatisticsEnabled:) BOOL _resourceLoadStatisticsEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
</span><span class="cx"> 
</span><ins>+/*! @abstract Returns the cookie storage representing HTTP cookies in this website data store. */
+@property (nonatomic, readonly) WKHTTPCookieStorage *_httpCookieStorage WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> NS_ASSUME_NONNULL_END
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitCookieManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitCookieManager.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #include &quot;WebKitWebsiteDataManagerPrivate.h&quot;
</span><span class="cx"> #include &quot;WebKitWebsiteDataPrivate.h&quot;
</span><span class="cx"> #include &quot;WebsiteDataRecord.h&quot;
</span><ins>+#include &lt;WebCore/SessionID.h&gt;
</ins><span class="cx"> #include &lt;wtf/glib/GRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -178,7 +179,7 @@
</span><span class="cx">     g_return_if_fail(WEBKIT_IS_COOKIE_MANAGER(manager));
</span><span class="cx"> 
</span><span class="cx">     for (auto* processPool : webkitWebsiteDataManagerGetProcessPools(manager-&gt;priv-&gt;dataManager))
</span><del>-        processPool-&gt;supplement&lt;WebCookieManagerProxy&gt;()-&gt;setHTTPCookieAcceptPolicy(toHTTPCookieAcceptPolicy(policy));
</del><ins>+        processPool-&gt;supplement&lt;WebCookieManagerProxy&gt;()-&gt;setHTTPCookieAcceptPolicy(WebCore::SessionID::defaultSessionID(), toHTTPCookieAcceptPolicy(policy), [](CallbackBase::Error){});
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void webkitCookieManagerGetAcceptPolicyCallback(WKHTTPCookieAcceptPolicy policy, WKErrorRef, void* context)
</span><span class="lines">@@ -212,7 +213,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    processPools[0]-&gt;supplement&lt;WebCookieManagerProxy&gt;()-&gt;getHTTPCookieAcceptPolicy(
</del><ins>+    processPools[0]-&gt;supplement&lt;WebCookieManagerProxy&gt;()-&gt;getHTTPCookieAcceptPolicy(WebCore::SessionID::defaultSessionID(), 
</ins><span class="cx">         toGenericCallbackFunction&lt;WKHTTPCookieAcceptPolicy, HTTPCookieAcceptPolicy&gt;(task.leakRef(), webkitCookieManagerGetAcceptPolicyCallback));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationWebAutomationSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -734,7 +734,7 @@
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Using activeURL here twice is basically saying &quot;this is always in the context of the main document&quot;
</span><span class="cx">     // which probably isn't accurate.
</span><del>-    cookieManager-&gt;setCookies(WebCore::SessionID::defaultSessionID(), { cookie }, activeURL, activeURL);
</del><ins>+    cookieManager-&gt;setCookies(WebCore::SessionID::defaultSessionID(), { cookie }, activeURL, activeURL, [](CallbackBase::Error){});
</ins><span class="cx"> 
</span><span class="cx">     callback-&gt;sendSuccess();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebCookieManagerProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -32,8 +32,11 @@
</span><span class="cx"> #include &quot;WebCookieManagerMessages.h&quot;
</span><span class="cx"> #include &quot;WebCookieManagerProxyMessages.h&quot;
</span><span class="cx"> #include &quot;WebProcessPool.h&quot;
</span><ins>+#include &lt;WebCore/Cookie.h&gt;
</ins><span class="cx"> #include &lt;WebCore/SecurityOriginData.h&gt;
</span><span class="cx"> 
</span><ins>+using namespace WebCore;
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> const char* WebCookieManagerProxy::supplementName()
</span><span class="lines">@@ -94,7 +97,7 @@
</span><span class="cx">     API::Object::deref();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::getHostnamesWithCookies(WebCore::SessionID sessionID, Function&lt;void (API::Array*, CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</del><ins>+void WebCookieManagerProxy::getHostnamesWithCookies(SessionID sessionID, Function&lt;void (API::Array*, CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</ins><span class="cx"> {
</span><span class="cx">     auto callback = ArrayCallback::create(WTFMove(callbackFunction));
</span><span class="cx">     uint64_t callbackID = callback-&gt;callbackID();
</span><span class="lines">@@ -114,37 +117,96 @@
</span><span class="cx">     callback-&gt;performCallbackWithReturnValue(API::Array::createStringArray(hostnames).ptr());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::deleteCookiesForHostname(WebCore::SessionID sessionID, const String&amp; hostname)
</del><ins>+void WebCookieManagerProxy::deleteCookiesForHostname(SessionID sessionID, const String&amp; hostname)
</ins><span class="cx"> {
</span><span class="cx">     processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteCookiesForHostname(sessionID, hostname));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::deleteAllCookies(WebCore::SessionID sessionID)
</del><ins>+void WebCookieManagerProxy::deleteAllCookies(SessionID sessionID)
</ins><span class="cx"> {
</span><span class="cx">     processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookies(sessionID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::deleteAllCookiesModifiedSince(WebCore::SessionID sessionID, std::chrono::system_clock::time_point time)
</del><ins>+void WebCookieManagerProxy::deleteCookie(SessionID sessionID, const Cookie&amp; cookie, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</ins><span class="cx"> {
</span><del>-    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookiesModifiedSince(sessionID, time));
</del><ins>+    auto callback = VoidCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_voidCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteCookie(sessionID, cookie, callbackID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::setCookies(WebCore::SessionID sessionID, const Vector&lt;WebCore::Cookie&gt;&amp; cookies, const WebCore::URL&amp; url, const WebCore::URL&amp; mainDocumentURL)
</del><ins>+void WebCookieManagerProxy::deleteAllCookiesModifiedSince(SessionID sessionID, std::chrono::system_clock::time_point time, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</ins><span class="cx"> {
</span><del>-    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::SetCookies(sessionID, cookies, url, mainDocumentURL));
</del><ins>+    auto callback = VoidCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_voidCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::DeleteAllCookiesModifiedSince(sessionID, time, callbackID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::startObservingCookieChanges(WebCore::SessionID sessionID)
</del><ins>+void WebCookieManagerProxy::setCookie(SessionID sessionID, const Cookie&amp; cookie, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</ins><span class="cx"> {
</span><ins>+    auto callback = VoidCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_voidCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::SetCookie(sessionID, cookie, callbackID));
+}
+
+void WebCookieManagerProxy::setCookies(SessionID sessionID, const Vector&lt;Cookie&gt;&amp; cookies, const URL&amp; url, const URL&amp; mainDocumentURL, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
+{
+    auto callback = VoidCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_voidCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::SetCookies(sessionID, cookies, url, mainDocumentURL, callbackID));
+}
+
+void WebCookieManagerProxy::getAllCookies(SessionID sessionID, Function&lt;void (const Vector&lt;Cookie&gt;&amp;, CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
+{
+    auto callback = GetCookiesCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_getCookiesCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::GetAllCookies(sessionID, callbackID));
+}
+
+void WebCookieManagerProxy::getCookies(SessionID sessionID, const URL&amp; url, Function&lt;void (const Vector&lt;Cookie&gt;&amp;, CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
+{
+    auto callback = GetCookiesCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_getCookiesCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::GetCookies(sessionID, url, callbackID));
+}
+
+void WebCookieManagerProxy::didSetCookies(uint64_t callbackID)
+{
+    m_voidCallbacks.take(callbackID)-&gt;performCallback();
+}
+
+void WebCookieManagerProxy::didGetCookies(const Vector&lt;Cookie&gt;&amp; cookies, uint64_t callbackID)
+{
+    m_getCookiesCallbacks.take(callbackID)-&gt;performCallbackWithReturnValue(cookies);
+}
+
+void WebCookieManagerProxy::didDeleteCookies(uint64_t callbackID)
+{
+    m_voidCallbacks.take(callbackID)-&gt;performCallback();
+}
+
+void WebCookieManagerProxy::startObservingCookieChanges(SessionID sessionID)
+{
</ins><span class="cx">     processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::StartObservingCookieChanges(sessionID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::stopObservingCookieChanges(WebCore::SessionID sessionID)
</del><ins>+void WebCookieManagerProxy::stopObservingCookieChanges(SessionID sessionID)
</ins><span class="cx"> {
</span><span class="cx">     processPool()-&gt;sendToNetworkingProcessRelaunchingIfNecessary(Messages::WebCookieManager::StopObservingCookieChanges(sessionID));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::setCookieObserverCallback(WebCore::SessionID sessionID, std::function&lt;void ()&gt;&amp;&amp; callback)
</del><ins>+void WebCookieManagerProxy::setCookieObserverCallback(SessionID sessionID, std::function&lt;void ()&gt;&amp;&amp; callback)
</ins><span class="cx"> {
</span><span class="cx">     if (callback)
</span><span class="cx">         m_cookieObservers.set(sessionID, WTFMove(callback));
</span><span class="lines">@@ -152,7 +214,7 @@
</span><span class="cx">         m_cookieObservers.remove(sessionID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::cookiesDidChange(WebCore::SessionID sessionID)
</del><ins>+void WebCookieManagerProxy::cookiesDidChange(SessionID sessionID)
</ins><span class="cx"> {
</span><span class="cx">     m_client.cookiesDidChange(this);
</span><span class="cx">     if (auto callback = m_cookieObservers.get(sessionID))
</span><span class="lines">@@ -159,7 +221,7 @@
</span><span class="cx">         callback();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
</del><ins>+void WebCookieManagerProxy::setHTTPCookieAcceptPolicy(SessionID, HTTPCookieAcceptPolicy policy, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     if (!processPool()-&gt;isUsingTestingNetworkSession())
</span><span class="lines">@@ -172,11 +234,16 @@
</span><span class="cx">     // The policy is not sent to newly created processes (only Soup does that via setInitialHTTPCookieAcceptPolicy()). This is not a serious problem, because:
</span><span class="cx">     // - When testing, we only have one WebProcess and one NetworkProcess, and WebKitTestRunner never restarts them;
</span><span class="cx">     // - When not testing, Cocoa has the policy persisted, and thus new processes use it (even for ephemeral sessions).
</span><del>-    processPool()-&gt;sendToAllProcesses(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy));
-    processPool()-&gt;sendToNetworkingProcess(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy));
</del><ins>+    processPool()-&gt;sendToAllProcesses(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, 0));
+
+    auto callback = VoidCallback::create(WTFMove(callbackFunction));
+    uint64_t callbackID = callback-&gt;callbackID();
+    m_voidCallbacks.set(callbackID, WTFMove(callback));
+
+    processPool()-&gt;sendToNetworkingProcess(Messages::WebCookieManager::SetHTTPCookieAcceptPolicy(policy, callbackID));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManagerProxy::getHTTPCookieAcceptPolicy(Function&lt;void (HTTPCookieAcceptPolicy, CallbackBase::Error)&gt; callbackFunction)
</del><ins>+void WebCookieManagerProxy::getHTTPCookieAcceptPolicy(SessionID, Function&lt;void (HTTPCookieAcceptPolicy, CallbackBase::Error)&gt;&amp;&amp; callbackFunction)
</ins><span class="cx"> {
</span><span class="cx">     auto callback = HTTPCookieAcceptPolicyCallback::create(WTFMove(callbackFunction));
</span><span class="cx"> 
</span><span class="lines">@@ -188,13 +255,12 @@
</span><span class="cx"> 
</span><span class="cx"> void WebCookieManagerProxy::didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID)
</span><span class="cx"> {
</span><del>-    RefPtr&lt;HTTPCookieAcceptPolicyCallback&gt; callback = m_httpCookieAcceptPolicyCallbacks.take(callbackID);
-    if (!callback) {
-        // FIXME: Log error or assert.
-        return;
-    }
</del><ins>+    m_httpCookieAcceptPolicyCallbacks.take(callbackID)-&gt;performCallbackWithReturnValue(policy);
+}
</ins><span class="cx"> 
</span><del>-    callback-&gt;performCallbackWithReturnValue(policy);
</del><ins>+void WebCookieManagerProxy::didSetHTTPCookieAcceptPolicy(uint64_t callbackID)
+{
+    m_voidCallbacks.take(callbackID)-&gt;performCallback();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebCookieManagerProxy::setCookieStoragePartitioningEnabled(bool enabled)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebCookieManagerProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> 
</span><span class="cx"> typedef GenericCallback&lt;API::Array*&gt; ArrayCallback;
</span><span class="cx"> typedef GenericCallback&lt;HTTPCookieAcceptPolicy&gt; HTTPCookieAcceptPolicyCallback;
</span><ins>+typedef GenericCallback&lt;const Vector&lt;WebCore::Cookie&gt;&amp;&gt; GetCookiesCallback;
</ins><span class="cx"> 
</span><span class="cx"> class WebCookieManagerProxy : public API::ObjectImpl&lt;API::Object::Type::CookieManager&gt;, public WebContextSupplement, private IPC::MessageReceiver {
</span><span class="cx"> public:
</span><span class="lines">@@ -66,14 +67,20 @@
</span><span class="cx">     void initializeClient(const WKCookieManagerClientBase*);
</span><span class="cx">     
</span><span class="cx">     void getHostnamesWithCookies(WebCore::SessionID, Function&lt;void (API::Array*, CallbackBase::Error)&gt;&amp;&amp;);
</span><ins>+    void deleteCookie(WebCore::SessionID, const WebCore::Cookie&amp;, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp;);
</ins><span class="cx">     void deleteCookiesForHostname(WebCore::SessionID, const String&amp; hostname);
</span><span class="cx">     void deleteAllCookies(WebCore::SessionID);
</span><del>-    void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point);
</del><ins>+    void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    void setCookies(WebCore::SessionID, const Vector&lt;WebCore::Cookie&gt;&amp;, const WebCore::URL&amp;, const WebCore::URL&amp; mainDocumentURL);
</del><ins>+    void setCookie(WebCore::SessionID, const WebCore::Cookie&amp;, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp;);
+    void setCookies(WebCore::SessionID, const Vector&lt;WebCore::Cookie&gt;&amp;, const WebCore::URL&amp;, const WebCore::URL&amp; mainDocumentURL, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp;);
</ins><span class="cx"> 
</span><del>-    void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
-    void getHTTPCookieAcceptPolicy(Function&lt;void (HTTPCookieAcceptPolicy, CallbackBase::Error)&gt;);
</del><ins>+    void getAllCookies(WebCore::SessionID, Function&lt;void (const Vector&lt;WebCore::Cookie&gt;&amp;, CallbackBase::Error)&gt;&amp;&amp; completionHandler);
+    void getCookies(WebCore::SessionID, const WebCore::URL&amp;, Function&lt;void (const Vector&lt;WebCore::Cookie&gt;&amp;, CallbackBase::Error)&gt;&amp;&amp; completionHandler);
+
+    void setHTTPCookieAcceptPolicy(WebCore::SessionID, HTTPCookieAcceptPolicy, Function&lt;void (CallbackBase::Error)&gt;&amp;&amp;);
+    void getHTTPCookieAcceptPolicy(WebCore::SessionID, Function&lt;void (HTTPCookieAcceptPolicy, CallbackBase::Error)&gt;&amp;&amp;);
+
</ins><span class="cx">     void setCookieStoragePartitioningEnabled(bool);
</span><span class="cx"> 
</span><span class="cx">     void startObservingCookieChanges(WebCore::SessionID);
</span><span class="lines">@@ -95,6 +102,11 @@
</span><span class="cx">     void didGetHostnamesWithCookies(const Vector&lt;String&gt;&amp;, uint64_t callbackID);
</span><span class="cx">     void didGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
</span><span class="cx"> 
</span><ins>+    void didSetHTTPCookieAcceptPolicy(uint64_t callbackID);
+    void didSetCookies(uint64_t callbackID);
+    void didGetCookies(const Vector&lt;WebCore::Cookie&gt;&amp;, uint64_t callbackID);
+    void didDeleteCookies(uint64_t callbackID);
+
</ins><span class="cx">     void cookiesDidChange(WebCore::SessionID);
</span><span class="cx"> 
</span><span class="cx">     // WebContextSupplement
</span><span class="lines">@@ -113,6 +125,8 @@
</span><span class="cx"> 
</span><span class="cx">     HashMap&lt;uint64_t, RefPtr&lt;ArrayCallback&gt;&gt; m_arrayCallbacks;
</span><span class="cx">     HashMap&lt;uint64_t, RefPtr&lt;HTTPCookieAcceptPolicyCallback&gt;&gt; m_httpCookieAcceptPolicyCallbacks;
</span><ins>+    HashMap&lt;uint64_t, RefPtr&lt;VoidCallback&gt;&gt; m_voidCallbacks;
+    HashMap&lt;uint64_t, RefPtr&lt;GetCookiesCallback&gt;&gt; m_getCookiesCallbacks;
</ins><span class="cx"> 
</span><span class="cx">     HashMap&lt;WebCore::SessionID, std::function&lt;void ()&gt;&gt; m_cookieObservers;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebCookieManagerProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebCookieManagerProxy.messages.in        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -23,6 +23,11 @@
</span><span class="cx"> messages -&gt; WebCookieManagerProxy {
</span><span class="cx">     DidGetHostnamesWithCookies(Vector&lt;String&gt; hostnames, uint64_t callbackID);
</span><span class="cx">     DidGetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID);
</span><del>-    
</del><ins>+
+    DidSetHTTPCookieAcceptPolicy(uint64_t callbackID);
+    DidDeleteCookies(uint64_t callbackID);
+    DidSetCookies(uint64_t callbackID);
+    DidGetCookies(Vector&lt;WebCore::Cookie&gt; cookies, uint64_t callbackID);
+
</ins><span class="cx">     CookiesDidChange(WebCore::SessionID sessionID)
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebFrameProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebFrameProxy.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebFrameProxy.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebFrameProxy.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;WebFrameListenerProxy.h&quot;
</span><span class="cx"> #include &lt;WebCore/FrameLoaderTypes.h&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><ins>+#include &lt;wtf/Function.h&gt;
</ins><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;APIAutomationClient.h&quot;
</span><span class="cx"> #include &quot;APICustomProtocolManagerClient.h&quot;
</span><span class="cx"> #include &quot;APIDownloadClient.h&quot;
</span><ins>+#include &quot;APIHTTPCookieStorage.h&quot;
</ins><span class="cx"> #include &quot;APILegacyContextHistoryClient.h&quot;
</span><span class="cx"> #include &quot;APIPageConfiguration.h&quot;
</span><span class="cx"> #include &quot;APIProcessPoolConfiguration.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx"> class AutomationClient;
</span><span class="cx"> class CustomProtocolManagerClient;
</span><span class="cx"> class DownloadClient;
</span><ins>+class HTTPCookieStorage;
</ins><span class="cx"> class LegacyContextHistoryClient;
</span><span class="cx"> class PageConfiguration;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStorecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;APIWebsiteDataRecord.h&quot;
</span><span class="cx"> #include &quot;NetworkProcessMessages.h&quot;
</span><span class="cx"> #include &quot;StorageManager.h&quot;
</span><ins>+#include &quot;WebCookieManagerProxy.h&quot;
</ins><span class="cx"> #include &quot;WebProcessMessages.h&quot;
</span><span class="cx"> #include &quot;WebProcessPool.h&quot;
</span><span class="cx"> #include &quot;WebResourceLoadStatisticsStore.h&quot;
</span><span class="lines">@@ -105,6 +106,27 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+Ref&lt;WebProcessPool&gt; WebsiteDataStore::processPoolForCookieStorageOperations()
+{
+    // Our concepts of WebProcess, WebProcessPool, WebsiteDataStore, and SessionIDs have all started to overlap
+    // without clear divisions of responsibilities.
+    // In practice, multiple WebProcessPools can contain &quot;the same session&quot;, especially since there is currently
+    // only a single default global SessionID.
+    //
+    // This means that multiple NetworkProcesses can be using the same session, which means that multiple
+    // NetworkProcesses can be referring to the same platform cookie storage.
+    //
+    // While this may cause complications with future APIs it is actually fine for implementing the WKHTTPCookieStorage API
+    // because we only need one NetworkProcess to successfully make a requested platform cookie storage change.
+    //
+    // FIXME: We need to start to unravel this mess going forward.
+
+    auto pools = processPools(1);
+    ASSERT(!pools.isEmpty());
+
+    return **pools.begin();
+}
+
</ins><span class="cx"> void WebsiteDataStore::resolveDirectoriesIfNecessary()
</span><span class="cx"> {
</span><span class="cx">     if (m_hasResolvedDirectories)
</span><span class="lines">@@ -1108,7 +1130,7 @@
</span><span class="cx">         m_storageManager-&gt;processDidCloseConnection(webProcessProxy, connection);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-HashSet&lt;RefPtr&lt;WebProcessPool&gt;&gt; WebsiteDataStore::processPools() const
</del><ins>+HashSet&lt;RefPtr&lt;WebProcessPool&gt;&gt; WebsiteDataStore::processPools(size_t count) const
</ins><span class="cx"> {
</span><span class="cx">     HashSet&lt;RefPtr&lt;WebProcessPool&gt;&gt; processPools;
</span><span class="cx">     for (auto&amp; process : processes())
</span><span class="lines">@@ -1122,11 +1144,20 @@
</span><span class="cx">                     processPools.add(processPool);
</span><span class="cx">                     break;
</span><span class="cx">                 }
</span><ins>+            } else if (&amp;API::WebsiteDataStore::defaultDataStore()-&gt;websiteDataStore() == this) {
+                // If a process pool doesn't have an explicit data store and this is the default WebsiteDataStore,
+                // add that process pool to the set.
+                // FIXME: This behavior is weird and necessitated by the fact that process pools don't always
+                // have a data store; they should.
+                processPools.add(processPool);
</ins><span class="cx">             }
</span><ins>+
+            if (processPools.size() == count)
+                break;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (processPools.isEmpty()) {
</del><ins>+    if (processPools.isEmpty() &amp;&amp; count) {
</ins><span class="cx">         auto processPool = WebProcessPool::create(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration(m_configuration));
</span><span class="cx">         processPools.add(processPool.ptr());
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebsiteDataWebsiteDataStoreh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/UIProcess/WebsiteData/WebsiteDataStore.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -103,6 +103,8 @@
</span><span class="cx"> 
</span><span class="cx">     StorageManager* storageManager() { return m_storageManager.get(); }
</span><span class="cx"> 
</span><ins>+    Ref&lt;WebProcessPool&gt; processPoolForCookieStorageOperations();
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit WebsiteDataStore(WebCore::SessionID);
</span><span class="cx">     explicit WebsiteDataStore(Configuration);
</span><span class="lines">@@ -119,7 +121,7 @@
</span><span class="cx">     void platformDestroy();
</span><span class="cx">     static void platformRemoveRecentSearches(std::chrono::system_clock::time_point);
</span><span class="cx"> 
</span><del>-    HashSet&lt;RefPtr&lt;WebProcessPool&gt;&gt; processPools() const;
</del><ins>+    HashSet&lt;RefPtr&lt;WebProcessPool&gt;&gt; processPools(size_t count = std::numeric_limits&lt;size_t&gt;::max()) const;
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx">     Vector&lt;PluginModuleInfo&gt; plugins() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -1063,6 +1063,9 @@
</span><span class="cx">                 51D124351E6DF652002B2820 /* WKURLSchemeHandlerTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D1242F1E6DDDD7002B2820 /* WKURLSchemeHandlerTask.h */; settings = {ATTRIBUTES = (Public, ); }; };
</span><span class="cx">                 51D124361E6DFB39002B2820 /* WKURLSchemeHandlerTask.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D124301E6DDDD7002B2820 /* WKURLSchemeHandlerTask.mm */; };
</span><span class="cx">                 51D1243A1E6E0AAB002B2820 /* APIURLSchemeHandlerTask.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D124381E6DFDB9002B2820 /* APIURLSchemeHandlerTask.cpp */; };
</span><ins>+                51D124911E74BF3C002B2820 /* APIHTTPCookieStorage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D124821E734AC8002B2820 /* APIHTTPCookieStorage.cpp */; };
+                51D124921E74BF48002B2820 /* WKHTTPCookieStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D124851E734AE3002B2820 /* WKHTTPCookieStorage.mm */; };
+                51D124991E763C01002B2820 /* WKHTTPCookieStorage.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D124841E734AE3002B2820 /* WKHTTPCookieStorage.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 51D130531382EAC000351EDD /* SecItemRequestData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D1304F1382EAC000351EDD /* SecItemRequestData.cpp */; };
</span><span class="cx">                 51D130541382EAC000351EDD /* SecItemRequestData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51D130501382EAC000351EDD /* SecItemRequestData.h */; };
</span><span class="cx">                 51D130551382EAC000351EDD /* SecItemResponseData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51D130511382EAC000351EDD /* SecItemResponseData.cpp */; };
</span><span class="lines">@@ -3285,6 +3288,11 @@
</span><span class="cx">                 51D124371E6DFD2A002B2820 /* WKURLSchemeHandlerTaskInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLSchemeHandlerTaskInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51D124381E6DFDB9002B2820 /* APIURLSchemeHandlerTask.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIURLSchemeHandlerTask.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51D124391E6DFDB9002B2820 /* APIURLSchemeHandlerTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIURLSchemeHandlerTask.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51D124821E734AC8002B2820 /* APIHTTPCookieStorage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIHTTPCookieStorage.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51D124831E734AC8002B2820 /* APIHTTPCookieStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIHTTPCookieStorage.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51D124841E734AE3002B2820 /* WKHTTPCookieStorage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKHTTPCookieStorage.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51D124851E734AE3002B2820 /* WKHTTPCookieStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKHTTPCookieStorage.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51D124861E734AE3002B2820 /* WKHTTPCookieStorageInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKHTTPCookieStorageInternal.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51D1304F1382EAC000351EDD /* SecItemRequestData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemRequestData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51D130501382EAC000351EDD /* SecItemRequestData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecItemRequestData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51D130511382EAC000351EDD /* SecItemResponseData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecItemResponseData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -5544,6 +5552,9 @@
</span><span class="cx">                                 1A4D664918A3030E00D82E21 /* WKFrameInfo.mm */,
</span><span class="cx">                                 2DF9EEE71A78245500B6CFBE /* WKFrameInfoInternal.h */,
</span><span class="cx">                                 1A6FA21D1BD0435B00AAA650 /* WKFrameInfoPrivate.h */,
</span><ins>+                                51D124841E734AE3002B2820 /* WKHTTPCookieStorage.h */,
+                                51D124851E734AE3002B2820 /* WKHTTPCookieStorage.mm */,
+                                51D124861E734AE3002B2820 /* WKHTTPCookieStorageInternal.h */,
</ins><span class="cx">                                 1A422F8A18B29B5400D8CD96 /* WKHistoryDelegatePrivate.h */,
</span><span class="cx">                                 1AB40EE31BF677E300BA81BE /* WKMenuItemIdentifiers.mm */,
</span><span class="cx">                                 1AB40EE41BF677E300BA81BE /* WKMenuItemIdentifiersPrivate.h */,
</span><span class="lines">@@ -6732,6 +6743,8 @@
</span><span class="cx">                                 2DABA7751A82B42100EF0F1A /* APIHistoryClient.h */,
</span><span class="cx">                                 93A88B421BC8828C00ABA5C2 /* APIHitTestResult.cpp */,
</span><span class="cx">                                 93A88B431BC8828C00ABA5C2 /* APIHitTestResult.h */,
</span><ins>+                                51D124821E734AC8002B2820 /* APIHTTPCookieStorage.cpp */,
+                                51D124831E734AC8002B2820 /* APIHTTPCookieStorage.h */,
</ins><span class="cx">                                 5143B2611DDD0DA00014FAC6 /* APIIconLoadingClient.h */,
</span><span class="cx">                                 7CE4D2061A46775700C7F152 /* APILegacyContextHistoryClient.h */,
</span><span class="cx">                                 1A2464F21891E45100234C5B /* APILoaderClient.h */,
</span><span class="lines">@@ -8515,6 +8528,7 @@
</span><span class="cx">                                 514129941C6428BB0059E714 /* WebIDBConnectionToServer.h in Headers */,
</span><span class="cx">                                 510523741C73D38B007993CB /* WebIDBConnectionToServerMessages.h in Headers */,
</span><span class="cx">                                 BCCF6ABD12C91EF9008F9C35 /* WebImage.h in Headers */,
</span><ins>+                                51D124991E763C01002B2820 /* WKHTTPCookieStorage.h in Headers */,
</ins><span class="cx">                                 1C8E28201275D15400BC7BD0 /* WebInspector.h in Headers */,
</span><span class="cx">                                 BC032D8210F4378D0058C15A /* WebInspectorClient.h in Headers */,
</span><span class="cx">                                 A55BA8351BA3E70A007CD33D /* WebInspectorFrontendAPIDispatcher.h in Headers */,
</span><span class="lines">@@ -9767,6 +9781,7 @@
</span><span class="cx">                                 1A6FBA2B11E6862700DB1371 /* NetscapeBrowserFuncs.cpp in Sources */,
</span><span class="cx">                                 1A6FBD2911E69BC200DB1371 /* NetscapePlugin.cpp in Sources */,
</span><span class="cx">                                 1AE5B7FB11E7AED200BA6767 /* NetscapePluginMac.mm in Sources */,
</span><ins>+                                51D124921E74BF48002B2820 /* WKHTTPCookieStorage.mm in Sources */,
</ins><span class="cx">                                 1A4A9C5512B816CF008FE984 /* NetscapePluginModule.cpp in Sources */,
</span><span class="cx">                                 839A2F311E2067450039057E /* HighPerformanceGraphicsUsageSampler.cpp in Sources */,
</span><span class="cx">                                 1A4A9C9A12B821CD008FE984 /* NetscapePluginModuleMac.mm in Sources */,
</span><span class="lines">@@ -9785,6 +9800,7 @@
</span><span class="cx">                                 831EEBBE1BD85C4300BB64C3 /* NetworkCacheSpeculativeLoad.cpp in Sources */,
</span><span class="cx">                                 832AE2531BE2E8CD00FAAE10 /* NetworkCacheSpeculativeLoadManager.cpp in Sources */,
</span><span class="cx">                                 83BDCCB91AC5FDB6003F6441 /* NetworkCacheStatistics.cpp in Sources */,
</span><ins>+                                51D124911E74BF3C002B2820 /* APIHTTPCookieStorage.cpp in Sources */,
</ins><span class="cx">                                 E4436ED01A0D040B00EAD204 /* NetworkCacheStorage.cpp in Sources */,
</span><span class="cx">                                 8310428C1BD6B66F00A715E4 /* NetworkCacheSubresourcesEntry.cpp in Sources */,
</span><span class="cx">                                 5302583D1DCBBD2200DA89C2 /* NetworkCaptureEvent.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessCookiesWebCookieManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.cpp        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx">         WebCore::deleteCookiesForHostnames(*storageSession, { hostname });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+
</ins><span class="cx"> void WebCookieManager::deleteAllCookies(SessionID sessionID)
</span><span class="cx"> {
</span><span class="cx">     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
</span><span class="lines">@@ -78,16 +79,57 @@
</span><span class="cx">         WebCore::deleteAllCookies(*storageSession);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManager::deleteAllCookiesModifiedSince(SessionID sessionID, std::chrono::system_clock::time_point time)
</del><ins>+void WebCookieManager::deleteCookie(SessionID sessionID, const Cookie&amp; cookie, uint64_t callbackID)
</ins><span class="cx"> {
</span><span class="cx">     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
</span><ins>+        storageSession-&gt;deleteCookie(cookie);
+
+    m_process-&gt;send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+}
+
+void WebCookieManager::deleteAllCookiesModifiedSince(SessionID sessionID, std::chrono::system_clock::time_point time, uint64_t callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
</ins><span class="cx">         WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
</span><ins>+
+    if (callbackID)
+        m_process-&gt;send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManager::setCookies(WebCore::SessionID sessionID, const Vector&lt;Cookie&gt;&amp; cookies, const URL&amp; url, const URL&amp; mainDocumentURL)
</del><ins>+void WebCookieManager::getAllCookies(SessionID sessionID, uint64_t callbackID)
</ins><span class="cx"> {
</span><ins>+    Vector&lt;Cookie&gt; cookies;
</ins><span class="cx">     if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
</span><ins>+        cookies = storageSession-&gt;getAllCookies();
+
+    m_process-&gt;send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+}
+
+void WebCookieManager::getCookies(SessionID sessionID, const URL&amp; url, uint64_t callbackID)
+{
+    Vector&lt;Cookie&gt; cookies;
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        cookies = storageSession-&gt;getCookies(url);
+
+    m_process-&gt;send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+}
+
+void WebCookieManager::setCookie(WebCore::SessionID sessionID, const Cookie&amp; cookie, uint64_t callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        storageSession-&gt;setCookie(cookie);
+
+    if (callbackID)
+        m_process-&gt;send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+}
+
+void WebCookieManager::setCookies(WebCore::SessionID sessionID, const Vector&lt;Cookie&gt;&amp; cookies, const URL&amp; url, const URL&amp; mainDocumentURL, uint64_t callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
</ins><span class="cx">         storageSession-&gt;setCookies(cookies, url, mainDocumentURL);
</span><ins>+
+    if (callbackID)
+        m_process-&gt;send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebCookieManager::notifyCookiesDidChange(SessionID sessionID)
</span><span class="lines">@@ -111,9 +153,12 @@
</span><span class="cx">         WebCore::stopObservingCookieChanges(*storageSession);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
</del><ins>+void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy, uint64_t callbackID)
</ins><span class="cx"> {
</span><span class="cx">     platformSetHTTPCookieAcceptPolicy(policy);
</span><ins>+
+    if (callbackID)
+        m_process-&gt;send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID), 0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebCookieManager::getHTTPCookieAcceptPolicy(uint64_t callbackID)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessCookiesWebCookieManagerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.h        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -56,7 +56,8 @@
</span><span class="cx"> 
</span><span class="cx">     static const char* supplementName();
</span><span class="cx"> 
</span><del>-    void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
</del><ins>+    void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy, uint64_t callbackID);
+
</ins><span class="cx"> #if USE(SOUP)
</span><span class="cx">     void setCookiePersistentStorage(const String&amp; storagePath, uint32_t storageType);
</span><span class="cx"> #endif
</span><span class="lines">@@ -68,11 +69,16 @@
</span><span class="cx">     void didReceiveMessage(IPC::Connection&amp;, IPC::Decoder&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     void getHostnamesWithCookies(WebCore::SessionID, uint64_t callbackID);
</span><ins>+
+    void deleteCookie(WebCore::SessionID, const WebCore::Cookie&amp;, uint64_t callbackID);
</ins><span class="cx">     void deleteCookiesForHostname(WebCore::SessionID, const String&amp;);
</span><span class="cx">     void deleteAllCookies(WebCore::SessionID);
</span><del>-    void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point);
</del><ins>+    void deleteAllCookiesModifiedSince(WebCore::SessionID, std::chrono::system_clock::time_point, uint64_t callbackID);
</ins><span class="cx"> 
</span><del>-    void setCookies(WebCore::SessionID, const Vector&lt;WebCore::Cookie&gt;&amp;, const WebCore::URL&amp;, const WebCore::URL&amp; mainDocumentURL);
</del><ins>+    void setCookie(WebCore::SessionID, const WebCore::Cookie&amp;, uint64_t callbackID);
+    void setCookies(WebCore::SessionID, const Vector&lt;WebCore::Cookie&gt;&amp;, const WebCore::URL&amp;, const WebCore::URL&amp; mainDocumentURL, uint64_t callbackID);
+    void getAllCookies(WebCore::SessionID, uint64_t callbackID);
+    void getCookies(WebCore::SessionID, const WebCore::URL&amp;, uint64_t callbackID);
</ins><span class="cx"> 
</span><span class="cx">     void platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
</span><span class="cx">     void getHTTPCookieAcceptPolicy(uint64_t callbackID);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessCookiesWebCookieManagermessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Source/WebKit2/WebProcess/Cookies/WebCookieManager.messages.in        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -27,11 +27,15 @@
</span><span class="cx">     void GetHostnamesWithCookies(WebCore::SessionID sessionID, uint64_t callbackID)
</span><span class="cx">     void DeleteCookiesForHostname(WebCore::SessionID sessionID, String hostname)
</span><span class="cx">     void DeleteAllCookies(WebCore::SessionID sessionID)
</span><del>-    void DeleteAllCookiesModifiedSince(WebCore::SessionID sessionID, std::chrono::system_clock::time_point time)
</del><span class="cx"> 
</span><del>-    void SetCookies(WebCore::SessionID sessionID, Vector&lt;WebCore::Cookie&gt; cookies, WebCore::URL url, WebCore::URL mainDocumentURL);
</del><ins>+    void SetCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, uint64_t callbackID)
+    void SetCookies(WebCore::SessionID sessionID, Vector&lt;WebCore::Cookie&gt; cookies, WebCore::URL url, WebCore::URL mainDocumentURL, uint64_t callbackID)
+    void GetAllCookies(WebCore::SessionID sessionID, uint64_t callbackID)
+    void GetCookies(WebCore::SessionID sessionID, WebCore::URL url, uint64_t callbackID)
+    void DeleteCookie(WebCore::SessionID sessionID, struct WebCore::Cookie cookie, uint64_t callbackID)
+    void DeleteAllCookiesModifiedSince(WebCore::SessionID sessionID, std::chrono::system_clock::time_point time, uint64_t callbackID)
</ins><span class="cx"> 
</span><del>-    void SetHTTPCookieAcceptPolicy(uint32_t policy)
</del><ins>+    void SetHTTPCookieAcceptPolicy(uint32_t policy, uint64_t callbackID)
</ins><span class="cx">     void GetHTTPCookieAcceptPolicy(uint64_t callbackID)
</span><span class="cx">     
</span><span class="cx">     void StartObservingCookieChanges(WebCore::SessionID sessionID)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Tools/ChangeLog        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2017-03-13  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        WKWebView provides no access to cookies.
+        https://bugs.webkit.org/show_bug.cgi?id=140191
+
+        Reviewed by Tim Horton.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+
</ins><span class="cx"> 2017-03-13  Carlos Alberto Lopez Perez  &lt;clopez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] install-dependencies needs to install Perl CGI modules on Debian based distros
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (213876 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-03-13 22:52:41 UTC (rev 213876)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -152,6 +152,7 @@
</span><span class="cx">                 51BCEE4F1C84F53B0042C82E /* IndexedDBMultiProcess-2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */; };
</span><span class="cx">                 51CD1C6C1B38CE4300142CA5 /* ModalAlerts.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */; };
</span><span class="cx">                 51CD1C721B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51CD1C711B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html */; };
</span><ins>+                51D124981E763B02002B2820 /* WKHTTPCookieStorage.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51D124971E763AF8002B2820 /* WKHTTPCookieStorage.mm */; };
</ins><span class="cx">                 51E5C7021919C3B200D8B3E1 /* simple2.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51E780361919AFF8001829A2 /* simple2.html */; };
</span><span class="cx">                 51E5C7031919C3B200D8B3E1 /* simple3.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51E780371919AFF8001829A2 /* simple3.html */; };
</span><span class="cx">                 51E6A8941D2F1C0A00C004B6 /* LocalStorageClear.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */; };
</span><span class="lines">@@ -1048,6 +1049,7 @@
</span><span class="cx">                 51CB4AD71B3A079C00C1B1C6 /* ModalAlertsSPI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ModalAlertsSPI.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51CD1C6A1B38CE3600142CA5 /* ModalAlerts.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ModalAlerts.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51CD1C711B38D48400142CA5 /* modal-alerts-in-new-about-blank-window.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = &quot;modal-alerts-in-new-about-blank-window.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51D124971E763AF8002B2820 /* WKHTTPCookieStorage.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKHTTPCookieStorage.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldKeepCurrentBackForwardListItemInList.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = LocalStorageClear.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51E6A8951D2F1C7700C004B6 /* LocalStorageClear.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = LocalStorageClear.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1649,6 +1651,7 @@
</span><span class="cx">                                 5120C83C1E6750790025B250 /* WebsiteDataStoreCustomPaths.mm */,
</span><span class="cx">                                 5C9E56841DF9143D00C9EE33 /* WebsitePolicies.mm */,
</span><span class="cx">                                 1F83571A1D3FFB0E00E3967B /* WKBackForwardList.mm */,
</span><ins>+                                51D124971E763AF8002B2820 /* WKHTTPCookieStorage.mm */,
</ins><span class="cx">                                 375E0E151D66674400EFEC2C /* WKNSNumber.mm */,
</span><span class="cx">                                 37B47E2E1D64E7CA005F4EFF /* WKObject.mm */,
</span><span class="cx">                                 2D00065D1C1F58940088E6A7 /* WKPDFViewResizeCrash.mm */,
</span><span class="lines">@@ -2729,6 +2732,7 @@
</span><span class="cx">                                 7CCE7EF41A411AE600447C4C /* FindMatches.mm in Sources */,
</span><span class="cx">                                 7C83E0401D0A63E300FEBCF3 /* FirstResponderScrollingPosition.mm in Sources */,
</span><span class="cx">                                 7C83E0BC1D0A650700FEBCF3 /* FixedLayoutSize.mm in Sources */,
</span><ins>+                                51D124981E763B02002B2820 /* WKHTTPCookieStorage.mm in Sources */,
</ins><span class="cx">                                 7CCE7EF51A411AE600447C4C /* ForceRepaint.cpp in Sources */,
</span><span class="cx">                                 37B47E301D64E7CA005F4EFF /* WKObject.mm in Sources */,
</span><span class="cx">                                 7CCE7EC01A411A7E00447C4C /* FragmentNavigation.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaWKHTTPCookieStoragemm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStorage.mm (0 => 213877)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStorage.mm                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKHTTPCookieStorage.mm        2017-03-13 23:00:49 UTC (rev 213877)
</span><span class="lines">@@ -0,0 +1,119 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#import &quot;PlatformUtilities.h&quot;
+#import &lt;WebKit/WKFoundation.h&gt;
+#import &lt;WebKit/WKHTTPCookieStorage.h&gt;
+#import &lt;WebKit/WKWebsiteDataStorePrivate.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+#if WK_API_ENABLED
+
+static bool gotFlag;
+
+TEST(WebKit2, WKHTTPCookieStorage)
+{
+    auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    [webView loadHTMLString:@&quot;Oh hello&quot; baseURL:[NSURL URLWithString:@&quot;http://webkit.org&quot;]];
+
+    RetainPtr&lt;WKHTTPCookieStorage&gt; cookieStorage = [WKWebsiteDataStore defaultDataStore]._httpCookieStorage;
+
+    NSArray&lt;NSHTTPCookie *&gt; *cookies = nil;
+    [cookieStorage fetchCookies:[cookiesPtr = &amp;cookies](NSArray&lt;NSHTTPCookie *&gt; *nsCookies) {
+        *cookiesPtr = [nsCookies retain];
+        gotFlag = true;
+    }];
+
+    TestWebKitAPI::Util::run(&amp;gotFlag);
+
+    ASSERT_EQ(cookies.count, 0u);
+    [cookies release];
+
+    gotFlag = false;
+
+    RetainPtr&lt;NSHTTPCookie&gt; cookie1 = [NSHTTPCookie cookieWithProperties:@{
+        NSHTTPCookiePath: @&quot;/&quot;,
+        NSHTTPCookieName: @&quot;CookieName&quot;,
+        NSHTTPCookieValue: @&quot;CookieValue&quot;,
+        NSHTTPCookieDomain: @&quot;.www.webkit.org&quot;,
+        NSHTTPCookieSecure: @&quot;TRUE&quot;,
+        NSHTTPCookieDiscard: @&quot;TRUE&quot;,
+        NSHTTPCookieMaximumAge: @&quot;10000&quot;,
+    }];
+
+    RetainPtr&lt;NSHTTPCookie&gt; cookie2 = [NSHTTPCookie cookieWithProperties:@{
+        NSHTTPCookiePath: @&quot;/path&quot;,
+        NSHTTPCookieName: @&quot;OtherCookieName&quot;,
+        NSHTTPCookieValue: @&quot;OtherCookieValue&quot;,
+        NSHTTPCookieDomain: @&quot;.www.w3c.org&quot;,
+        NSHTTPCookieMaximumAge: @&quot;10000&quot;,
+    }];
+
+    [cookieStorage setCookie:cookie1.get() completionHandler:[](){
+        gotFlag = true;
+    }];
+
+    TestWebKitAPI::Util::run(&amp;gotFlag);
+    gotFlag = false;
+
+    [cookieStorage setCookie:cookie2.get() completionHandler:[](){
+        gotFlag = true;
+    }];
+
+    TestWebKitAPI::Util::run(&amp;gotFlag);
+    gotFlag = false;
+
+    [cookieStorage fetchCookies:[cookiesPtr = &amp;cookies](NSArray&lt;NSHTTPCookie *&gt; *nsCookies) {
+        *cookiesPtr = [nsCookies retain];
+        gotFlag = true;
+    }];
+
+    TestWebKitAPI::Util::run(&amp;gotFlag);
+
+    ASSERT_EQ(cookies.count, 2u);
+
+    for (NSHTTPCookie *cookie : cookies) {
+        if ([cookie.name isEqual:@&quot;CookieName&quot;]) {
+            ASSERT_TRUE([cookie1.get().path isEqualToString:cookie.path]);
+            ASSERT_TRUE([cookie1.get().value isEqualToString:cookie.value]);
+            ASSERT_TRUE([cookie1.get().domain isEqualToString:cookie.domain]);
+            ASSERT_TRUE(cookie1.get().secure);
+            ASSERT_TRUE(cookie1.get().sessionOnly);
+        } else {
+            ASSERT_TRUE([cookie2.get().path isEqualToString:cookie.path]);
+            ASSERT_TRUE([cookie2.get().value isEqualToString:cookie.value]);
+            ASSERT_TRUE([cookie2.get().name isEqualToString:cookie.name]);
+            ASSERT_TRUE([cookie2.get().domain isEqualToString:cookie.domain]);
+            ASSERT_FALSE(cookie2.get().secure);
+            ASSERT_FALSE(cookie2.get().sessionOnly);
+        }
+    }
+
+    [cookies release];
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>