NetworkProcess should initialize its default NetworkSession with parameters from...
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Jan 2019 16:51:44 +0000 (16:51 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Jan 2019 16:51:44 +0000 (16:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=192967

Reviewed by Brent Fulgham.

I moved 3 of the NetworkProcessCreationParameters to use corresponding values of a WebsiteDataStoreParameters.
More will be moved in the near future, like indexedDatabaseDirectory.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode const):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239592 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/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/WebProcessPool.cpp

index 83f5006..1d4db69 100644 (file)
@@ -1,3 +1,24 @@
+2019-01-03  Alex Christensen  <achristensen@webkit.org>
+
+        NetworkProcess should initialize its default NetworkSession with parameters from the UIProcess
+        https://bugs.webkit.org/show_bug.cgi?id=192967
+
+        Reviewed by Brent Fulgham.
+
+        I moved 3 of the NetworkProcessCreationParameters to use corresponding values of a WebsiteDataStoreParameters.
+        More will be moved in the near future, like indexedDatabaseDirectory.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode const):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+
 2019-01-03  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] REGRESSION (r239441): Tab cycling to offscreen <select> may not scroll it into view
index 10aebb9..d3c9f05 100644 (file)
@@ -298,12 +298,8 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
     if (parameters.shouldUseTestingNetworkSession)
         NetworkStorageSession::switchToNewTestingSession();
 
-    NetworkSessionCreationParameters sessionCreationParameters { };
-#if PLATFORM(COCOA)
-    sessionCreationParameters.httpProxy = URL(URL(), parameters.httpProxy);
-    sessionCreationParameters.httpsProxy = URL(URL(), parameters.httpsProxy);
-#endif
-    SessionTracker::setSession(PAL::SessionID::defaultSessionID(), NetworkSession::create(WTFMove(sessionCreationParameters)));
+    auto sessionID = parameters.defaultDataStoreParameters.networkSessionParameters.sessionID;
+    SessionTracker::setSession(sessionID, NetworkSession::create(WTFMove(parameters.defaultDataStoreParameters.networkSessionParameters)));
 
 #if ENABLE(INDEXED_DATABASE)
     addIndexedDatabaseSession(PAL::SessionID::defaultSessionID(), parameters.indexedDatabaseDirectory, parameters.indexedDatabaseDirectoryExtensionHandle);
@@ -321,7 +317,7 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
 #endif
 
     auto* defaultSession = SessionTracker::networkSession(PAL::SessionID::defaultSessionID());
-    for (const auto& cookie : parameters.defaultSessionPendingCookies)
+    for (const auto& cookie : parameters.defaultDataStoreParameters.pendingCookies)
         defaultSession->networkStorageSession().setCookie(cookie);
 
     for (auto& supplement : m_supplements.values())
index c375ff9..e283a43 100644 (file)
@@ -52,7 +52,6 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 #if PLATFORM(MAC)
     encoder << uiProcessCookieStorageIdentifier;
 #endif
-    encoder << defaultSessionPendingCookies;
 #if PLATFORM(IOS_FAMILY)
     encoder << cookieStorageDirectoryExtensionHandle;
     encoder << containerCachesDirectoryExtensionHandle;
@@ -70,12 +69,11 @@ void NetworkProcessCreationParameters::encode(IPC::Encoder& encoder) const
 #if PLATFORM(IOS_FAMILY)
     encoder << ctDataConnectionServiceType;
 #endif
-    encoder << httpProxy;
-    encoder << httpsProxy;
     IPC::encode(encoder, networkATSContext.get());
     encoder << storageAccessAPIEnabled;
     encoder << suppressesConnectionTerminationOnSystemChange;
 #endif
+    encoder << defaultDataStoreParameters;
 #if USE(SOUP)
     encoder << cookiePersistentStoragePath;
     encoder << cookiePersistentStorageType;
