Title: [204603] trunk/Source
Revision
204603
Author
[email protected]
Date
2016-08-18 11:59:20 -0700 (Thu, 18 Aug 2016)

Log Message

[Cocoa] Add SPI to WKProcessPool for enabling cookie storage partitioning
https://bugs.webkit.org/show_bug.cgi?id=160964

Reviewed by Brent Fulgham.

Source/WebCore:

* page/Settings.cpp:
(WebCore::Settings::setCookieStoragePartitioningEnabled): Deleted.
* page/Settings.h:
(WebCore::Settings::cookieStoragePartitioningEnabled): Deleted.
* platform/network/NetworkStorageSession.h:
* platform/network/cf/NetworkStorageSessionCFNet.cpp: Defined cookieStoragePartitioningEnabled.
(WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Set cookieStoragePartitioningEnabled.
(WebCore::cookieStoragePartition): Used cookieStoragePartitioningEnabled instead of Settings::cookieStoragePartitioningEnabled().

Source/WebKit2:

* NetworkProcess/NetworkProcess.h: Declared setCookieStoragePartitioningEnabled().
* NetworkProcess/NetworkProcess.messages.in: Added message SetCookieStoragePartitioningEnabled.
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode): Encoded cookieStoragePartitioningEnabled.
(WebKit::NetworkProcessCreationParameters::decode): Decoded cookieStoragePartitioningEnabled.
* NetworkProcess/NetworkProcessCreationParameters.h: Declared cookieStoragePartitioningEnabled.
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
Called NetworkStorageSession::setCookieStoragePartitioningEnabled() given the cookieStoragePartitioningEnabled parameter.
(WebKit::NetworkProcess::setCookieStoragePartitioningEnabled):
Called NetworkStorageSession::setCookieStoragePartitioningEnabled().
* UIProcess/API/Cocoa/WKProcessPool.mm:
(-[WKProcessPool cookieStoragePartitioningEnabled]): Returned WebProcessPool::cookieStoragePartitioningEnabled().
(-[WKProcessPool setCookieStoragePartitioningEnabled:]): Called WebProcessPool::setCookieStoragePartitioningEnabled().
* UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Declared cookieStoragePartitioningEnabled as a property.
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
Set the cookieStoragePartitioningEnabled parameter from m_cookieStoragePartitioningEnabled.
(WebKit::WebProcessPool::setCookieStoragePartitioningEnabled):
Set m_cookieStoragePartitioningEnabled and sent the NetworkProcess::SetCookieStoragePartitioningEnabled message.
* UIProcess/WebProcessPool.h: Declared cookieStoragePartitioningEnabled.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (204602 => 204603)


--- trunk/Source/WebCore/ChangeLog	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebCore/ChangeLog	2016-08-18 18:59:20 UTC (rev 204603)
@@ -1,3 +1,19 @@
+2016-08-18  Andy Estes  <[email protected]>
+
+        [Cocoa] Add SPI to WKProcessPool for enabling cookie storage partitioning
+        https://bugs.webkit.org/show_bug.cgi?id=160964
+
+        Reviewed by Brent Fulgham.
+
+        * page/Settings.cpp:
+        (WebCore::Settings::setCookieStoragePartitioningEnabled): Deleted.
+        * page/Settings.h:
+        (WebCore::Settings::cookieStoragePartitioningEnabled): Deleted.
+        * platform/network/NetworkStorageSession.h:
+        * platform/network/cf/NetworkStorageSessionCFNet.cpp: Defined cookieStoragePartitioningEnabled.
+        (WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled): Set cookieStoragePartitioningEnabled.
+        (WebCore::cookieStoragePartition): Used cookieStoragePartitioningEnabled instead of Settings::cookieStoragePartitioningEnabled().
+
 2016-08-18  Eric Carlson  <[email protected]>
 
         AX: Audio Description tracks are not labeled correctly, causing user confusion

Modified: trunk/Source/WebCore/page/Settings.cpp (204602 => 204603)


--- trunk/Source/WebCore/page/Settings.cpp	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebCore/page/Settings.cpp	2016-08-18 18:59:20 UTC (rev 204603)
@@ -83,7 +83,6 @@
 
 #if PLATFORM(COCOA)
 bool Settings::gQTKitEnabled = false;
