[Mac] Share cookie storage between UI process and secondary processes
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 19:37:31 +0000 (19:37 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 May 2015 19:37:31 +0000 (19:37 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184211 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/network/mac/CookieJarMac.mm
Source/WebCore/platform/spi/cf/CFNetworkSPI.h
Source/WebKit2/ChangeLog
Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit2/Shared/ChildProcess.h
Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.cpp
Source/WebKit2/Shared/Network/NetworkProcessCreationParameters.h
Source/WebKit2/Shared/WebProcessCreationParameters.cpp
Source/WebKit2/Shared/WebProcessCreationParameters.h
Source/WebKit2/Shared/mac/ChildProcessMac.mm
Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/UIProcess/efl/WebProcessPoolEfl.cpp
Source/WebKit2/UIProcess/gtk/WebProcessPoolGtk.cpp
Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp

index 7c7729a34198ec1d68bd393e933e99e1e59891cc..e6f742cfe9b59f69cafb215154e2a0ded650caa0 100644 (file)
@@ -1,3 +1,15 @@
+2015-05-08  Alexey Proskuryakov  <ap@apple.com>
+
+        [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.
+
 2015-05-12  Chris Dumez  <cdumez@apple.com>
 
         [WK2] Log using diagnostic logging how far back in history we navigate
index 240fa92234f961784ffe4a4f860df67937e49707..35c2fc6afc828ff238750d1bf93d4c383a599a29 100644 (file)
 #import "config.h"
 #import "PlatformCookieJar.h"
 
+#import "CFNetworkSPI.h"
 #import "NetworkStorageSession.h"
 
-@interface NSHTTPCookieStorage (Details)
-- (void)removeCookiesSinceDate:(NSDate *)date;
-- (id)_initWithCFHTTPCookieStorage:(CFHTTPCookieStorageRef)cfStorage;
-- (CFHTTPCookieStorageRef)_cookieStorage;
-@end
-
 #if !USE(CFNETWORK)
 
 #import "BlockExceptions.h"
 #import "WebCoreSystemInterface.h"
 #import <wtf/text/StringBuilder.h>
 
-enum {
-    NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain = 3
-};
-
-
 namespace WebCore {
 
 static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies)
index ef2ed849e5b7197e458fd23a6123fb80b07cc18a..d92e788a5448e71278a495254a30e1e26e1a5726 100644 (file)
@@ -120,4 +120,20 @@ EXTERN_C Boolean _CFNetworkSetATSContext(CFDataRef);
 EXTERN_C void _CFNetworkResetHSTSHostsSinceDate(CFURLStorageSessionRef, CFDateRef);
 #endif
 
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
+EXTERN_C CFDataRef CFHTTPCookieStorageCreateIdentifyingData(CFAllocatorRef inAllocator, CFHTTPCookieStorageRef inStorage);
+EXTERN_C CFHTTPCookieStorageRef CFHTTPCookieStorageCreateFromIdentifyingData(CFAllocatorRef inAllocator, CFDataRef inData);
+#endif
+
+#if defined(__OBJC__) && !USE(APPLE_INTERNAL_SDK)
+@interface NSHTTPCookieStorage (Details)
+#if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
++ (void)_setSharedHTTPCookieStorage:(NSHTTPCookieStorage *)storage;
+#endif
+- (void)removeCookiesSinceDate:(NSDate *)date;
+- (id)_initWithCFHTTPCookieStorage:(CFHTTPCookieStorageRef)cfStorage;
+- (CFHTTPCookieStorageRef)_cookieStorage;
+@end
+#endif
+
 #endif // CFNetworkSPI_h
index 59055f5fe2ee2e4fe9d62e5227833ff7bbb19b3e..95d5cabf50ba549efcad2fa76ca49e1b7793109f 100644 (file)
@@ -1,3 +1,44 @@
+2015-05-08  Alexey Proskuryakov  <ap@apple.com>
+
+        [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):
+
 2015-05-12  Chris Dumez  <cdumez@apple.com>
 
         [WK2] Log using diagnostic logging how far back in history we navigate
index 3a753c7c8209bbfbacb84f5876d81edfd6e8561e..5b63d1242e3f78ecd7f021fc6825ab090675d25c 100644 (file)
@@ -77,6 +77,10 @@ void NetworkProcess::platformInitializeNetworkProcessCocoa(const NetworkProcessC
 
     initializeNetworkSettings();
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
+#endif
+
     // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
     // - memory cache size passed from UI process is always ignored;
     // - disk cache size passed from UI process is effectively a minimum size.
index 43e937ea6599b4309b72a34f6e31769c963d7aea..b67e3b72f1886656a41225be318708f2f8cda134 100644 (file)
@@ -84,6 +84,10 @@ protected:
     virtual void initializeSandbox(const ChildProcessInitializationParameters&, SandboxInitializationParameters&);
     virtual void initializeConnection(IPC::Connection*);
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    static void setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier);
+#endif
+
     virtual bool shouldTerminate() = 0;
     virtual void terminate();
 
index 0319c42f6938c5c8b1e46f7798269dd27aa5900c..2e81602407d9727b854178b95bb9dc28129be348 100644 (file)
@@ -52,7 +52,12 @@ void NetworkProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) con
     encoder << shouldEnableNetworkCache;
     encoder << shouldEnableNetworkCacheEfficacyLogging;
 #endif
+#if ENABLE(SECCOMP_FILTERS)
     encoder << cookieStorageDirectory;
+#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    encoder << uiProcessCookieStorageIdentifier;
+#endif
 #if PLATFORM(IOS)
     encoder << cookieStorageDirectoryExtensionHandle;
     encoder << containerCachesDirectoryExtensionHandle;
@@ -100,8 +105,14 @@ bool NetworkProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, Net
     if (!decoder.decode(result.shouldEnableNetworkCacheEfficacyLogging))
         return false;
 #endif
+#if ENABLE(SECCOMP_FILTERS)
     if (!decoder.decode(result.cookieStorageDirectory))
         return false;
+#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    if (!decoder.decode(result.uiProcessCookieStorageIdentifier))
+        return false;
+#endif
 #if PLATFORM(IOS)
     if (!decoder.decode(result.cookieStorageDirectoryExtensionHandle))
         return false;
index 03efb74a95e5c763ac00ed6fb8482fd6608585c3..8cf39ef3519945104922a3b63277d1a7c15ece33 100644 (file)
@@ -61,14 +61,15 @@ struct NetworkProcessCreationParameters {
     bool shouldEnableNetworkCache;
     bool shouldEnableNetworkCacheEfficacyLogging;
 #endif
-
+#if ENABLE(SECCOMP_FILTERS)
     String cookieStorageDirectory;
-
+#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    Vector<uint8_t> uiProcessCookieStorageIdentifier;
+#endif
 #if PLATFORM(IOS)
     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
-
     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
-
     SandboxExtension::Handle parentBundleDirectoryExtensionHandle;
 #endif
     bool shouldUseTestingNetworkSession;
index 0986ee3c2108243740ff380a7006e67cd4e8e897..dd83f730dd79a3bd623b140220c4d0b65316dbf8 100644 (file)
@@ -73,7 +73,12 @@ void WebProcessCreationParameters::encode(IPC::ArgumentEncoder& encoder) const
     encoder << webSQLDatabaseDirectoryExtensionHandle;
     encoder << diskCacheDirectory;
     encoder << diskCacheDirectoryExtensionHandle;
+#if ENABLE(SECCOMP_FILTERS)
     encoder << cookieStorageDirectory;
+#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    encoder << uiProcessCookieStorageIdentifier;
+#endif
 #if PLATFORM(IOS)
     encoder << cookieStorageDirectoryExtensionHandle;
     encoder << containerCachesDirectoryExtensionHandle;
@@ -177,8 +182,14 @@ bool WebProcessCreationParameters::decode(IPC::ArgumentDecoder& decoder, WebProc
         return false;
     if (!decoder.decode(parameters.diskCacheDirectoryExtensionHandle))
         return false;
+#if ENABLE(SECCOMP_FILTERS)
     if (!decoder.decode(parameters.cookieStorageDirectory))
         return false;
+#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    if (!decoder.decode(parameters.uiProcessCookieStorageIdentifier))
+        return false;
+#endif
 #if PLATFORM(IOS)
     if (!decoder.decode(parameters.cookieStorageDirectoryExtensionHandle))
         return false;
index 5e39838a3dadb8747a2e38c01519c52ad05c0fed..4f3bc6ff03886edb0c40390d2920df2e89df859e 100644 (file)
@@ -74,7 +74,12 @@ struct WebProcessCreationParameters {
     SandboxExtension::Handle webSQLDatabaseDirectoryExtensionHandle;
     String diskCacheDirectory;
     SandboxExtension::Handle diskCacheDirectoryExtensionHandle;
+#if ENABLE(SECCOMP_FILTERS)
     String cookieStorageDirectory;
+#endif
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    Vector<uint8_t> uiProcessCookieStorageIdentifier;
+#endif
 #if PLATFORM(IOS)
     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
index 6f0c42f855d7d6ccd69c1d7b96bb0347323559b1..94ac1ded973dbc6cfde90c803853b85c3c7b781d 100644 (file)
@@ -30,6 +30,7 @@
 
 #import "SandboxInitializationParameters.h"
 #import "WebKitSystemInterface.h"
+#import <WebCore/CFNetworkSPI.h>
 #import <WebCore/FileSystem.h>
 #import <WebCore/SystemVersion.h>
 #import <mach/mach.h>
@@ -175,6 +176,20 @@ void ChildProcess::initializeSandbox(const ChildProcessInitializationParameters&
     }
 }
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+void ChildProcess::setSharedHTTPCookieStorage(const Vector<uint8_t>& identifier)
+{
+    // FIXME: Remove the runtime check when it's not needed (soon).
+    if (![NSHTTPCookieStorage respondsToSelector:@selector(_setSharedHTTPCookieStorage:)])
+        return;
+
+    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFDataCreate(kCFAllocatorDefault, identifier.data(), identifier.size()));
+    RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage = adoptCF(CFHTTPCookieStorageCreateFromIdentifyingData(kCFAllocatorDefault, cookieStorageData.get()));
+    [NSHTTPCookieStorage _setSharedHTTPCookieStorage:adoptNS([[NSHTTPCookieStorage alloc] _initWithCFHTTPCookieStorage:uiProcessCookieStorage.get()]).get()];
+}
+#endif
+
+
 #if USE(APPKIT)
 void ChildProcess::stopNSAppRunLoop()
 {
index 4d5c582bb5ce6b397d9575780d86bee0bf8ee7f2..ef02e7a2f401560d01894e506696ed4c9baf45ee 100644 (file)
@@ -240,6 +240,12 @@ void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters&
 #if (TARGET_OS_IPHONE && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
     parameters.networkATSContext = adoptCF(_CFNetworkCopyATSContext());
 #endif
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
+    ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
+    parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
+#endif
 }
 
 #if ENABLE(NETWORK_PROCESS)
@@ -267,6 +273,12 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
     parameters.shouldEnableNetworkCache = [defaults boolForKey:WebKitNetworkCacheEnabledDefaultsKey] && ![defaults boolForKey:WebKitNetworkCacheTemporarilyDisabledForTestingKey];
     parameters.shouldEnableNetworkCacheEfficacyLogging = [defaults boolForKey:WebKitNetworkCacheEfficacyLoggingEnabledDefaultsKey];
 #endif
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    RetainPtr<CFDataRef> cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
+    ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
+    parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
+#endif
 }
 #endif
 
@@ -283,22 +295,6 @@ String WebProcessPool::platformDefaultDiskCacheDirectory() const
     return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
 }
 
-String WebProcessPool::platformDefaultCookieStorageDirectory() const
-{
-#if PLATFORM(IOS)
-    String path = pathForProcessContainer();
-    if (path.isEmpty())
-        path = NSHomeDirectory();
-
-    path = path + "/Library/Cookies";
-    path = stringByResolvingSymlinksInPath(path);
-    return path;
-#else
-    notImplemented();
-    return [@"" stringByStandardizingPath];
-#endif
-}
-
 #if PLATFORM(IOS)
 String WebProcessPool::parentBundleDirectory() const
 {
index 8f1409464330d18a5857f1d00a0b8c0a0a1f7d84..e19b1ca588a2a17c7502b3a5ecf6ad1ac7092733 100644 (file)
@@ -411,11 +411,14 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess()
     if (!parameters.diskCacheDirectory.isEmpty())
         SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle);
 
-    parameters.cookieStorageDirectory = cookieStorageDirectory();
+#if ENABLE(SECCOMP_FILTERS)
+    parameters.cookieStorageDirectory = this->cookieStorageDirectory();
+#endif
 
 #if PLATFORM(IOS)
-    if (!parameters.cookieStorageDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(parameters.cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
+    String cookieStorageDirectory = this->cookieStorageDirectory();
+    if (!cookieStorageDirectory.isEmpty())
+        SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
 
     String containerCachesDirectory = this->networkingCachesDirectory();
     if (!containerCachesDirectory.isEmpty())
@@ -610,11 +613,14 @@ WebProcessProxy& WebProcessPool::createNewWebProcess()
     if (!parameters.diskCacheDirectory.isEmpty())
         SandboxExtension::createHandleForReadWriteDirectory(parameters.diskCacheDirectory, parameters.diskCacheDirectoryExtensionHandle);
 
-    parameters.cookieStorageDirectory = cookieStorageDirectory();
+#if ENABLE(SECCOMP_FILTERS)
+    parameters.cookieStorageDirectory = this->cookieStorageDirectory();
+#endif
 
 #if PLATFORM(IOS)
-    if (!parameters.cookieStorageDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(parameters.cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
+    String cookieStorageDirectory = this->cookieStorageDirectory();
+    if (!cookieStorageDirectory.isEmpty())
+        SandboxExtension::createHandleForReadWriteDirectory(cookieStorageDirectory, parameters.cookieStorageDirectoryExtensionHandle);
 
     String containerCachesDirectory = this->webContentCachesDirectory();
     if (!containerCachesDirectory.isEmpty())
@@ -1187,13 +1193,16 @@ String WebProcessPool::diskCacheDirectory() const
     return platformDefaultDiskCacheDirectory();
 }
 
+#if ENABLE(SECCOMP_FILTERS)
 String WebProcessPool::cookieStorageDirectory() const
 {
     if (!m_overrideCookieStorageDirectory.isEmpty())
         return m_overrideCookieStorageDirectory;
 
-    return platformDefaultCookieStorageDirectory();
+    // 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();
 }
+#endif
 
 void WebProcessPool::useTestingNetworkSession()
 {
index c88bc6c04c1e4d0409ae8867151594b729eb4a88..b60fa69e7b75f48c738da6554d5393155cc71fd3 100644 (file)
@@ -401,8 +401,9 @@ private:
     String diskCacheDirectory() const;
     String platformDefaultDiskCacheDirectory() const;
 
+#if ENABLE(SECCOMP_FILTERS)
     String cookieStorageDirectory() const;
-    String platformDefaultCookieStorageDirectory() const;
+#endif
 
 #if PLATFORM(IOS)
     String parentBundleDirectory() const;
index ae2770d8fbc19e6c98c0ec640d48aa09b3a7363f..77d9c0afe9e9a421d7b136f86e29288e77f7195b 100644 (file)
@@ -131,12 +131,6 @@ String WebProcessPool::platformDefaultDiskCacheDirectory() const
     return String::fromUTF8(efreet_cache_home_get()) + "/WebKitEfl";
 }
 
-String WebProcessPool::platformDefaultCookieStorageDirectory() const
-{
-    notImplemented();
-    return String();
-}
-
 void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
 {
     m_ignoreTLSErrors = ignoreTLSErrors;
index 0f9e0c7ff36012f7bb1bc38eb23480a760179896..04125f4e7e0d329e3587cb4c832fd1367ad7364f 100644 (file)
@@ -148,12 +148,6 @@ String WebProcessPool::platformDefaultDiskCacheDirectory() const
     return WebCore::filenameToString(diskCacheDirectory.get());
 }
 
-String WebProcessPool::platformDefaultCookieStorageDirectory() const
-{
-    notImplemented();
-    return String();
-}
-
 void WebProcessPool::setIgnoreTLSErrors(bool ignoreTLSErrors)
 {
     m_ignoreTLSErrors = ignoreTLSErrors;
index 8b3d3ead71cef9bbfa1c74e9c7f8c37ba7b75c73..0de4d19960a040c3ea75463553e0fcf646ea0885 100644 (file)
@@ -149,6 +149,10 @@ void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& par
 #endif
 #endif
 
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
+    setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
+#endif
+
     // FIXME: Most of what this function does for cache size gets immediately overridden by setCacheModel().
     // - memory cache size passed from UI process is always ignored;
     // - disk cache size passed from UI process is effectively a minimum size.
index ab74e7451c54529fa805d6d5f3ef7d4b09592baa..b4d4207e601a7febeddb59e1231d628fb21a55d9 100644 (file)
@@ -1,3 +1,15 @@
+2015-05-11  Alexey Proskuryakov  <ap@apple.com>
+
+        [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.
+
 2015-05-12  Jake Nielsen  <jacob_nielsen@apple.com>
 
         Fix internal build configuration issues
index 3f0358b0f0f0a2143777157c8d56630296810c8d..c50b44e0b35b332f9441f1b47d4e005ebdeb882d 100644 (file)
@@ -380,7 +380,6 @@ void TestController::initialize(int argc, const char* argv[])
         // FIXME: These should be migrated to WKContextConfigurationRef.
         WKContextSetApplicationCacheDirectory(m_context.get(), toWK(temporaryFolder + separator + "ApplicationCache").get());
         WKContextSetDiskCacheDirectory(m_context.get(), toWK(temporaryFolder + separator + "Cache").get());
-        WKContextSetCookieStorageDirectory(m_context.get(), toWK(temporaryFolder + separator + "Cookies").get());
         // Disable icon database to avoid fetching <http://127.0.0.1:8000/favicon.ico> and making tests flaky.
         // Invividual tests can enable it using testRunner.setIconDatabaseEnabled, although it's not currently supported in WebKitTestRunner.
         WKContextSetIconDatabasePath(m_context.get(), toWK(emptyString()).get());