<!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>[184211] 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/184211">184211</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2015-05-12 12:37:31 -0700 (Tue, 12 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Mac] Share cookie storage between UI process and secondary processes
https://bugs.webkit.org/show_bug.cgi?id=144820
rdar://problem/20572830

Reviewed by Darin Adler.

Source/WebCore:

* platform/network/mac/CookieJarMac.mm:
* platform/spi/cf/CFNetworkSPI.h:
Moved SPIs into an SPI header, so that WebKit2 could use them too without duplication.

Source/WebKit2:

Pass a cookie storage descriptor that includes file path as well as other data that
CFNetwork needs to use the same cookies storage as in another process (session cookies
are still separate).

While at it, started to clean up code that passes cookie storage path. It was mostly
dead and unimplemented, only used in child processes when USE(SECCOMP_FILTERS) was enabled.

* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
* Shared/Network/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):
* Shared/Network/NetworkProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
(WebKit::WebProcessPool::platformDefaultCookieStorageDirectory): Deleted.
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::createNewWebProcess):
(WebKit::WebProcessPool::cookieStorageDirectory):
* UIProcess/WebProcessPool.h:
* UIProcess/efl/WebProcessPoolEfl.cpp:
(WebKit::WebProcessPool::platformDefaultCookieStorageDirectory): Deleted.
* UIProcess/gtk/WebProcessPoolGtk.cpp:
(WebKit::WebProcessPool::platformDefaultCookieStorageDirectory): Deleted.
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformInitializeWebProcess):

Tools:

* WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize):
Don't set cookie storage directory, as it's a no-op, we use an ephemeral session
for testing.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkmacCookieJarMacmm">trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformspicfCFNetworkSPIh">trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscocoaNetworkProcessCocoamm">trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedChildProcessh">trunk/Source/WebKit2/Shared/ChildProcess.h</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkNetworkProcessCreationParameterscpp">trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedNetworkNetworkProcessCreationParametersh">trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebProcessCreationParameterscpp">trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebProcessCreationParametersh">trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacChildProcessMacmm">trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebProcessPoolCocoamm">trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm</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="#trunkSourceWebKit2UIProcesseflWebProcessPoolEflcpp">trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessgtkWebProcessPoolGtkcpp">trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebProcessCocoamm">trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWebKitTestRunnerTestControllercpp">trunk/Tools/WebKitTestRunner/TestController.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebCore/ChangeLog        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-05-08  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] Share cookie storage between UI process and secondary processes
+        https://bugs.webkit.org/show_bug.cgi?id=144820
+        rdar://problem/20572830
+
+        Reviewed by Darin Adler.
+
+        * platform/network/mac/CookieJarMac.mm:
+        * platform/spi/cf/CFNetworkSPI.h:
+        Moved SPIs into an SPI header, so that WebKit2 could use them too without duplication.
+
</ins><span class="cx"> 2015-05-12  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] Log using diagnostic logging how far back in history we navigate
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkmacCookieJarMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebCore/platform/network/mac/CookieJarMac.mm        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -26,14 +26,9 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;PlatformCookieJar.h&quot;
</span><span class="cx"> 
</span><ins>+#import &quot;CFNetworkSPI.h&quot;
</ins><span class="cx"> #import &quot;NetworkStorageSession.h&quot;
</span><span class="cx"> 
</span><del>-@interface NSHTTPCookieStorage (Details)
-- (void)removeCookiesSinceDate:(NSDate *)date;
-- (id)_initWithCFHTTPCookieStorage:(CFHTTPCookieStorageRef)cfStorage;
-- (CFHTTPCookieStorageRef)_cookieStorage;
-@end
-
</del><span class="cx"> #if !USE(CFNETWORK)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;BlockExceptions.h&quot;
</span><span class="lines">@@ -43,11 +38,6 @@
</span><span class="cx"> #import &quot;WebCoreSystemInterface.h&quot;
</span><span class="cx"> #import &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><del>-enum {
-    NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3
-};
-
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static RetainPtr&lt;NSArray&gt; filterCookies(NSArray *unfilteredCookies)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspicfCFNetworkSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebCore/platform/spi/cf/CFNetworkSPI.h        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -120,4 +120,20 @@
</span><span class="cx"> EXTERN_C void _CFNetworkResetHSTSHostsSinceDate(CFURLStorageSessionRef, CFDateRef);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if (TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
+EXTERN_C CFDataRef CFHTTPCookieStorageCreateIdentifyingData(CFAllocatorRef inAllocator, CFHTTPCookieStorageRef inStorage);
+EXTERN_C CFHTTPCookieStorageRef CFHTTPCookieStorageCreateFromIdentifyingData(CFAllocatorRef inAllocator, CFDataRef inData);
+#endif
+
+#if defined(__OBJC__) &amp;&amp; !USE(APPLE_INTERNAL_SDK)
+@interface NSHTTPCookieStorage (Details)
+#if (TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
++ (void)_setSharedHTTPCookieStorage:(NSHTTPCookieStorage *)storage;
+#endif
+- (void)removeCookiesSinceDate:(NSDate *)date;
+- (id)_initWithCFHTTPCookieStorage:(CFHTTPCookieStorageRef)cfStorage;
+- (CFHTTPCookieStorageRef)_cookieStorage;
+@end
+#endif
+
</ins><span class="cx"> #endif // CFNetworkSPI_h
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2015-05-08  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] Share cookie storage between UI process and secondary processes
+        https://bugs.webkit.org/show_bug.cgi?id=144820
+        rdar://problem/20572830
+
+        Reviewed by Darin Adler.
+
+        Pass a cookie storage descriptor that includes file path as well as other data that
+        CFNetwork needs to use the same cookies storage as in another process (session cookies
+        are still separate).
+
+        While at it, started to clean up code that passes cookie storage path. It was mostly
+        dead and unimplemented, only used in child processes when USE(SECCOMP_FILTERS) was enabled.
+
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
+        * Shared/Network/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * Shared/Network/NetworkProcessCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        (WebKit::WebProcessPool::platformDefaultCookieStorageDirectory): Deleted.
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+        (WebKit::WebProcessPool::createNewWebProcess):
+        (WebKit::WebProcessPool::cookieStorageDirectory):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/efl/WebProcessPoolEfl.cpp:
+        (WebKit::WebProcessPool::platformDefaultCookieStorageDirectory): Deleted.
+        * UIProcess/gtk/WebProcessPoolGtk.cpp:
+        (WebKit::WebProcessPool::platformDefaultCookieStorageDirectory): Deleted.
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformInitializeWebProcess):
+
</ins><span class="cx"> 2015-05-12  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [WK2] Log using diagnostic logging how far back in history we navigate
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscocoaNetworkProcessCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -77,6 +77,10 @@
</span><span class="cx"> 
</span><span class="cx">     initializeNetworkSettings();
</span><span class="cx"> 
</span><ins>+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
+#endif
+
</ins><span class="cx">     // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
</span><span class="cx">     // - memory cache size passed from UI process is always ignored;
</span><span class="cx">     // - disk cache size passed from UI process is effectively a minimum size.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedChildProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ChildProcess.h (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ChildProcess.h        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/Shared/ChildProcess.h        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -84,6 +84,10 @@
</span><span class="cx">     virtual void initializeSandbox(const ChildProcessInitializationParameters&amp;, SandboxInitializationParameters&amp;);
</span><span class="cx">     virtual void initializeConnection(IPC::Connection*);
</span><span class="cx"> 
</span><ins>+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    static void setSharedHTTPCookieStorage(const Vector&lt;uint8_t&gt;&amp; identifier);
+#endif
+
</ins><span class="cx">     virtual bool shouldTerminate() = 0;
</span><span class="cx">     virtual void terminate();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkNetworkProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -52,7 +52,12 @@
</span><span class="cx">     encoder &lt;&lt; shouldEnableNetworkCache;
</span><span class="cx">     encoder &lt;&lt; shouldEnableNetworkCacheEfficacyLogging;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     encoder &lt;&lt; cookieStorageDirectory;
</span><ins>+#endif
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    encoder &lt;&lt; uiProcessCookieStorageIdentifier;
+#endif
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     encoder &lt;&lt; cookieStorageDirectoryExtensionHandle;
</span><span class="cx">     encoder &lt;&lt; containerCachesDirectoryExtensionHandle;
</span><span class="lines">@@ -100,8 +105,14 @@
</span><span class="cx">     if (!decoder.decode(result.shouldEnableNetworkCacheEfficacyLogging))
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     if (!decoder.decode(result.cookieStorageDirectory))
</span><span class="cx">         return false;
</span><ins>+#endif
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    if (!decoder.decode(result.uiProcessCookieStorageIdentifier))
+        return false;
+#endif
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     if (!decoder.decode(result.cookieStorageDirectoryExtensionHandle))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedNetworkNetworkProcessCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -61,14 +61,15 @@
</span><span class="cx">     bool shouldEnableNetworkCache;
</span><span class="cx">     bool shouldEnableNetworkCacheEfficacyLogging;
</span><span class="cx"> #endif
</span><del>-
</del><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     String cookieStorageDirectory;
</span><del>-
</del><ins>+#endif
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    Vector&lt;uint8_t&gt; uiProcessCookieStorageIdentifier;
+#endif
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
</span><del>-
</del><span class="cx">     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
</span><del>-
</del><span class="cx">     SandboxExtension::Handle parentBundleDirectoryExtensionHandle;
</span><span class="cx"> #endif
</span><span class="cx">     bool shouldUseTestingNetworkSession;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -73,7 +73,12 @@
</span><span class="cx">     encoder &lt;&lt; webSQLDatabaseDirectoryExtensionHandle;
</span><span class="cx">     encoder &lt;&lt; diskCacheDirectory;
</span><span class="cx">     encoder &lt;&lt; diskCacheDirectoryExtensionHandle;
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     encoder &lt;&lt; cookieStorageDirectory;
</span><ins>+#endif
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    encoder &lt;&lt; uiProcessCookieStorageIdentifier;
+#endif
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     encoder &lt;&lt; cookieStorageDirectoryExtensionHandle;
</span><span class="cx">     encoder &lt;&lt; containerCachesDirectoryExtensionHandle;
</span><span class="lines">@@ -177,8 +182,14 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.diskCacheDirectoryExtensionHandle))
</span><span class="cx">         return false;
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     if (!decoder.decode(parameters.cookieStorageDirectory))
</span><span class="cx">         return false;
</span><ins>+#endif
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    if (!decoder.decode(parameters.uiProcessCookieStorageIdentifier))
+        return false;
+#endif
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     if (!decoder.decode(parameters.cookieStorageDirectoryExtensionHandle))
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebProcessCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -74,7 +74,12 @@
</span><span class="cx">     SandboxExtension::Handle webSQLDatabaseDirectoryExtensionHandle;
</span><span class="cx">     String diskCacheDirectory;
</span><span class="cx">     SandboxExtension::Handle diskCacheDirectoryExtensionHandle;
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     String cookieStorageDirectory;
</span><ins>+#endif
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    Vector&lt;uint8_t&gt; uiProcessCookieStorageIdentifier;
+#endif
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
</span><span class="cx">     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacChildProcessMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/Shared/mac/ChildProcessMac.mm        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;SandboxInitializationParameters.h&quot;
</span><span class="cx"> #import &quot;WebKitSystemInterface.h&quot;
</span><ins>+#import &lt;WebCore/CFNetworkSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/FileSystem.h&gt;
</span><span class="cx"> #import &lt;WebCore/SystemVersion.h&gt;
</span><span class="cx"> #import &lt;mach/mach.h&gt;
</span><span class="lines">@@ -175,6 +176,20 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+void ChildProcess::setSharedHTTPCookieStorage(const Vector&lt;uint8_t&gt;&amp; identifier)
+{
+    // FIXME: Remove the runtime check when it's not needed (soon).
+    if (![NSHTTPCookieStorage respondsToSelector:@selector(_setSharedHTTPCookieStorage:)])
+        return;
+
+    RetainPtr&lt;CFDataRef&gt; cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, identifier.data(), identifier.size()));
+    RetainPtr&lt;CFHTTPCookieStorageRef&gt; uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
+    [NSHTTPCookieStorage _setSharedHTTPCookieStorage:adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:uiProcessCookieStorage.get()]).get()];
+}
+#endif
+
+
</ins><span class="cx"> #if USE(APPKIT)
</span><span class="cx"> void ChildProcess::stopNSAppRunLoop()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebProcessPoolCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -240,6 +240,12 @@
</span><span class="cx"> #if (TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
</span><span class="cx">     parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    RetainPtr&lt;CFDataRef&gt; cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
+    ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
+    parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(NETWORK_PROCESS)
</span><span class="lines">@@ -267,6 +273,12 @@
</span><span class="cx">     parameters.shouldEnableNetworkCache = [defaults boolForKey:WebKitNetworkCacheEnabledDefaultsKey] &amp;&amp; ![defaults boolForKey:WebKitNetworkCacheTemporarilyDisabledForTestingKey];
</span><span class="cx">     parameters.shouldEnableNetworkCacheEfficacyLogging = [defaults boolForKey:WebKitNetworkCacheEfficacyLoggingEnabledDefaultsKey];
</span><span class="cx"> #endif
</span><ins>+
+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    RetainPtr&lt;CFDataRef&gt; cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
+    ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
+    parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
+#endif
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -283,23 +295,7 @@
</span><span class="cx">     return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String WebProcessPool::platformDefaultCookieStorageDirectory() const
-{
</del><span class="cx"> #if PLATFORM(IOS)
</span><del>-    String path = pathForProcessContainer();
-    if (path.isEmpty())
-        path = NSHomeDirectory();
-
-    path = path + &quot;/Library/Cookies&quot;;
-    path = stringByResolvingSymlinksInPath(path);
-    return path;
-#else
-    notImplemented();
-    return [@&quot;&quot; stringByStandardizingPath];
-#endif
-}
-
-#if PLATFORM(IOS)
</del><span class="cx"> String WebProcessPool::parentBundleDirectory() const
</span><span class="cx"> {
</span><span class="cx">     return [[[NSBundle mainBundle] bundlePath] stringByStandardizingPath];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.cpp        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -411,11 +411,14 @@
</span><span class="cx">     if (!parameters.diskCacheDirectory.isEmpty())
</span><span class="cx">         SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle);
</span><span class="cx"> 
</span><del>-    parameters.cookieStorageDirectory = cookieStorageDirectory();
</del><ins>+#if ENABLE(SECCOMP_FILTERS)
+    parameters.cookieStorageDirectory = this-&gt;cookieStorageDirectory();
+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (!parameters.cookieStorageDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(parameters.cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
</del><ins>+    String cookieStorageDirectory = this-&gt;cookieStorageDirectory();
+    if (!cookieStorageDirectory.isEmpty())
+        SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
</ins><span class="cx"> 
</span><span class="cx">     String containerCachesDirectory = this-&gt;networkingCachesDirectory();
</span><span class="cx">     if (!containerCachesDirectory.isEmpty())
</span><span class="lines">@@ -610,11 +613,14 @@
</span><span class="cx">     if (!parameters.diskCacheDirectory.isEmpty())
</span><span class="cx">         SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle);
</span><span class="cx"> 
</span><del>-    parameters.cookieStorageDirectory = cookieStorageDirectory();
</del><ins>+#if ENABLE(SECCOMP_FILTERS)
+    parameters.cookieStorageDirectory = this-&gt;cookieStorageDirectory();
+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (!parameters.cookieStorageDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(parameters.cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
</del><ins>+    String cookieStorageDirectory = this-&gt;cookieStorageDirectory();
+    if (!cookieStorageDirectory.isEmpty())
+        SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
</ins><span class="cx"> 
</span><span class="cx">     String containerCachesDirectory = this-&gt;webContentCachesDirectory();
</span><span class="cx">     if (!containerCachesDirectory.isEmpty())
</span><span class="lines">@@ -1187,13 +1193,16 @@
</span><span class="cx">     return platformDefaultDiskCacheDirectory();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx"> String WebProcessPool::cookieStorageDirectory() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_overrideCookieStorageDirectory.isEmpty())
</span><span class="cx">         return m_overrideCookieStorageDirectory;
</span><span class="cx"> 
</span><del>-    return platformDefaultCookieStorageDirectory();
</del><ins>+    // FIXME: This doesn't make much sense. Is this function used at all? We used to call platform code, but no existing platforms implemented that function.
+    return emptyString();
</ins><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> void WebProcessPool::useTestingNetworkSession()
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebProcessPoolh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -401,8 +401,9 @@
</span><span class="cx">     String diskCacheDirectory() const;
</span><span class="cx">     String platformDefaultDiskCacheDirectory() const;
</span><span class="cx"> 
</span><ins>+#if ENABLE(SECCOMP_FILTERS)
</ins><span class="cx">     String cookieStorageDirectory() const;
</span><del>-    String platformDefaultCookieStorageDirectory() const;
</del><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     String parentBundleDirectory() const;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcesseflWebProcessPoolEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -131,12 +131,6 @@
</span><span class="cx">     return String::fromUTF8(efreet_cache_home_get()) + &quot;/WebKitEfl&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String WebProcessPool::platformDefaultCookieStorageDirectory() const
-{
-    notImplemented();
-    return String();
-}
-
</del><span class="cx"> void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
</span><span class="cx"> {
</span><span class="cx">     m_ignoreTLSErrors = ignoreTLSErrors;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessgtkWebProcessPoolGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -148,12 +148,6 @@
</span><span class="cx">     return WebCore::filenameToString(diskCacheDirectory.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String WebProcessPool::platformDefaultCookieStorageDirectory() const
-{
-    notImplemented();
-    return String();
-}
-
</del><span class="cx"> void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
</span><span class="cx"> {
</span><span class="cx">     m_ignoreTLSErrors = ignoreTLSErrors;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebProcessCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -149,6 +149,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
+#endif
+
</ins><span class="cx">     // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
</span><span class="cx">     // - memory cache size passed from UI process is always ignored;
</span><span class="cx">     // - disk cache size passed from UI process is effectively a minimum size.
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Tools/ChangeLog        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-05-11  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        [Mac] Share cookie storage between UI process and secondary processes
+        https://bugs.webkit.org/show_bug.cgi?id=144820
+        rdar://problem/20572830
+
+        Reviewed by Darin Adler.
+
+        * WebKitTestRunner/TestController.cpp: (WTR::TestController::initialize):
+        Don't set cookie storage directory, as it's a no-op, we use an ephemeral session
+        for testing.
+
</ins><span class="cx"> 2015-05-12  Jake Nielsen  &lt;jacob_nielsen@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix internal build configuration issues
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerTestControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (184210 => 184211)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/TestController.cpp        2015-05-12 19:29:42 UTC (rev 184210)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp        2015-05-12 19:37:31 UTC (rev 184211)
</span><span class="lines">@@ -380,7 +380,6 @@
</span><span class="cx">         // FIXME: These should be migrated to WKContextConfigurationRef.
</span><span class="cx">         WKContextSetApplicationCacheDirectory(m_context.get(), toWK(temporaryFolder + separator + &quot;ApplicationCache&quot;).get());
</span><span class="cx">         WKContextSetDiskCacheDirectory(m_context.get(), toWK(temporaryFolder + separator + &quot;Cache&quot;).get());
</span><del>-        WKContextSetCookieStorageDirectory(m_context.get(), toWK(temporaryFolder + separator + &quot;Cookies&quot;).get());
</del><span class="cx">         // Disable icon database to avoid fetching &lt;http://127.0.0.1:8000/favicon.ico&gt; and making tests flaky.
</span><span class="cx">         // Invividual tests can enable it using testRunner.setIconDatabaseEnabled, although it's not currently supported in WebKitTestRunner.
</span><span class="cx">         WKContextSetIconDatabasePath(m_context.get(), toWK(emptyString()).get());
</span></span></pre>
</div>
</div>

</body>
</html>