-bool Settings::gCookieStoragePartitioningEnabled = false;
 #endif
 
 bool Settings::gMockScrollbarsEnabled = false;
@@ -598,11 +597,6 @@
     gQTKitEnabled = enabled;
     HTMLMediaElement::resetMediaEngines();
 }
-    
-void Settings::setCookieStoragePartitioningEnabled(bool enabled)
-{
-    gCookieStoragePartitioningEnabled = enabled;
-}
 #endif
 
 #if ENABLE(MEDIA_STREAM)

Modified: trunk/Source/WebCore/page/Settings.h (204602 => 204603)


--- trunk/Source/WebCore/page/Settings.h	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebCore/page/Settings.h	2016-08-18 18:59:20 UTC (rev 204603)
@@ -24,8 +24,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#ifndef Settings_h
-#define Settings_h
+#pragma once
 
 #include "ClipboardAccessPolicy.h"
 #include "EditingBehaviorTypes.h"
@@ -206,9 +205,6 @@
 #if PLATFORM(COCOA)
     WEBCORE_EXPORT static void setQTKitEnabled(bool flag);
     static bool isQTKitEnabled() { return gQTKitEnabled; }
-
-    WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool flag);
-    static bool cookieStoragePartitioningEnabled() { return gCookieStoragePartitioningEnabled; }
 #else
     static bool isQTKitEnabled() { return false; }
 #endif
@@ -371,7 +367,6 @@
 
 #if PLATFORM(COCOA)
     WEBCORE_EXPORT static bool gQTKitEnabled;
-    static bool gCookieStoragePartitioningEnabled;
 #endif
 
     static bool gMockScrollbarsEnabled;
@@ -409,5 +404,3 @@
 };
 
 } // namespace WebCore
-
-#endif

Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (204602 => 204603)


--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h	2016-08-18 18:59:20 UTC (rev 204603)
@@ -60,6 +60,7 @@
     // May be null, in which case a Foundation default should be used.
     CFURLStorageSessionRef platformSession() { return m_platformSession.get(); }
     WEBCORE_EXPORT RetainPtr<CFHTTPCookieStorageRef> cookieStorage() const;
+    WEBCORE_EXPORT static void setCookieStoragePartitioningEnabled(bool);
 #elif USE(SOUP)
     NetworkStorageSession(SessionID, std::unique_ptr<SoupNetworkSession>);
     ~NetworkStorageSession();

Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (204602 => 204603)


--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp	2016-08-18 18:59:20 UTC (rev 204603)
@@ -33,7 +33,6 @@
 #if PLATFORM(COCOA)
 #include "PublicSuffix.h"
 #include "ResourceRequest.h"
-#include "Settings.h"
 #include "WebCoreSystemInterface.h"
 #else
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -41,6 +40,8 @@
 
 namespace WebCore {
 
+static bool cookieStoragePartitioningEnabled;
+
 NetworkStorageSession::NetworkStorageSession(SessionID sessionID, RetainPtr<CFURLStorageSessionRef> platformSession)
     : m_sessionID(sessionID)
     , m_platformSession(platformSession)
@@ -100,6 +101,11 @@
 #endif
 }
 
+void NetworkStorageSession::setCookieStoragePartitioningEnabled(bool enabled)
+{
+    cookieStoragePartitioningEnabled = enabled;
+}
+
 #if PLATFORM(COCOA)
 
 String cookieStoragePartition(const ResourceRequest& request)
