Title: [229426] trunk/Source/WebKit
Revision
229426
Author
bfulg...@apple.com
Date
2018-03-08 12:43:34 -0800 (Thu, 08 Mar 2018)

Log Message

Remove WebCookieManager and messaging from WebContent process.
https://bugs.webkit.org/show_bug.cgi?id=183382
<rdar://problem/38191450>

Reviewed by Alex Christensen.

Networking access was fully removed from the WebContent process in Bug 183192 (and related bugs). The
UIProcess no longer needs to ask the WebContent process about networking-related things, and shouldn't
waste everyone's time doing so.

This bug removes some left-over WebCookieManager API stuff, and is a first step in purging the
WebContent Process from accessing cookie data.

* NetworkProcess/Cookies: Copied from WebProcess/Cookies.
* NetworkProcess/Cookies/WebCookieManager.h:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/Cookies: Removed.
* WebProcess/Cookies/WebCookieManager.cpp: Removed.
* WebProcess/Cookies/WebCookieManager.h: Removed.
* WebProcess/Cookies/WebCookieManager.messages.in: Removed.
* WebProcess/Cookies/curl: Removed.
* WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Removed.
* WebProcess/Cookies/mac: Removed.
* WebProcess/Cookies/mac/WebCookieManagerMac.mm: Removed.
* WebProcess/Cookies/soup: Removed.
* WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Removed.
* WebProcess/InjectedBundle/InjectedBundle.cpp: Remove 'WebCookieManager.h" header.
* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Ditto.
* WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: Ditto.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::WebProcess): Remove call to add WebCookieManager as a
WebProcessSupplement.
* CMakeLists.txt: Revised paths.
* DerivedSources.make: Ditto.
* PlatformMac.cmake: Ditto.
* PlatformWin.cmake: Ditto.
* SourcesGTK.txt: Ditto.
* SourcesWPE.txt: Ditto.

Modified Paths

Added Paths

Removed Paths

  • trunk/Source/WebKit/WebProcess/Cookies/

Diff

Modified: trunk/Source/WebKit/CMakeLists.txt (229425 => 229426)


