Unreviewed, rolling out r232989.
authordavid_fenton@apple.com <david_fenton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Jun 2018 18:24:23 +0000 (18:24 +0000)
committerdavid_fenton@apple.com <david_fenton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 21 Jun 2018 18:24:23 +0000 (18:24 +0000)
Causes API regressions on macOS

Reverted changeset:

"REGRESSION (r231850): Cookie file cannot be read or written
by network process"
https://bugs.webkit.org/show_bug.cgi?id=186806
https://trac.webkit.org/changeset/232989

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

Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.cpp
Source/WebKit/NetworkProcess/NetworkProcessCreationParameters.h
Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit/UIProcess/WebProcessPool.cpp

index b45a04d..656da6e 100644 (file)
@@ -1,3 +1,16 @@
+2018-06-21  David Fenton  <david_fenton@apple.com>
+
+        Unreviewed, rolling out r232989.
+
+        Causes API regressions on macOS
+
+        Reverted changeset:
+
+        "REGRESSION (r231850): Cookie file cannot be read or written
+        by network process"
+        https://bugs.webkit.org/show_bug.cgi?id=186806
+        https://trac.webkit.org/changeset/232989
+
 2018-06-21  Zan Dobersek  <zdobersek@igalia.com>
 
         [GTK] WebDriver: allow applying host-specific TLS certificates for automated sessions
index 184d127..722a752 100644 (file)
@@ -269,10 +269,6 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
 
     SessionTracker::setSession(PAL::SessionID::defaultSessionID(), NetworkSession::create(WTFMove(parameters.defaultSessionParameters)));
 
-    auto* defaultSession = SessionTracker::networkSession(PAL::SessionID::defaultSessionID());
-    for (const auto& cookie : parameters.defaultSessionPendingCookies)
-        defaultSession->networkStorageSession().setCookie(cookie);
-
     for (auto& supplement : m_supplements.values())
         supplement->initialize(parameters);
 
index 8374dd3..2010b43 100644 (file)
@@ -55,7 +55,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 #if PLATFORM(COCOA)
     encoder << uiProcessCookieStorageIdentifier;
 #endif
-    encoder << defaultSessionPendingCookies;
 #if PLATFORM(IOS)
     encoder << cookieStorageDirectoryExtensionHandle;
     encoder << containerCachesDirectoryExtensionHandle;
@@ -148,8 +147,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
     if (!decoder.decode(result.uiProcessCookieStorageIdentifier))
         return false;
 #endif
-    if (!decoder.decode(result.defaultSessionPendingCookies))
-        return false;
 #if PLATFORM(IOS)
     std::optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle;
     decoder >> cookieStorageDirectoryExtensionHandle;
index 6bfdaec..4388945 100644 (file)
@@ -28,7 +28,6 @@
 #include "CacheModel.h"
 #include "NetworkSessionCreationParameters.h"
 #include "SandboxExtension.h"
-#include <WebCore/Cookie.h>
 #include <wtf/ProcessID.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -66,7 +65,6 @@ struct NetworkProcessCreationParameters {
 #if PLATFORM(COCOA)
     Vector<uint8_t> uiProcessCookieStorageIdentifier;
 #endif
-    Vector<WebCore::Cookie> defaultSessionPendingCookies;
 #if PLATFORM(IOS)
     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
index 154678c..1e02e91 100644 (file)
@@ -46,8 +46,12 @@ namespace WebKit {
 void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStoreParameters&& parameters)
 {
     auto sessionID = parameters.networkSessionParameters.sessionID;
-    if (NetworkStorageSession::storageSession(sessionID))
+    if (auto* session = NetworkStorageSession::storageSession(sessionID)) {
+        ASSERT(parameters.pendingCookies.isEmpty() || sessionID == PAL::SessionID::defaultSessionID());
+        for (const auto& cookie : parameters.pendingCookies)
+            session->setCookie(cookie);
         return;
+    }
 
     String base;
     if (SessionTracker::getIdentifierBase().isNull())
index 4c61e97..7c6cec0 100644 (file)
@@ -467,11 +467,6 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
         parameters.defaultSessionParameters.sessionID = PAL::SessionID::defaultSessionID();
     }
     
-    if (m_websiteDataStore) {
-        parameters.defaultSessionPendingCookies = m_websiteDataStore->websiteDataStore().pendingCookies();
-        m_websiteDataStore->websiteDataStore().clearPendingCookies();
-    }
-    
     parameters.privateBrowsingEnabled = WebPreferences::anyPagesAreUsingPrivateBrowsing();
 
     parameters.cacheModel = cacheModel();
@@ -533,6 +528,11 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
             m_websiteDataStore->websiteDataStore().networkProcessDidCrash();
     }
 
+    if (m_websiteDataStore) {
+        m_networkProcess->addSession(makeRef(m_websiteDataStore->websiteDataStore()));
+        m_websiteDataStore->websiteDataStore().clearPendingCookies();
+    }
+    
     if (withWebsiteDataStore) {
         m_networkProcess->addSession(makeRef(*withWebsiteDataStore));
         withWebsiteDataStore->clearPendingCookies();