@@ -119,7 +125,7 @@
 
 String cookieStoragePartition(const URL& firstPartyForCookies, const URL& resource)
 {
-    if (!Settings::cookieStoragePartitioningEnabled())
+    if (!cookieStoragePartitioningEnabled)
         return emptyString();
 
     String firstPartyDomain = firstPartyForCookies.host();

Modified: trunk/Source/WebKit2/ChangeLog (204602 => 204603)


--- trunk/Source/WebKit2/ChangeLog	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/ChangeLog	2016-08-18 18:59:20 UTC (rev 204603)
@@ -1,3 +1,32 @@
+2016-08-18  Andy Estes  <[email protected]>
+
+        [Cocoa] Add SPI to WKProcessPool for enabling cookie storage partitioning
+        https://bugs.webkit.org/show_bug.cgi?id=160964
+
+        Reviewed by Brent Fulgham.
+
+        * NetworkProcess/NetworkProcess.h: Declared setCookieStoragePartitioningEnabled().
+        * NetworkProcess/NetworkProcess.messages.in: Added message SetCookieStoragePartitioningEnabled.
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode): Encoded cookieStoragePartitioningEnabled.
+        (WebKit::NetworkProcessCreationParameters::decode): Decoded cookieStoragePartitioningEnabled.
+        * NetworkProcess/NetworkProcessCreationParameters.h: Declared cookieStoragePartitioningEnabled.
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformInitializeNetworkProcessCocoa):
+        Called NetworkStorageSession::setCookieStoragePartitioningEnabled() given the cookieStoragePartitioningEnabled parameter.
+        (WebKit::NetworkProcess::setCookieStoragePartitioningEnabled):
+        Called NetworkStorageSession::setCookieStoragePartitioningEnabled().
+        * UIProcess/API/Cocoa/WKProcessPool.mm:
+        (-[WKProcessPool cookieStoragePartitioningEnabled]): Returned WebProcessPool::cookieStoragePartitioningEnabled().
+        (-[WKProcessPool setCookieStoragePartitioningEnabled:]): Called WebProcessPool::setCookieStoragePartitioningEnabled().
+        * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: Declared cookieStoragePartitioningEnabled as a property.
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        Set the cookieStoragePartitioningEnabled parameter from m_cookieStoragePartitioningEnabled.
+        (WebKit::WebProcessPool::setCookieStoragePartitioningEnabled):
+        Set m_cookieStoragePartitioningEnabled and sent the NetworkProcess::SetCookieStoragePartitioningEnabled message.
+        * UIProcess/WebProcessPool.h: Declared cookieStoragePartitioningEnabled.
+
 2016-08-17  Anders Carlsson  <[email protected]>
 
         Add support for additional networks

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (204602 => 204603)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h	2016-08-18 18:59:20 UTC (rev 204603)
@@ -218,6 +218,7 @@
 
 #if PLATFORM(COCOA)
     void platformInitializeNetworkProcessCocoa(const NetworkProcessCreationParameters&);
+    void setCookieStoragePartitioningEnabled(bool);
 
     // FIXME: We'd like to be able to do this without the #ifdef, but WorkQueue + BinarySemaphore isn't good enough since
     // multiple requests to clear the cache can come in before previous requests complete, and we need to wait for all of them.

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in (204602 => 204603)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.messages.in	2016-08-18 18:59:20 UTC (rev 204603)
@@ -57,6 +57,7 @@
     SetProcessSuppressionEnabled(bool flag)
 #if PLATFORM(COCOA)
     SetQOS(int latencyQOS, int throughputQOS)
+    SetCookieStoragePartitioningEnabled(bool enabled)
 #endif
 
     AllowSpecificHTTPSCertificateForHost(WebCore::CertificateInfo certificate, String host)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp (204602 => 204603)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp	2016-08-18 18:59:20 UTC (rev 204603)
@@ -74,6 +74,7 @@
 #if TARGET_OS_IPHONE || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
     IPC::encode(encoder, networkATSContext.get());
 #endif
+    encoder << cookieStoragePartitioningEnabled;
 #endif
 #if USE(SOUP)
     encoder << cookiePersistentStoragePath;
@@ -146,6 +147,8 @@
     if (!IPC::decode(decoder, result.networkATSContext))
         return false;
 #endif
+    if (!decoder.decode(result.cookieStoragePartitioningEnabled))
+        return false;
 #endif
 
 #if USE(SOUP)

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h (204602 => 204603)


--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h	2016-08-18 18:59:20 UTC (rev 204603)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef NetworkProcessCreationParameters_h
-#define NetworkProcessCreationParameters_h
+#pragma once
 
 #include "Attachment.h"
 #include "CacheModel.h"
@@ -87,6 +86,7 @@
 #if TARGET_OS_IPHONE || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
     RetainPtr<CFDataRef> networkATSContext;
 #endif
+    bool cookieStoragePartitioningEnabled;
 #endif
 
 #if USE(SOUP)