--- trunk/Source/WebKit/CMakeLists.txt	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/CMakeLists.txt	2018-03-08 20:43:34 UTC (rev 229426)
@@ -5,6 +5,7 @@
 set(WebKit_INCLUDE_DIRECTORIES
     "${WEBKIT_DIR}"
     "${WEBKIT_DIR}/NetworkProcess"
+    "${WEBKIT_DIR}/NetworkProcess/Cookies"
     "${WEBKIT_DIR}/NetworkProcess/CustomProtocols"
     "${WEBKIT_DIR}/NetworkProcess/Downloads"
     "${WEBKIT_DIR}/NetworkProcess/FileAPI"
@@ -56,7 +57,6 @@
     "${WEBKIT_DIR}/WebProcess/ApplicationCache"
     "${WEBKIT_DIR}/WebProcess/Automation"
     "${WEBKIT_DIR}/WebProcess/Cache"
-    "${WEBKIT_DIR}/WebProcess/Cookies"
     "${WEBKIT_DIR}/WebProcess/Databases"
     "${WEBKIT_DIR}/WebProcess/Databases/IndexedDB"
     "${WEBKIT_DIR}/WebProcess/FileAPI"
@@ -97,6 +97,9 @@
 )
 
 set(WebKit_SOURCES
+    NetworkProcess/Cookies/WebCookieManager.cpp
+    NetworkProcess/Cookies/WebCookieManager.messages.in
+
     NetworkProcess/Downloads/Download.cpp
     NetworkProcess/Downloads/DownloadManager.cpp
     NetworkProcess/Downloads/PendingDownload.cpp
@@ -463,8 +466,6 @@
     WebProcess/Cache/WebCacheStorageConnection.cpp
     WebProcess/Cache/WebCacheStorageProvider.cpp
 
-    WebProcess/Cookies/WebCookieManager.cpp
-
     WebProcess/Databases/WebDatabaseProvider.cpp
 
     WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.cpp
@@ -668,8 +669,6 @@
 
     WebProcess/Cache/WebCacheStorageConnection.messages.in
 
-    WebProcess/Cookies/WebCookieManager.messages.in
-
     WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in
 
     WebProcess/FullScreen/WebFullScreenManager.messages.in

Modified: trunk/Source/WebKit/ChangeLog (229425 => 229426)


--- trunk/Source/WebKit/ChangeLog	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/ChangeLog	2018-03-08 20:43:34 UTC (rev 229426)
@@ -1,3 +1,44 @@
+2018-03-08  Brent Fulgham  <bfulg...@apple.com>
+
+        Remove WebCookieManager and messaging from WebContent process.
+        https://bugs.webkit.org/show_bug.cgi?id=183382
+        <rdar://problem/38191450>
+
+        Reviewed by Alex Christensen.
+
+        Networking access was fully removed from the WebContent process in Bug 183192 (and related bugs). The
+        UIProcess no longer needs to ask the WebContent process about networking-related things, and shouldn't
+        waste everyone's time doing so.
+
+        This bug removes some left-over WebCookieManager API stuff, and is a first step in purging the
+        WebContent Process from accessing cookie data.
+
+        * NetworkProcess/Cookies: Copied from WebProcess/Cookies.
+        * NetworkProcess/Cookies/WebCookieManager.h:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/Cookies: Removed.
+        * WebProcess/Cookies/WebCookieManager.cpp: Removed.
+        * WebProcess/Cookies/WebCookieManager.h: Removed.
+        * WebProcess/Cookies/WebCookieManager.messages.in: Removed.
+        * WebProcess/Cookies/curl: Removed.
+        * WebProcess/Cookies/curl/WebCookieManagerCurl.cpp: Removed.
+        * WebProcess/Cookies/mac: Removed.
+        * WebProcess/Cookies/mac/WebCookieManagerMac.mm: Removed.
+        * WebProcess/Cookies/soup: Removed.
+        * WebProcess/Cookies/soup/WebCookieManagerSoup.cpp: Removed.
+        * WebProcess/InjectedBundle/InjectedBundle.cpp: Remove 'WebCookieManager.h" header.
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp: Ditto.
+        * WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm: Ditto.
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::WebProcess): Remove call to add WebCookieManager as a
+        WebProcessSupplement.
+        * CMakeLists.txt: Revised paths.
+        * DerivedSources.make: Ditto.
+        * PlatformMac.cmake: Ditto.
+        * PlatformWin.cmake: Ditto.
+        * SourcesGTK.txt: Ditto.
+        * SourcesWPE.txt: Ditto.
+
 2018-03-08  Youenn Fablet  <you...@apple.com>
 
         libwebrtc update broke internal builds

Modified: trunk/Source/WebKit/DerivedSources.make (229425 => 229426)


--- trunk/Source/WebKit/DerivedSources.make	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/DerivedSources.make	2018-03-08 20:43:34 UTC (rev 229426)
@@ -23,6 +23,7 @@
 VPATH = \
     $(WebKit2) \
     $(WebKit2)/NetworkProcess \
+    $(WebKit2)/NetworkProcess/Cookies \
     $(WebKit2)/NetworkProcess/cache \
     $(WebKit2)/NetworkProcess/CustomProtocols \
     $(WebKit2)/NetworkProcess/mac \
@@ -42,7 +43,6 @@
     $(WebKit2)/WebProcess/ApplicationCache \
     $(WebKit2)/WebProcess/Automation \
     $(WebKit2)/WebProcess/Cache \
-    $(WebKit2)/WebProcess/Cookies \
     $(WebKit2)/WebProcess/CredentialManagement \
     $(WebKit2)/WebProcess/Databases/IndexedDB \
     $(WebKit2)/WebProcess/FullScreen \

Copied: trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp (from rev 229425, trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.cpp) (0 => 229426)


--- trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.cpp	2018-03-08 20:43:34 UTC (rev 229426)
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2011, 2013 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 "config.h"
+#include "WebCookieManager.h"
+
+#include "ChildProcess.h"
+#include "WebCookieManagerMessages.h"
+#include "WebCookieManagerProxyMessages.h"
+#include "WebCoreArgumentCoders.h"
+#include <WebCore/Cookie.h>
+#include <WebCore/CookieStorage.h>
+#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/PlatformCookieJar.h>
+#include <WebCore/URL.h>
+#include <wtf/MainThread.h>
+#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+const char* WebCookieManager::supplementName()
+{
+    return "WebCookieManager";
+}
+
+WebCookieManager::WebCookieManager(ChildProcess& process)
+    : m_process(process)
+{
+    m_process.addMessageReceiver(Messages::WebCookieManager::messageReceiverName(), *this);
+}
+
+WebCookieManager::~WebCookieManager() = default;
+
+void WebCookieManager::getHostnamesWithCookies(PAL::SessionID sessionID, CallbackID callbackID)
+{
+    HashSet<String> hostnames;
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        WebCore::getHostnamesWithCookies(*storageSession, hostnames);
+
+    m_process.send(Messages::WebCookieManagerProxy::DidGetHostnamesWithCookies(copyToVector(hostnames), callbackID), 0);
+}
+
+void WebCookieManager::deleteCookiesForHostname(PAL::SessionID sessionID, const String& hostname)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        WebCore::deleteCookiesForHostnames(*storageSession, { hostname });
+}
+
+
+void WebCookieManager::deleteAllCookies(PAL::SessionID sessionID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        WebCore::deleteAllCookies(*storageSession);
+}
+
+void WebCookieManager::deleteCookie(PAL::SessionID sessionID, const Cookie& cookie, CallbackID callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        storageSession->deleteCookie(cookie);
+
+    m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+}
+
+void WebCookieManager::deleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, CallbackID callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        WebCore::deleteAllCookiesModifiedSince(*storageSession, time);
+
+    m_process.send(Messages::WebCookieManagerProxy::DidDeleteCookies(callbackID), 0);
+}
+
+void WebCookieManager::getAllCookies(PAL::SessionID sessionID, CallbackID callbackID)
+{
+    Vector<Cookie> cookies;
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        cookies = storageSession->getAllCookies();
+
+    m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+}
+
+void WebCookieManager::getCookies(PAL::SessionID sessionID, const URL& url, CallbackID callbackID)
+{
+    Vector<Cookie> cookies;
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        cookies = storageSession->getCookies(url);
+
+    m_process.send(Messages::WebCookieManagerProxy::DidGetCookies(cookies, callbackID), 0);
+}
+
+void WebCookieManager::setCookie(PAL::SessionID sessionID, const Cookie& cookie, CallbackID callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        storageSession->setCookie(cookie);
+
+    m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+}
+
+void WebCookieManager::setCookies(PAL::SessionID sessionID, const Vector<Cookie>& cookies, const URL& url, const URL& mainDocumentURL, CallbackID callbackID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        storageSession->setCookies(cookies, url, mainDocumentURL);
+
+    m_process.send(Messages::WebCookieManagerProxy::DidSetCookies(callbackID), 0);
+}
+
+void WebCookieManager::notifyCookiesDidChange(PAL::SessionID sessionID)
+{
+    ASSERT(RunLoop::isMain());
+    m_process.send(Messages::WebCookieManagerProxy::CookiesDidChange(sessionID), 0);
+}
+
+void WebCookieManager::startObservingCookieChanges(PAL::SessionID sessionID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID)) {
+        WebCore::startObservingCookieChanges(*storageSession, [this, sessionID] {
+            notifyCookiesDidChange(sessionID);
+        });
+    }
+}
+
+void WebCookieManager::stopObservingCookieChanges(PAL::SessionID sessionID)
+{
+    if (auto* storageSession = NetworkStorageSession::storageSession(sessionID))
+        WebCore::stopObservingCookieChanges(*storageSession);
+}
+
+void WebCookieManager::setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy, OptionalCallbackID callbackID)
+{
+    platformSetHTTPCookieAcceptPolicy(policy);
+
+    if (callbackID)
+        m_process.send(Messages::WebCookieManagerProxy::DidSetHTTPCookieAcceptPolicy(callbackID.callbackID()), 0);
+}
+
+void WebCookieManager::getHTTPCookieAcceptPolicy(CallbackID callbackID)
+{
+    m_process.send(Messages::WebCookieManagerProxy::DidGetHTTPCookieAcceptPolicy(platformGetHTTPCookieAcceptPolicy(), callbackID), 0);
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h (from rev 229425, trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.h) (0 => 229426)


--- trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.h	2018-03-08 20:43:34 UTC (rev 229426)
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2011-2018 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 "CallbackID.h"
+#include "HTTPCookieAcceptPolicy.h"
+#include "MessageReceiver.h"
+#include "NetworkProcessSupplement.h"
+#include "OptionalCallbackID.h"
+#include <pal/SessionID.h>
+#include <stdint.h>
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+
+#if USE(SOUP)
+#include "SoupCookiePersistentStorageType.h"
+#endif
+
+namespace WebCore {
+class URL;
+struct Cookie;
+}
+
+namespace WebKit {
+
+class ChildProcess;
+
+class WebCookieManager : public NetworkProcessSupplement, public IPC::MessageReceiver {
+    WTF_MAKE_NONCOPYABLE(WebCookieManager);
+public:
+    WebCookieManager(ChildProcess&);
+    ~WebCookieManager();
+
+    static const char* supplementName();
+
+    void setHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy, OptionalCallbackID);
+
+#if USE(SOUP)
+    void setCookiePersistentStorage(const String& storagePath, uint32_t storageType);
+#elif USE(CURL)
+    void setCookiePersistentStorage(const String& storagePath);
+#endif
+
+    void notifyCookiesDidChange(PAL::SessionID);
+
+private:
+    // IPC::MessageReceiver
+    void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
+
+    void getHostnamesWithCookies(PAL::SessionID, CallbackID);
+
+    void deleteCookie(PAL::SessionID, const WebCore::Cookie&, CallbackID);
+    void deleteCookiesForHostname(PAL::SessionID, const String&);
+    void deleteAllCookies(PAL::SessionID);
+    void deleteAllCookiesModifiedSince(PAL::SessionID, WallTime, CallbackID);
+
+    void setCookie(PAL::SessionID, const WebCore::Cookie&, CallbackID);
+    void setCookies(PAL::SessionID, const Vector<WebCore::Cookie>&, const WebCore::URL&, const WebCore::URL& mainDocumentURL, CallbackID);
+    void getAllCookies(PAL::SessionID, CallbackID);
+    void getCookies(PAL::SessionID, const WebCore::URL&, CallbackID);
+
+    void platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy);
+    void getHTTPCookieAcceptPolicy(CallbackID);
+    HTTPCookieAcceptPolicy platformGetHTTPCookieAcceptPolicy();
+
+    void startObservingCookieChanges(PAL::SessionID);
+    void stopObservingCookieChanges(PAL::SessionID);
+
+    ChildProcess& m_process;
+};
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.messages.in (from rev 229425, trunk/Source/WebKit/WebProcess/Cookies/WebCookieManager.messages.in) (0 => 229426)


--- trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.messages.in	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/WebCookieManager.messages.in	2018-03-08 20:43:34 UTC (rev 229426)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2011, 2016 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.
+ */
+ 
+ messages -> WebCookieManager {
+    void GetHostnamesWithCookies(PAL::SessionID sessionID, WebKit::CallbackID callbackID)
+    void DeleteCookiesForHostname(PAL::SessionID sessionID, String hostname)
+    void DeleteAllCookies(PAL::SessionID sessionID)
+
+    void SetCookie(PAL::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
+    void SetCookies(PAL::SessionID sessionID, Vector<WebCore::Cookie> cookies, WebCore::URL url, WebCore::URL mainDocumentURL, WebKit::CallbackID callbackID)
+    void GetAllCookies(PAL::SessionID sessionID, WebKit::CallbackID callbackID)
+    void GetCookies(PAL::SessionID sessionID, WebCore::URL url, WebKit::CallbackID callbackID)
+    void DeleteCookie(PAL::SessionID sessionID, struct WebCore::Cookie cookie, WebKit::CallbackID callbackID)
+    void DeleteAllCookiesModifiedSince(PAL::SessionID sessionID, WallTime time, WebKit::CallbackID callbackID)
+
+    void SetHTTPCookieAcceptPolicy(uint32_t policy, WebKit::OptionalCallbackID callbackID)
+    void GetHTTPCookieAcceptPolicy(WebKit::CallbackID callbackID)
+    
+    void StartObservingCookieChanges(PAL::SessionID sessionID)
+    void StopObservingCookieChanges(PAL::SessionID sessionID)
+
+#if USE(SOUP)
+    SetCookiePersistentStorage(String storagePath, uint32_t storageType)
+#endif
+}

Copied: trunk/Source/WebKit/NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp (from rev 229425, trunk/Source/WebKit/WebProcess/Cookies/curl/WebCookieManagerCurl.cpp) (0 => 229426)


--- trunk/Source/WebKit/NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp	2018-03-08 20:43:34 UTC (rev 229426)
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2017 Sony Interactive Entertainment Inc.
+ *
+ * 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 "config.h"
+#include "WebCookieManager.h"
+
+#include "ChildProcess.h"
+#include <WebCore/CookieJarDB.h>
+#include <WebCore/NetworkStorageSession.h>
+#include <wtf/text/CString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy)
+{
+}
+
+HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
+{
+    return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+}
+
+void WebCookieManager::setCookiePersistentStorage(const String& storagePath)
+{
+    auto& storageSession = NetworkStorageSession::defaultStorageSession();
+    storageSession.setCookieDatabase(makeUniqueRef<CookieJarDB>(storagePath));
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm (from rev 229425, trunk/Source/WebKit/WebProcess/Cookies/mac/WebCookieManagerMac.mm) (0 => 229426)


--- trunk/Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/mac/WebCookieManagerMac.mm	2018-03-08 20:43:34 UTC (rev 229426)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 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 "config.h"
+#import "WebCookieManager.h"
+
+#import "WebFrameNetworkingContext.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
+{
+    WebFrameNetworkingContext::setCookieAcceptPolicyForAllContexts(policy);
+}
+
+HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
+{
+    return [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
+}
+
+} // namespace WebKit

Copied: trunk/Source/WebKit/NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp (from rev 229425, trunk/Source/WebKit/WebProcess/Cookies/soup/WebCookieManagerSoup.cpp) (0 => 229426)


--- trunk/Source/WebKit/NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp	                        (rev 0)
+++ trunk/Source/WebKit/NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp	2018-03-08 20:43:34 UTC (rev 229426)
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2011 Samsung Electronics.
+ *
+ * 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 "config.h"
+#include "WebCookieManager.h"
+
+#include "ChildProcess.h"
+#include <WebCore/NetworkStorageSession.h>
+#include <WebCore/SoupNetworkSession.h>
+#include <libsoup/soup.h>
+#include <wtf/glib/GRefPtr.h>
+#include <wtf/text/CString.h>
+
+namespace WebKit {
+using namespace WebCore;
+
+void WebCookieManager::platformSetHTTPCookieAcceptPolicy(HTTPCookieAcceptPolicy policy)
+{
+    SoupCookieJarAcceptPolicy soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
+    switch (policy) {
+    case HTTPCookieAcceptPolicyAlways:
+        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_ALWAYS;
+        break;
+    case HTTPCookieAcceptPolicyNever:
+        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NEVER;
+        break;
+    case HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
+        soupPolicy = SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY;
+        break;
+    }
+
+    NetworkStorageSession::forEach([soupPolicy] (const NetworkStorageSession& session) {
+        soup_cookie_jar_set_accept_policy(session.cookieStorage(), soupPolicy);
+    });
+}
+
+HTTPCookieAcceptPolicy WebCookieManager::platformGetHTTPCookieAcceptPolicy()
+{
+    switch (soup_cookie_jar_get_accept_policy(NetworkStorageSession::defaultStorageSession().cookieStorage())) {
+    case SOUP_COOKIE_JAR_ACCEPT_ALWAYS:
+        return HTTPCookieAcceptPolicyAlways;
+    case SOUP_COOKIE_JAR_ACCEPT_NEVER:
+        return HTTPCookieAcceptPolicyNever;
+    case SOUP_COOKIE_JAR_ACCEPT_NO_THIRD_PARTY:
+        return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+    }
+
+    ASSERT_NOT_REACHED();
+    return HTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
+}
+
+void WebCookieManager::setCookiePersistentStorage(const String& storagePath, uint32_t storageType)
+{
+    GRefPtr<SoupCookieJar> jar;
+    switch (storageType) {
+    case SoupCookiePersistentStorageText:
+        jar = adoptGRef(soup_cookie_jar_text_new(storagePath.utf8().data(), FALSE));
+        break;
+    case SoupCookiePersistentStorageSQLite:
+        jar = adoptGRef(soup_cookie_jar_db_new(storagePath.utf8().data(), FALSE));
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    auto& storageSession = NetworkStorageSession::defaultStorageSession();
+    soup_cookie_jar_set_accept_policy(jar.get(), soup_cookie_jar_get_accept_policy(storageSession.cookieStorage()));
+    storageSession.setCookieStorage(jar.get());
+}
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/PlatformMac.cmake (229425 => 229426)


--- trunk/Source/WebKit/PlatformMac.cmake	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/PlatformMac.cmake	2018-03-08 20:43:34 UTC (rev 229426)
@@ -19,6 +19,8 @@
 endif ()
 
 list(APPEND WebKit_SOURCES
+    NetworkProcess/Cookies/mac/WebCookieManagerMac.mm
+
     NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
 
     NetworkProcess/CustomProtocols/Cocoa/LegacyCustomProtocolManagerCocoa.mm
@@ -319,8 +321,6 @@
     UIProcess/mac/WebProcessProxyMac.mm
     UIProcess/mac/WindowServerConnection.mm
 
-    WebProcess/Cookies/mac/WebCookieManagerMac.mm
-
     WebProcess/InjectedBundle/API/Cocoa/WKWebProcessBundleParameters.mm
     WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInFrame.mm
     WebProcess/InjectedBundle/API/Cocoa/WKWebProcessPlugInHitTestResult.mm

Modified: trunk/Source/WebKit/PlatformWin.cmake (229425 => 229426)


--- trunk/Source/WebKit/PlatformWin.cmake	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/PlatformWin.cmake	2018-03-08 20:43:34 UTC (rev 229426)
@@ -107,6 +107,8 @@
     add_definitions(-DUSE_CAIRO=1 -DUSE_CURL=1)
 
     list(APPEND WebKit_SOURCES
+        NetworkProcess/Cookies/curl/WebCookieManagerCurl.cpp
+
         NetworkProcess/cache/NetworkCacheCodersCurl.cpp
         NetworkProcess/cache/NetworkCacheDataCurl.cpp
         NetworkProcess/cache/NetworkCacheIOChannelCurl.cpp
@@ -118,8 +120,6 @@
 
         Shared/curl/WebCoreArgumentCodersCurl.cpp
 
-        WebProcess/Cookies/curl/WebCookieManagerCurl.cpp
-
         WebProcess/WebCoreSupport/curl/WebFrameNetworkingContext.cpp
     )
 

Modified: trunk/Source/WebKit/SourcesGTK.txt (229425 => 229426)


--- trunk/Source/WebKit/SourcesGTK.txt	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/SourcesGTK.txt	2018-03-08 20:43:34 UTC (rev 229426)
@@ -25,6 +25,8 @@
 // linking PluginProcessGTK2. I don't know why this is necessary. These
 // annotations should be revisited after removing PluginProcessGTK2.
 
+NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp
+
 NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
 
 NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
@@ -237,8 +239,6 @@
 UIProcess/soup/WebCookieManagerProxySoup.cpp
 UIProcess/soup/WebProcessPoolSoup.cpp
 
-WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
-
 WebProcess/InjectedBundle/glib/InjectedBundleGlib.cpp
 
 WebProcess/MediaCache/WebMediaKeyStorageManager.cpp

Modified: trunk/Source/WebKit/SourcesWPE.txt (229425 => 229426)


--- trunk/Source/WebKit/SourcesWPE.txt	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/SourcesWPE.txt	2018-03-08 20:43:34 UTC (rev 229426)
@@ -21,6 +21,8 @@
 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 // THE POSSIBILITY OF SUCH DAMAGE.
 
+NetworkProcess/Cookies/soup/WebCookieManagerSoup.cpp
+
 NetworkProcess/CustomProtocols/LegacyCustomProtocolManager.cpp
 
 NetworkProcess/CustomProtocols/soup/LegacyCustomProtocolManagerSoup.cpp
@@ -194,8 +196,6 @@
 UIProcess/wpe/WebPreferencesWPE.cpp
 UIProcess/wpe/WebProcessPoolWPE.cpp
 
-WebProcess/Cookies/soup/WebCookieManagerSoup.cpp
-
 WebProcess/InjectedBundle/API/glib/WebKitConsoleMessage.cpp @no-unify
 WebProcess/InjectedBundle/API/glib/WebKitExtensionManager.cpp @no-unify
 WebProcess/InjectedBundle/API/glib/WebKitFrame.cpp @no-unify

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (229425 => 229426)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2018-03-08 20:43:34 UTC (rev 229426)
@@ -5879,6 +5879,7 @@
 				3309344E1315B94D0097A7BC /* WebCookieManager.messages.in */,
 			);
 			name = Cookies;
+			path = NetworkProcess;
 			sourceTree = "<group>";
 		};
 		33D3A3BD1339609800709BE4 /* MediaCache */ = {
@@ -6338,6 +6339,7 @@
 				E489D2821A0A2BE80078C06A /* cache */,
 				539BD5B21DADB0BA00F2E4E1 /* capture */,
 				7EC4F0F818E4A922008056AF /* cocoa */,
+				3309344B1315B93A0097A7BC /* Cookies */,
 				5C1426F21C23F82D00D41183 /* CustomProtocols */,
 				5C1426F11C23F81700D41183 /* Downloads */,
 				BC82837C16B45DA500A278FE /* EntryPoint */,
@@ -7013,7 +7015,6 @@
 				1C0A19431C8FF1A800FE0EBB /* Automation */,
 				41D129D81F3D101400D15E47 /* Cache */,
 				7C6E70F818B2D47E00F24E2E /* cocoa */,
-				3309344B1315B93A0097A7BC /* Cookies */,
 				5760828A202984C900116678 /* CredentialManagement */,
 				512A9754180DF9270039A149 /* Databases */,
 				BCACC43B16B24C5D00B6E092 /* EntryPoint */,

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp (229425 => 229426)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/InjectedBundle.cpp	2018-03-08 20:43:34 UTC (rev 229426)
@@ -34,7 +34,6 @@
 #include "SessionTracker.h"
 #include "UserData.h"
 #include "WebConnectionToUIProcess.h"
-#include "WebCookieManager.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebFrameNetworkingContext.h"

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (229425 => 229426)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2018-03-08 20:43:34 UTC (rev 229426)
@@ -35,7 +35,6 @@
 #include "NetworkResourceLoadParameters.h"
 #include "PluginInfoStore.h"
 #include "SessionTracker.h"
-#include "WebCookieManager.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
 #include "WebFrame.h"

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm (229425 => 229426)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm	2018-03-08 20:43:34 UTC (rev 229426)
@@ -29,7 +29,6 @@
 #include "CookieStorageUtilsCF.h"
 #include "NetworkSession.h"
 #include "SessionTracker.h"
-#include "WebCookieManager.h"
 #include "WebPage.h"
 #include "WebProcess.h"
 #include "WebsiteDataStoreParameters.h"

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (229425 => 229426)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2018-03-08 20:38:36 UTC (rev 229425)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2018-03-08 20:43:34 UTC (rev 229426)
@@ -48,7 +48,6 @@
 #include "WebAutomationSessionProxy.h"
 #include "WebCacheStorageProvider.h"
 #include "WebConnectionToUIProcess.h"
-#include "WebCookieManager.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebFrame.h"
 #include "WebFrameNetworkingContext.h"
@@ -187,7 +186,6 @@
     // so that ports have a chance to customize, and ifdefs in this file are
     // limited.
     addSupplement<WebGeolocationManager>();
-    addSupplement<WebCookieManager>();
 
 #if ENABLE(NOTIFICATIONS)
     addSupplement<WebNotificationManager>();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to