@@ -134,8 +132,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_FAMILY)
     Optional<SandboxExtension::Handle> cookieStorageDirectoryExtensionHandle;
     decoder >> cookieStorageDirectoryExtensionHandle;
@@ -178,10 +174,6 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
     if (!decoder.decode(result.ctDataConnectionServiceType))
         return false;
 #endif
-    if (!decoder.decode(result.httpProxy))
-        return false;
-    if (!decoder.decode(result.httpsProxy))
-        return false;
     if (!IPC::decode(decoder, result.networkATSContext))
         return false;
     if (!decoder.decode(result.storageAccessAPIEnabled))
@@ -190,6 +182,12 @@ bool NetworkProcessCreationParameters::decode(IPC::Decoder& decoder, NetworkProc
         return false;
 #endif
 
+    Optional<WebsiteDataStoreParameters> defaultDataStoreParameters;
+    decoder >> defaultDataStoreParameters;
+    if (!defaultDataStoreParameters)
+        return false;
+    result.defaultDataStoreParameters = WTFMove(*defaultDataStoreParameters);
+
 #if USE(SOUP)
     if (!decoder.decode(result.cookiePersistentStoragePath))
         return false;
index 7f9c05f..b7370d5 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "CacheModel.h"
 #include "SandboxExtension.h"
+#include "WebsiteDataStoreParameters.h"
 #include <WebCore/Cookie.h>
 #include <wtf/ProcessID.h>
 #include <wtf/Vector.h>
@@ -62,7 +63,6 @@ struct NetworkProcessCreationParameters {
 #if PLATFORM(MAC)
     Vector<uint8_t> uiProcessCookieStorageIdentifier;
 #endif
-    Vector<WebCore::Cookie> defaultSessionPendingCookies;
 #if PLATFORM(IOS_FAMILY)
     SandboxExtension::Handle cookieStorageDirectoryExtensionHandle;
     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
@@ -82,13 +82,13 @@ struct NetworkProcessCreationParameters {
 #if PLATFORM(IOS_FAMILY)
     String ctDataConnectionServiceType;
 #endif
-    String httpProxy;
-    String httpsProxy;
     RetainPtr<CFDataRef> networkATSContext;
     bool storageAccessAPIEnabled;
     bool suppressesConnectionTerminationOnSystemChange;
 #endif
 
+    WebsiteDataStoreParameters defaultDataStoreParameters;
+    
 #if USE(SOUP)
     String cookiePersistentStoragePath;
     uint32_t cookiePersistentStorageType { 0 };
index d70286b..56cf0fd 100644 (file)
@@ -264,8 +264,8 @@ void WebProcessPool::platformInitializeNetworkProcess(NetworkProcessCreationPara
         isSafari = WebCore::MacApplication::isSafari();
 #endif
         if (isSafari) {
-            parameters.httpProxy = [defaults stringForKey:(NSString *)WebKit2HTTPProxyDefaultsKey];
-            parameters.httpsProxy = [defaults stringForKey:(NSString *)WebKit2HTTPSProxyDefaultsKey];
+            parameters.defaultDataStoreParameters.networkSessionParameters.httpProxy = URL(URL(), [defaults stringForKey:(NSString *)WebKit2HTTPProxyDefaultsKey]);
+            parameters.defaultDataStoreParameters.networkSessionParameters.httpsProxy = URL(URL(), [defaults stringForKey:(NSString *)WebKit2HTTPSProxyDefaultsKey]);
         }
     }
 
index b75538d..5f51f9d 100644 (file)
@@ -476,7 +476,7 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
     NetworkProcessCreationParameters parameters;
 
     if (m_websiteDataStore) {
-        parameters.defaultSessionPendingCookies = copyToVector(m_websiteDataStore->websiteDataStore().pendingCookies());
+        parameters.defaultDataStoreParameters.pendingCookies = copyToVector(m_websiteDataStore->websiteDataStore().pendingCookies());
         m_websiteDataStore->websiteDataStore().clearPendingCookies();
     }