@@ -103,5 +103,3 @@
 };
 
 } // namespace WebKit
-
-#endif // NetworkProcessCreationParameters_h

Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm (204602 => 204603)


--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2016-08-18 18:59:20 UTC (rev 204603)
@@ -86,6 +86,8 @@
     setSharedHTTPCookieStorage(parameters.uiProcessCookieStorageIdentifier);
 #endif
 
+    WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled(parameters.cookieStoragePartitioningEnabled);
+
     // 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.
@@ -235,4 +237,9 @@
 #endif
 }
 
+void NetworkProcess::setCookieStoragePartitioningEnabled(bool enabled)
+{
+    WebCore::NetworkStorageSession::setCookieStoragePartitioningEnabled(enabled);
 }
+
+}

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm (204602 => 204603)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPool.mm	2016-08-18 18:59:20 UTC (rev 204603)
@@ -290,6 +290,16 @@
     _processPool->terminateDatabaseProcess();
 }
 
+- (BOOL)cookieStoragePartitioningEnabled
+{
+    return _processPool->cookieStoragePartitioningEnabled();
+}
+
+- (void)setCookieStoragePartitioningEnabled:(BOOL)enabled
+{
+    _processPool->setCookieStoragePartitioningEnabled(enabled);
+}
+
 @end
 
 #endif // WK_API_ENABLED

Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h (204602 => 204603)


--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKProcessPoolPrivate.h	2016-08-18 18:59:20 UTC (rev 204603)
@@ -64,6 +64,8 @@
 // Test only. Should be called only while no web content processes are running.
 - (void)_terminateDatabaseProcess;
 
+@property (nonatomic) BOOL cookieStoragePartitioningEnabled WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 @end
 
 #endif

Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (204602 => 204603)


--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2016-08-18 18:59:20 UTC (rev 204603)
@@ -27,6 +27,7 @@
 #import "WebProcessPool.h"
 
 #import "NetworkProcessCreationParameters.h"
+#import "NetworkProcessMessages.h"
 #import "NetworkProcessProxy.h"
 #import "PluginProcessManager.h"
 #import "SandboxUtilities.h"
@@ -247,6 +248,8 @@
     ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
     parameters.uiProcessCookieStorageIdentifier.append(CFDataGetBytePtr(cookieStorageData.get()), CFDataGetLength(cookieStorageData.get()));
 #endif
+
+    parameters.cookieStoragePartitioningEnabled = cookieStoragePartitioningEnabled();
 }
 
 void WebProcessPool::platformInvalidateContext()
@@ -516,6 +519,12 @@
 #endif
 }
 
+void WebProcessPool::setCookieStoragePartitioningEnabled(bool enabled)
+{
+    m_cookieStoragePartitioningEnabled = enabled;
+    sendToNetworkingProcess(Messages::NetworkProcess::SetCookieStoragePartitioningEnabled(enabled));
+}
+
 int networkProcessLatencyQOS()
 {
     static const int qos = [[NSUserDefaults standardUserDefaults] integerForKey:@"WebKitNetworkProcessLatencyQOS"];

Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (204602 => 204603)


--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2016-08-18 18:06:45 UTC (rev 204602)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h	2016-08-18 18:59:20 UTC (rev 204603)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef WebProcessPool_h
-#define WebProcessPool_h
+#pragma once
 
 #include "APIDictionary.h"
 #include "APIObject.h"
@@ -374,6 +373,11 @@
     void setInitialConnectedGamepads(const Vector<std::unique_ptr<UIGamepad>>&);
 #endif
 
+#if PLATFORM(COCOA)
+    bool cookieStoragePartitioningEnabled() const { return m_cookieStoragePartitioningEnabled; }
+    void setCookieStoragePartitioningEnabled(bool);
+#endif
+
 private:
     void platformInitialize();
 
@@ -550,6 +554,10 @@
 #if ENABLE(GAMEPAD)
     HashSet<WebProcessProxy*> m_processesUsingGamepads;
 #endif
+
+#if PLATFORM(COCOA)
+    bool m_cookieStoragePartitioningEnabled { false };
+#endif
 };
 
 template<typename T>
@@ -618,5 +626,3 @@
 }
 
 } // namespace WebKit
-
-#endif // UIProcessPool_h
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to