Title: [290766] trunk/Source/WebKit
Revision
290766
Author
[email protected]
Date
2022-03-02 21:08:03 -0800 (Wed, 02 Mar 2022)

Log Message

REGRESSION (r289474): cacheStoragePath is empty in NetworkStorageManager::localOriginStorageManager
https://bugs.webkit.org/show_bug.cgi?id=237335

Reviewed by Chris Dumez.

CacheStorage::Engine::storagePath returns emptyString if salt file under rootDirectory cannot be read or
written, so we need to make sure sandbox extension for rootDirectory is consumed before calling storagePath
(in createNetworkStorageManager of NetworkSession).

This patch also refactors code about adding session in network process. Now we would create
NetworkStorageManager when NetworkSession is created.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting):
(WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFilesForIndexedDB):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
(WebKit::NetworkProcess::addStorageSession):
(WebKit::NetworkProcess::addWebsiteDataStore):
(WebKit::NetworkProcess::hasLocalStorage):
(WebKit::NetworkProcess::fetchWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteData):
(WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
(WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
(WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
(WebKit::NetworkProcess::prepareToSuspend):
(WebKit::NetworkProcess::resume):
(WebKit::NetworkProcess::syncLocalStorage):
(WebKit::NetworkProcess::resetQuota):
(WebKit::NetworkProcess::clearStorage):
(WebKit::NetworkProcess::didIncreaseQuota):
(WebKit::NetworkProcess::renameOriginInWebsiteData):
(WebKit::NetworkProcess::uiProcessBundleIdentifier):
(WebKit::NetworkProcess::connectionToWebProcessClosed):
(WebKit::NetworkProcess::ensureSession): Deleted.
* NetworkProcess/NetworkProcess.h:
(WebKit::NetworkProcess::uiProcessBundleIdentifier const): Deleted.
* NetworkProcess/NetworkSession.cpp:
(WebKit::createNetworkStorageManager):
(WebKit::NetworkSession::NetworkSession):
(WebKit::NetworkSession::invalidateAndCancel):
(WebKit::NetworkSession::lowMemoryHandler):
(WebKit::NetworkSession::addServiceWorkerSession): Deleted.
(WebKit::NetworkSession::addStorageManagerSession): Deleted.
* NetworkProcess/NetworkSession.h:
(WebKit::NetworkSession::storageManager):
* NetworkProcess/NetworkSessionCreationParameters.cpp:
(WebKit::NetworkSessionCreationParameters::encode const):
(WebKit::NetworkSessionCreationParameters::decode):
* NetworkProcess/NetworkSessionCreationParameters.h:
* NetworkProcess/RemoteNetworkingContext.h: Removed.
* NetworkProcess/cache/CacheStorageEngine.cpp:
(WebKit::CacheStorage::Engine::requestSpace):
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::uiProcessBundleIdentifier):
* NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Removed.
* NetworkProcess/mac/RemoteNetworkingContext.mm: Removed.
* NetworkProcess/soup/RemoteNetworkingContextSoup.cpp: Removed.
* PlatformPlayStation.cmake:
* PlatformWin.cmake:
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
(WebKit::WebsiteDataStoreParameters::~WebsiteDataStoreParameters): Deleted.
* Shared/WebsiteDataStoreParameters.h:
(): Deleted.
* SourcesCocoa.txt:
* SourcesGTK.txt:
* SourcesWPE.txt:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::addSession):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::resolvedIndexedDBDirectory const):
(WebKit::WebsiteDataStore::resolvedIndexedDatabaseDirectory const): Deleted.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (290765 => 290766)


--- trunk/Source/WebKit/ChangeLog	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/ChangeLog	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1,5 +1,84 @@
 2022-03-02  Sihui Liu  <[email protected]>
 
+        REGRESSION (r289474): cacheStoragePath is empty in NetworkStorageManager::localOriginStorageManager
+        https://bugs.webkit.org/show_bug.cgi?id=237335
+
+        Reviewed by Chris Dumez.
+
+        CacheStorage::Engine::storagePath returns emptyString if salt file under rootDirectory cannot be read or
+        written, so we need to make sure sandbox extension for rootDirectory is consumed before calling storagePath
+        (in createNetworkStorageManager of NetworkSession).
+
+        This patch also refactors code about adding session in network process. Now we would create 
+        NetworkStorageManager when NetworkSession is created.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting):
+        (WebKit::NetworkConnectionToWebProcess::writeBlobsToTemporaryFilesForIndexedDB):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::createNetworkConnectionToWebProcess):
+        (WebKit::NetworkProcess::addStorageSession):
+        (WebKit::NetworkProcess::addWebsiteDataStore):
+        (WebKit::NetworkProcess::hasLocalStorage):
+        (WebKit::NetworkProcess::fetchWebsiteData):
+        (WebKit::NetworkProcess::deleteWebsiteData):
+        (WebKit::NetworkProcess::deleteWebsiteDataForOrigins):
+        (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains):
+        (WebKit::NetworkProcess::registrableDomainsWithWebsiteData):
+        (WebKit::NetworkProcess::prepareToSuspend):
+        (WebKit::NetworkProcess::resume):
+        (WebKit::NetworkProcess::syncLocalStorage):
+        (WebKit::NetworkProcess::resetQuota):
+        (WebKit::NetworkProcess::clearStorage):
+        (WebKit::NetworkProcess::didIncreaseQuota):
+        (WebKit::NetworkProcess::renameOriginInWebsiteData):
+        (WebKit::NetworkProcess::uiProcessBundleIdentifier):
+        (WebKit::NetworkProcess::connectionToWebProcessClosed):
+        (WebKit::NetworkProcess::ensureSession): Deleted.
+        * NetworkProcess/NetworkProcess.h:
+        (WebKit::NetworkProcess::uiProcessBundleIdentifier const): Deleted.
+        * NetworkProcess/NetworkSession.cpp:
+        (WebKit::createNetworkStorageManager):
+        (WebKit::NetworkSession::NetworkSession):
+        (WebKit::NetworkSession::invalidateAndCancel):
+        (WebKit::NetworkSession::lowMemoryHandler):
+        (WebKit::NetworkSession::addServiceWorkerSession): Deleted.
+        (WebKit::NetworkSession::addStorageManagerSession): Deleted.
+        * NetworkProcess/NetworkSession.h:
+        (WebKit::NetworkSession::storageManager):
+        * NetworkProcess/NetworkSessionCreationParameters.cpp:
+        (WebKit::NetworkSessionCreationParameters::encode const):
+        (WebKit::NetworkSessionCreationParameters::decode):
+        * NetworkProcess/NetworkSessionCreationParameters.h:
+        * NetworkProcess/RemoteNetworkingContext.h: Removed.
+        * NetworkProcess/cache/CacheStorageEngine.cpp:
+        (WebKit::CacheStorage::Engine::requestSpace):
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::uiProcessBundleIdentifier):
+        * NetworkProcess/curl/RemoteNetworkingContextCurl.cpp: Removed.
+        * NetworkProcess/mac/RemoteNetworkingContext.mm: Removed.
+        * NetworkProcess/soup/RemoteNetworkingContextSoup.cpp: Removed.
+        * PlatformPlayStation.cmake:
+        * PlatformWin.cmake:
+        * Shared/WebsiteDataStoreParameters.cpp:
+        (WebKit::WebsiteDataStoreParameters::encode const):
+        (WebKit::WebsiteDataStoreParameters::decode):
+        (WebKit::WebsiteDataStoreParameters::~WebsiteDataStoreParameters): Deleted.
+        * Shared/WebsiteDataStoreParameters.h:
+        (): Deleted.
+        * SourcesCocoa.txt:
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::addSession):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::parameters):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::resolvedIndexedDBDirectory const):
+        (WebKit::WebsiteDataStore::resolvedIndexedDatabaseDirectory const): Deleted.
+
+2022-03-02  Sihui Liu  <[email protected]>
+
         Throw proper exception on failed removeEntry() calls
         https://bugs.webkit.org/show_bug.cgi?id=237382
         <rdar://89232969>

Modified: trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -409,12 +409,8 @@
 
 void NetworkConnectionToWebProcess::updateQuotaBasedOnSpaceUsageForTesting(const ClientOrigin& origin)
 {
-    auto* session = m_networkProcess->networkSession(sessionID());
-    if (!session)
-        return;
-
-    if (auto* storageManager = session->storageManager())
-        storageManager->resetQuotaUpdatedBasedOnUsageForTesting(origin);
+    if (auto* session = m_networkProcess->networkSession(sessionID()))
+        session->storageManager().resetQuotaUpdatedBasedOnUsageForTesting(origin);
 }
 
 void NetworkConnectionToWebProcess::didClose(IPC::Connection& connection)
@@ -1003,10 +999,9 @@
         for (auto& file : fileReferences)
             file->revokeFileAccess();
 
-        if (auto* session = networkSession()) {
-            if (auto* storageManager = session->storageManager())
-                storageManager->registerTemporaryBlobFilePaths(m_connection, filePaths);
-        }
+        if (auto* session = networkSession())
+            session->storageManager().registerTemporaryBlobFilePaths(m_connection, filePaths);
+
         completionHandler(WTFMove(filePaths));
     });
 }

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -51,7 +51,6 @@
 #include "NetworkStorageManager.h"
 #include "PreconnectTask.h"
 #include "PrivateClickMeasurementStore.h"
-#include "RemoteNetworkingContext.h"
 #include "ShouldGrandfatherStatistics.h"
 #include "StorageAccessStatus.h"
 #include "StorageManagerSet.h"
@@ -102,6 +101,7 @@
 #include "NetworkCacheCoders.h"
 
 #if PLATFORM(COCOA)
+#include "CookieStorageUtilsCF.h"
 #include "LaunchServicesDatabaseObserver.h"
 #include "NetworkSessionCocoa.h"
 #include <wtf/cocoa/Entitlements.h>
@@ -382,10 +382,8 @@
 
     connection.setOnLineState(NetworkStateNotifier::singleton().onLine());
 
-    if (auto* session = networkSession(sessionID)) {
-        if (auto* manager = session->storageManager())
-            manager->startReceivingMessageFromConnection(connection.connection());
-    }
+    if (auto* session = networkSession(sessionID))
+        session->storageManager().startReceivingMessageFromConnection(connection.connection());
 }
 
 void NetworkProcess::clearCachedCredentials(PAL::SessionID sessionID)
@@ -397,21 +395,56 @@
     }
 }
 
-void NetworkProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters)
+void NetworkProcess::addStorageSession(PAL::SessionID sessionID, bool shouldUseTestingNetworkSession, const Vector<uint8_t>& uiProcessCookieStorageIdentifier, const SandboxExtension::Handle& cookieStoragePathExtensionHandle)
 {
-    auto sessionID = parameters.networkSessionParameters.sessionID;
+    auto addResult = m_networkStorageSessions.add(sessionID, nullptr);
+    if (!addResult.isNewEntry)
+        return;
 
-    RemoteNetworkingContext::ensureWebsiteDataStoreSession(*this, parameters);
+    if (shouldUseTestingNetworkSession) {
+        addResult.iterator->value = newTestingSession(sessionID);
+        return;
+    }
 
-    if (auto* session = networkSession(sessionID)) {
-        session->addStorageManagerSession(parameters.generalStorageDirectory, parameters.generalStorageDirectoryHandle, parameters.localStorageDirectory, parameters.localStorageDirectoryExtensionHandle, parameters.indexedDatabaseDirectory, parameters.indexedDatabaseDirectoryExtensionHandle, parameters.cacheStorageDirectory, parameters.perOriginStorageQuota, parameters.perThirdPartyOriginStorageQuota, parameters.shouldUseCustomStoragePaths);
+#if PLATFORM(COCOA)
+    RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage;
+    if (!sessionID.isEphemeral() && !uiProcessCookieStorageIdentifier.isEmpty()) {
+        SandboxExtension::consumePermanently(cookieStoragePathExtensionHandle);
+        if (sessionID != PAL::SessionID::defaultSessionID())
+            uiProcessCookieStorage = cookieStorageFromIdentifyingData(uiProcessCookieStorageIdentifier);
+    }
 
-#if ENABLE(SERVICE_WORKER)
-        session->addServiceWorkerSession(parameters.serviceWorkerProcessTerminationDelayEnabled, WTFMove(parameters.serviceWorkerRegistrationDirectory), parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
+    auto identifierBase = makeString(uiProcessBundleIdentifier(), '.', sessionID.toUInt64());
+    RetainPtr<CFURLStorageSessionRef> storageSession;
+    auto cfIdentifier = makeString(identifierBase, ".PrivateBrowsing.", createVersion4UUIDString()).createCFString();
+    if (sessionID.isEphemeral())
+        storageSession = createPrivateStorageSession(cfIdentifier.get(), std::nullopt, WebCore::NetworkStorageSession::ShouldDisableCFURLCache::Yes);
+    else if (sessionID != PAL::SessionID::defaultSessionID())
+        storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(cfIdentifier.get());
+
+    if (NetworkStorageSession::processMayUseCookieAPI()) {
+        ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
+        if (!uiProcessCookieStorage && storageSession)
+            uiProcessCookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession.get()));
+    }
+
+    addResult.iterator->value = makeUnique<NetworkStorageSession>(sessionID, WTFMove(storageSession), WTFMove(uiProcessCookieStorage));
+#elif USE(CURL) || USE(SOUP)
+    addResult.iterator->value = makeUnique<NetworkStorageSession>(sessionID);
 #endif
-    }
 }
 
+void NetworkProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters)
+{
+    auto sessionID = parameters.networkSessionParameters.sessionID;
+    addStorageSession(sessionID, parameters.networkSessionParameters.shouldUseTestingNetworkSession, parameters.uiProcessCookieStorageIdentifier, parameters.cookieStoragePathExtensionHandle);
+
+    m_networkSessions.ensure(sessionID, [&]() {
+        return NetworkSession::create(*this, parameters.networkSessionParameters);
+    });
+    
+}
+
 void NetworkProcess::forEachNetworkSession(const Function<void(NetworkSession&)>& functor)
 {
     for (auto& session : m_networkSessions.values())
@@ -435,41 +468,6 @@
 #endif
 }
 
-#if PLATFORM(COCOA)
-void NetworkProcess::ensureSession(PAL::SessionID sessionID, bool shouldUseTestingNetworkSession, const String& identifierBase, RetainPtr<CFHTTPCookieStorageRef>&& cookieStorage)
-#else
-void NetworkProcess::ensureSession(PAL::SessionID sessionID, bool shouldUseTestingNetworkSession, const String& identifierBase)
-#endif
-{
-    auto addResult = m_networkStorageSessions.add(sessionID, nullptr);
-    if (!addResult.isNewEntry)
-        return;
-
-    if (shouldUseTestingNetworkSession) {
-        addResult.iterator->value = newTestingSession(sessionID);
-        return;
-    }
-    
-#if PLATFORM(COCOA)
-    RetainPtr<CFURLStorageSessionRef> storageSession;
-    RetainPtr<CFStringRef> cfIdentifier = makeString(identifierBase, ".PrivateBrowsing.", createVersion4UUIDString()).createCFString();
-    if (sessionID.isEphemeral())
-        storageSession = createPrivateStorageSession(cfIdentifier.get(), std::nullopt, WebCore::NetworkStorageSession::ShouldDisableCFURLCache::Yes);
-    else if (sessionID != PAL::SessionID::defaultSessionID())
-        storageSession = WebCore::NetworkStorageSession::createCFStorageSessionForIdentifier(cfIdentifier.get());
-
-    if (NetworkStorageSession::processMayUseCookieAPI()) {
-        ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
-        if (!cookieStorage && storageSession)
-            cookieStorage = adoptCF(_CFURLStorageSessionCopyCookieStorage(kCFAllocatorDefault, storageSession.get()));
-    }
-
-    addResult.iterator->value = makeUnique<NetworkStorageSession>(sessionID, WTFMove(storageSession), WTFMove(cookieStorage));
-#elif USE(CURL) || USE(SOUP)
-    addResult.iterator->value = makeUnique<NetworkStorageSession>(sessionID);
-#endif
-}
-
 void NetworkProcess::cookieAcceptPolicyChanged(HTTPCookieAcceptPolicy newPolicy)
 {
     for (auto& connection : m_webProcessConnections.values())
@@ -999,11 +997,11 @@
 void NetworkProcess::hasLocalStorage(PAL::SessionID sessionID, const RegistrableDomain& domain, CompletionHandler<void(bool)>&& completionHandler)
 {
     auto* session = networkSession(sessionID);
-    if (!session || !session->storageManager())
+    if (!session)
         return completionHandler(false);
 
     auto types = OptionSet<WebsiteDataType> { WebsiteDataType::LocalStorage };
-    session->storageManager()->fetchData(types, [domain, completionHandler = WTFMove(completionHandler)](auto entries) mutable {
+    session->storageManager().fetchData(types, [domain, completionHandler = WTFMove(completionHandler)](auto entries) mutable {
         completionHandler(WTF::anyOf(entries, [&domain](auto& entry) {
             return domain.matches(entry.origin);
         }));
@@ -1464,8 +1462,8 @@
     }
 #endif
 
-    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session && session->storageManager()) {
-        session->storageManager()->fetchData(websiteDataTypes, [callbackAggregator](auto entries) mutable {
+    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session) {
+        session->storageManager().fetchData(websiteDataTypes, [callbackAggregator](auto entries) mutable {
             callbackAggregator->m_websiteData.entries.appendVector(WTFMove(entries));
         });
     }
@@ -1527,8 +1525,8 @@
         session->clearAlternativeServices(modifiedSince);
 #endif
 
-    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session && session->storageManager())
-        session->storageManager()->deleteDataModifiedSince(websiteDataTypes, modifiedSince, [clearTasksHandler] { });
+    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session)
+        session->storageManager().deleteDataModifiedSince(websiteDataTypes, modifiedSince, [clearTasksHandler] { });
 }
 
 static void clearDiskCacheEntries(NetworkCache::Cache* cache, const Vector<SecurityOriginData>& origins, CompletionHandler<void()>&& completionHandler)
@@ -1620,8 +1618,8 @@
     }
 #endif
 
-    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session && session->storageManager())
-        session->storageManager()->deleteData(websiteDataTypes, originDatas, [clearTasksHandler] { });
+    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session)
+        session->storageManager().deleteData(websiteDataTypes, originDatas, [clearTasksHandler] { });
 
     if (session) {
         HashSet<WebCore::RegistrableDomain> domainsToDeleteNetworkDataFor;
@@ -1812,8 +1810,8 @@
         });
     }
 
-    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session && session->storageManager()) {
-        session->storageManager()->deleteDataForRegistrableDomains(websiteDataTypes, domainsToDeleteAllNonCookieWebsiteDataFor, [callbackAggregator](auto&& deletedDomains) mutable {
+    if (NetworkStorageManager::canHandleTypes(websiteDataTypes) && session) {
+        session->storageManager().deleteDataForRegistrableDomains(websiteDataTypes, domainsToDeleteAllNonCookieWebsiteDataFor, [callbackAggregator](auto&& deletedDomains) mutable {
             for (auto domain : deletedDomains)
                 callbackAggregator->m_domains.add(WTFMove(domain));
         });
@@ -1929,8 +1927,8 @@
         });
     }
 
-    if (session && session->storageManager()) {
-        session->storageManager()->fetchData(websiteDataTypes, [callbackAggregator](auto entries) mutable {
+    if (session) {
+        session->storageManager().fetchData(websiteDataTypes, [callbackAggregator](auto entries) mutable {
             callbackAggregator->m_websiteData.entries.appendVector(WTFMove(entries));
         });
     }
@@ -2102,8 +2100,7 @@
         if (auto* swServer = session.swServer())
             swServer->startSuspension([callbackAggregator] { });
 #endif
-        if (auto* storageManager = session.storageManager())
-            storageManager->suspend([callbackAggregator] { });
+        session.storageManager().suspend([callbackAggregator] { });
     });
 
     for (auto& connection : m_webProcessConnections.values())
@@ -2141,8 +2138,7 @@
         if (auto* swServer = session.swServer())
             swServer->endSuspension();
 #endif
-        if (auto* manager = session.storageManager())
-            manager->resume();
+        session.storageManager().resume();
     });
 }
 
@@ -2175,29 +2171,22 @@
 {
     auto aggregator = CallbackAggregator::create(WTFMove(completionHandler));
     forEachNetworkSession([&](auto& session) {
-        if (auto* manager = session.storageManager())
-            manager->syncLocalStorage([aggregator] { });
+        session.storageManager().syncLocalStorage([aggregator] { });
     });
 }
 
 void NetworkProcess::resetQuota(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
 {
-    auto* session = networkSession(sessionID);
-    if (!session)
-        return completionHandler();
+    if (auto* session = networkSession(sessionID))
+        return session->storageManager().resetQuotaForTesting(WTFMove(completionHandler));
 
-    auto* storageManager = session->storageManager();
-    if (!storageManager)
-        return completionHandler();
-
-    storageManager->resetQuotaForTesting(WTFMove(completionHandler));
+    completionHandler();
 }
 
 void NetworkProcess::clearStorage(PAL::SessionID sessionID, CompletionHandler<void()>&& completionHandler)
 {
-    auto* session = networkSession(sessionID);
-    if (auto* manager = session ? session->storageManager() : nullptr)
-        manager->clearStorageForTesting(WTFMove(completionHandler));
+    if (auto* session = networkSession(sessionID))
+        session->storageManager().clearStorageForTesting(WTFMove(completionHandler));
     else
         completionHandler();
 }
@@ -2204,12 +2193,8 @@
 
 void NetworkProcess::didIncreaseQuota(PAL::SessionID sessionID, const ClientOrigin& origin, QuotaIncreaseRequestIdentifier identifier, std::optional<uint64_t> newQuota)
 {
-    auto* session = networkSession(sessionID);
-    if (!session)
-        return;
-
-    if (auto* manager = session->storageManager())
-        manager->didIncreaseQuota(origin, identifier, newQuota);
+    if (auto* session = networkSession(sessionID))
+        session->storageManager().didIncreaseQuota(origin, identifier, newQuota);
 }
 
 void NetworkProcess::renameOriginInWebsiteData(PAL::SessionID sessionID, const URL& oldName, const URL& newName, OptionSet<WebsiteDataType> dataTypes, CompletionHandler<void()>&& completionHandler)
@@ -2221,9 +2206,8 @@
     if (oldOrigin.isEmpty() || newOrigin.isEmpty())
         return;
 
-    auto* session = networkSession(sessionID);
-    if (auto* manager = session ? session->storageManager() : nullptr)
-        manager->moveData(dataTypes, oldOrigin, newOrigin, [aggregator] { });
+    if (auto* session = networkSession(sessionID))
+        session->storageManager().moveData(dataTypes, oldOrigin, newOrigin, [aggregator] { });
 }
 
 #if ENABLE(SERVICE_WORKER)
@@ -2477,10 +2461,8 @@
 
 void NetworkProcess::connectionToWebProcessClosed(IPC::Connection& connection, PAL::SessionID sessionID)
 {
-    if (auto* session = networkSession(sessionID)) {
-        if (auto* manager = session->storageManager())
-            manager->stopReceivingMessageFromConnection(connection);
-    }
+    if (auto* session = networkSession(sessionID))
+        session->storageManager().stopReceivingMessageFromConnection(connection);
 }
 
 NetworkConnectionToWebProcess* NetworkProcess::webProcessConnection(ProcessIdentifier identifier) const

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2022-03-03 05:08:03 UTC (rev 290766)
@@ -169,11 +169,7 @@
     void forEachNetworkStorageSession(const Function<void(WebCore::NetworkStorageSession&)>&);
     WebCore::NetworkStorageSession* storageSession(PAL::SessionID) const;
     std::unique_ptr<WebCore::NetworkStorageSession> newTestingSession(PAL::SessionID);
-#if PLATFORM(COCOA)
-    void ensureSession(PAL::SessionID, bool shouldUseTestingNetworkSession, const String& identifier, RetainPtr<CFHTTPCookieStorageRef>&&);
-#else
-    void ensureSession(PAL::SessionID, bool shouldUseTestingNetworkSession, const String& identifier);
-#endif
+    void addStorageSession(PAL::SessionID, bool shouldUseTestingNetworkSession, const Vector<uint8_t>& uiProcessCookieStorageIdentifier, const SandboxExtension::Handle&);
 
     void processWillSuspendImminentlyForTestingSync(CompletionHandler<void()>&&);
     void prepareToSuspend(bool isSuspensionImminent, CompletionHandler<void()>&&);
@@ -305,7 +301,7 @@
     bool parentProcessHasServiceWorkerEntitlement() const { return true; }
 #endif
 
-    const String& uiProcessBundleIdentifier() const { return m_uiProcessBundleIdentifier; }
+    const String& uiProcessBundleIdentifier() const;
 
     void ref() const override { ThreadSafeRefCounted<NetworkProcess>::ref(); }
     void deref() const override { ThreadSafeRefCounted<NetworkProcess>::deref(); }
@@ -483,7 +479,7 @@
     bool m_hasSetCacheModel { false };
     CacheModel m_cacheModel { CacheModel::DocumentViewer };
     bool m_suppressMemoryPressureHandler { false };
-    String m_uiProcessBundleIdentifier;
+    mutable String m_uiProcessBundleIdentifier;
     DownloadManager m_downloadManager;
 
     typedef HashMap<const char*, std::unique_ptr<NetworkProcessSupplement>, PtrHash<const char*>> NetworkProcessSupplementMap;
@@ -528,4 +524,11 @@
     bool m_ftpEnabled { false };
 };
 
+#if !PLATFORM(COCOA)
+inline const String& NetworkProcess::uiProcessBundleIdentifier() const
+{
+    return m_uiProcessBundleIdentifier;
+}
+#endif
+
 } // namespace WebKit

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -111,6 +111,18 @@
     return makeUniqueRef<PrivateClickMeasurementManager>(makeUniqueRef<PCM::ClientImpl>(networkSession, networkProcess), pcmStoreDirectory(networkSession, parameters.resourceLoadStatisticsParameters.directory, parameters.resourceLoadStatisticsParameters.privateClickMeasurementStorageDirectory));
 }
 
+static Ref<NetworkStorageManager> createNetworkStorageManager(IPC::Connection* connection, const NetworkSessionCreationParameters& parameters)
+{
+    SandboxExtension::consumePermanently(parameters.localStorageDirectoryExtensionHandle);
+    SandboxExtension::consumePermanently(parameters.indexedDBDirectoryExtensionHandle);
+    SandboxExtension::consumePermanently(parameters.cacheStorageDirectoryExtensionHandle);
+    SandboxExtension::consumePermanently(parameters.generalStorageDirectoryHandle);
+    IPC::Connection::UniqueID connectionID;
+    if (connection)
+        connectionID = connection->uniqueID();
+    return NetworkStorageManager::create(parameters.sessionID, connectionID, parameters.generalStorageDirectory, parameters.localStorageDirectory, parameters.indexedDBDirectory, parameters.cacheStorageDirectory, parameters.perOriginStorageQuota, parameters.perThirdPartyOriginStorageQuota, parameters.shouldUseCustomStoragePaths);
+}
+
 NetworkSession::NetworkSession(NetworkProcess& networkProcess, const NetworkSessionCreationParameters& parameters)
     : m_sessionID(parameters.sessionID)
     , m_networkProcess(networkProcess)
@@ -131,6 +143,7 @@
     , m_testSpeedMultiplier(parameters.testSpeedMultiplier)
     , m_allowsServerPreconnect(parameters.allowsServerPreconnect)
     , m_shouldRunServiceWorkersOnMainThreadForTesting(parameters.shouldRunServiceWorkersOnMainThreadForTesting)
+    , m_storageManager(createNetworkStorageManager(networkProcess.parentProcessConnection(), parameters))
 #if ENABLE(BUILT_IN_NOTIFICATIONS)
     , m_notificationManager(*this, parameters.webPushMachServiceName)
 #endif
@@ -169,6 +182,14 @@
     setResourceLoadStatisticsEnabled(parameters.resourceLoadStatisticsParameters.enabled);
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+    SandboxExtension::consumePermanently(parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
+    m_serviceWorkerInfo = ServiceWorkerInfo {
+        parameters.serviceWorkerRegistrationDirectory,
+        parameters.serviceWorkerProcessTerminationDelayEnabled
+    };
+#endif
+
 #if ENABLE(BUILT_IN_NOTIFICATIONS)
     m_networkProcess->addMessageReceiver(Messages::NotificationManagerMessageHandler::messageReceiverName(), m_sessionID.toUInt64(), m_notificationManager);
 #endif
@@ -206,8 +227,7 @@
     if (m_resourceLoadStatistics)
         m_resourceLoadStatistics->invalidateAndCancel();
 #endif
-    if (auto manager = std::exchange(m_storageManager, nullptr))
-        manager->close();
+    m_storageManager->close();
     m_cacheEngine = nullptr;
 #if ASSERT_ENABLED
     m_isInvalidated = true;
@@ -568,8 +588,7 @@
     if (m_swServer)
         m_swServer->handleLowMemoryWarning();
 #endif
-    if (m_storageManager)
-        m_storageManager->handleLowMemoryWarning();
+    m_storageManager->handleLowMemoryWarning();
 }
 
 #if ENABLE(SERVICE_WORKER)
@@ -635,17 +654,6 @@
     return *m_swServer;
 }
 
-void NetworkSession::addServiceWorkerSession(bool processTerminationDelayEnabled, String&& serviceWorkerRegistrationDirectory, const SandboxExtension::Handle& handle)
-{
-    bool hadServiceWorkerInfo = !!m_serviceWorkerInfo;
-    m_serviceWorkerInfo = ServiceWorkerInfo {
-        WTFMove(serviceWorkerRegistrationDirectory),
-        processTerminationDelayEnabled
-    };
-    if (!hadServiceWorkerInfo)
-        SandboxExtension::consumePermanently(handle);
-}
-
 bool NetworkSession::hasServiceWorkerDatabasePath() const
 {
     return m_serviceWorkerInfo && !m_serviceWorkerInfo->databasePath.isEmpty();
@@ -660,20 +668,6 @@
     return *m_sharedWorkerServer;
 }
 
-void NetworkSession::addStorageManagerSession(const String& generalStoragePath, SandboxExtension::Handle& generalStoragePathHandle, const String& localStoragePath, SandboxExtension::Handle& localStoragePathHandle, const String& idbStoragePath, SandboxExtension::Handle& idbStoragePathHandle, const String& cacheStoragePath, uint64_t defaultOriginQuota, uint64_t defaultThirdPartyQuota, bool shouldUseCustomStoragePaths)
-{
-    if (m_storageManager)
-        return;
-
-    SandboxExtension::consumePermanently(generalStoragePathHandle);
-    SandboxExtension::consumePermanently(localStoragePathHandle);
-    SandboxExtension::consumePermanently(idbStoragePathHandle);
-    IPC::Connection::UniqueID connectionID;
-    if (auto* connection = networkProcess().parentProcessConnection())
-        connectionID = connection->uniqueID();
-    m_storageManager = NetworkStorageManager::create(sessionID(), connectionID, generalStoragePath, localStoragePath, idbStoragePath, cacheStoragePath, defaultOriginQuota, defaultThirdPartyQuota, shouldUseCustomStoragePaths);
-}
-
 void NetworkSession::ensureCacheEngine(Function<void(CacheStorage::Engine&)>&& callback)
 {
     if (m_cacheEngine)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSession.h (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkSession.h	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSession.h	2022-03-03 05:08:03 UTC (rev 290766)
@@ -208,16 +208,12 @@
     void unregisterSWServerConnection(WebSWServerConnection&);
 
     bool hasServiceWorkerDatabasePath() const;
-
-    void addServiceWorkerSession(bool processTerminationDelayEnabled, String&& serviceWorkerRegistrationDirectory, const SandboxExtension::Handle&);
 #endif
 
     WebSharedWorkerServer* sharedWorkerServer() { return m_sharedWorkerServer.get(); }
     WebSharedWorkerServer& ensureSharedWorkerServer();
 
-    NetworkStorageManager* storageManager() { return m_storageManager.get(); }
-    void addStorageManagerSession(const String& generalStoragePath, SandboxExtension::Handle& generalStoragePathHandle, const String& localStoragePath, SandboxExtension::Handle& localStoragePathHandle, const String& idbStoragePath, SandboxExtension::Handle& idbStoragePathHandle, const String& cacheStoragePath, uint64_t defaultOriginQuota, uint64_t defaultThirdPartyQuota, bool shouldUseCustomStoragePaths);
-
+    NetworkStorageManager& storageManager() { return m_storageManager.get(); }
     CacheStorage::Engine* cacheEngine() { return m_cacheEngine.get(); }
     void ensureCacheEngine(Function<void(CacheStorage::Engine&)>&&);
     void clearCacheEngine();
@@ -320,7 +316,7 @@
 #endif
     std::unique_ptr<WebSharedWorkerServer> m_sharedWorkerServer;
 
-    RefPtr<NetworkStorageManager> m_storageManager;
+    Ref<NetworkStorageManager> m_storageManager;
     RefPtr<CacheStorage::Engine> m_cacheEngine;
     Vector<Function<void(CacheStorage::Engine&)>> m_cacheStorageParametersCallbacks;
 

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -95,6 +95,16 @@
 #if !HAVE(NSURLSESSION_WEBSOCKET)
     encoder << shouldAcceptInsecureCertificatesForWebSockets;
 #endif
+
+    encoder << shouldUseCustomStoragePaths;
+    encoder << perOriginStorageQuota << perThirdPartyOriginStorageQuota;
+    encoder << localStorageDirectory << localStorageDirectoryExtensionHandle;
+    encoder << indexedDBDirectory << indexedDBDirectoryExtensionHandle;
+    encoder << cacheStorageDirectory << cacheStorageDirectoryExtensionHandle;
+    encoder << generalStorageDirectory << generalStorageDirectoryHandle;
+#if ENABLE(SERVICE_WORKER)
+    encoder << serviceWorkerRegistrationDirectory << serviceWorkerRegistrationDirectoryExtensionHandle << serviceWorkerProcessTerminationDelayEnabled;
+#endif
     encoder << resourceLoadStatisticsParameters;
 }
 
@@ -334,6 +344,78 @@
         return std::nullopt;
 #endif
 
+    std::optional<bool> shouldUseCustomStoragePaths;
+    decoder >> shouldUseCustomStoragePaths;
+    if (!shouldUseCustomStoragePaths)
+        return std::nullopt;
+
+    std::optional<uint64_t> perOriginStorageQuota;
+    decoder >> perOriginStorageQuota;
+    if (!perOriginStorageQuota)
+        return std::nullopt;
+
+    std::optional<uint64_t> perThirdPartyOriginStorageQuota;
+    decoder >> perThirdPartyOriginStorageQuota;
+    if (!perThirdPartyOriginStorageQuota)
+        return std::nullopt;
+
+    std::optional<String> localStorageDirectory;
+    decoder >> localStorageDirectory;
+    if (!localStorageDirectory)
+        return std::nullopt;
+
+    std::optional<SandboxExtension::Handle> localStorageDirectoryExtensionHandle;
+    decoder >> localStorageDirectoryExtensionHandle;
+    if (!localStorageDirectoryExtensionHandle)
+        return std::nullopt;
+
+    std::optional<String> indexedDBDirectory;
+    decoder >> indexedDBDirectory;
+    if (!indexedDBDirectory)
+        return std::nullopt;
+    
+    std::optional<SandboxExtension::Handle> indexedDBDirectoryExtensionHandle;
+    decoder >> indexedDBDirectoryExtensionHandle;
+    if (!indexedDBDirectoryExtensionHandle)
+        return std::nullopt;
+
+    std::optional<String> cacheStorageDirectory;
+    decoder >> cacheStorageDirectory;
+    if (!cacheStorageDirectory)
+        return std::nullopt;
+
+    std::optional<SandboxExtension::Handle> cacheStorageDirectoryExtensionHandle;
+    decoder >> cacheStorageDirectoryExtensionHandle;
+    if (!cacheStorageDirectoryExtensionHandle)
+        return std::nullopt;
+
+    std::optional<String> generalStorageDirectory;
+    decoder >> generalStorageDirectory;
+    if (!generalStorageDirectory)
+        return std::nullopt;
+
+    std::optional<SandboxExtension::Handle> generalStorageDirectoryHandle;
+    decoder >> generalStorageDirectoryHandle;
+    if (!generalStorageDirectoryHandle)
+        return std::nullopt;
+
+#if ENABLE(SERVICE_WORKER)
+    std::optional<String> serviceWorkerRegistrationDirectory;
+    decoder >> serviceWorkerRegistrationDirectory;
+    if (!serviceWorkerRegistrationDirectory)
+        return std::nullopt;
+    
+    std::optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle;
+    decoder >> serviceWorkerRegistrationDirectoryExtensionHandle;
+    if (!serviceWorkerRegistrationDirectoryExtensionHandle)
+        return std::nullopt;
+    
+    std::optional<bool> serviceWorkerProcessTerminationDelayEnabled;
+    decoder >> serviceWorkerProcessTerminationDelayEnabled;
+    if (!serviceWorkerProcessTerminationDelayEnabled)
+        return std::nullopt;
+#endif
+
     std::optional<ResourceLoadStatisticsParameters> resourceLoadStatisticsParameters;
     decoder >> resourceLoadStatisticsParameters;
     if (!resourceLoadStatisticsParameters)
@@ -395,6 +477,22 @@
 #if !HAVE(NSURLSESSION_WEBSOCKET)
         , WTFMove(*shouldAcceptInsecureCertificatesForWebSockets)
 #endif
+        , *shouldUseCustomStoragePaths
+        , WTFMove(*perOriginStorageQuota)
+        , WTFMove(*perThirdPartyOriginStorageQuota)
+        , WTFMove(*localStorageDirectory)
+        , WTFMove(*localStorageDirectoryExtensionHandle)
+        , WTFMove(*indexedDBDirectory)
+        , WTFMove(*indexedDBDirectoryExtensionHandle)
+        , WTFMove(*cacheStorageDirectory)
+        , WTFMove(*cacheStorageDirectoryExtensionHandle)
+        , WTFMove(*generalStorageDirectory)
+        , WTFMove(*generalStorageDirectoryHandle)
+#if ENABLE(SERVICE_WORKER)
+        , WTFMove(*serviceWorkerRegistrationDirectory)
+        , WTFMove(*serviceWorkerRegistrationDirectoryExtensionHandle)
+        , *serviceWorkerProcessTerminationDelayEnabled
+#endif
         , WTFMove(*resourceLoadStatisticsParameters)
     }};
 }

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h	2022-03-03 05:08:03 UTC (rev 290766)
@@ -112,6 +112,23 @@
     bool shouldAcceptInsecureCertificatesForWebSockets { false };
 #endif
 
+    bool shouldUseCustomStoragePaths { false };
+    uint64_t perOriginStorageQuota;
+    uint64_t perThirdPartyOriginStorageQuota;
+    String localStorageDirectory;
+    SandboxExtension::Handle localStorageDirectoryExtensionHandle;
+    String indexedDBDirectory;
+    SandboxExtension::Handle indexedDBDirectoryExtensionHandle;
+    String cacheStorageDirectory;
+    SandboxExtension::Handle cacheStorageDirectoryExtensionHandle;
+    String generalStorageDirectory;
+    SandboxExtension::Handle generalStorageDirectoryHandle;
+#if ENABLE(SERVICE_WORKER)
+    String serviceWorkerRegistrationDirectory;
+    SandboxExtension::Handle serviceWorkerRegistrationDirectoryExtensionHandle;
+    bool serviceWorkerProcessTerminationDelayEnabled { true };
+#endif
+
     ResourceLoadStatisticsParameters resourceLoadStatisticsParameters;
 };
 

Deleted: trunk/Source/WebKit/NetworkProcess/RemoteNetworkingContext.h (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/RemoteNetworkingContext.h	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/RemoteNetworkingContext.h	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2013 University of Szeged. 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
-
-namespace WebKit {
-
-class NetworkProcess;
-struct WebsiteDataStoreParameters;
-
-class RemoteNetworkingContext {
-public:
-    // FIXME: Remove platform-specific code.
-    static void ensureWebsiteDataStoreSession(NetworkProcess&, const WebsiteDataStoreParameters&);
-};
-
-}

Modified: trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngine.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -245,11 +245,7 @@
     if (!session)
         callback(false);
 
-    auto* storageManager = session->storageManager();
-    if (!storageManager)
-        callback(false);
-
-    storageManager->requestSpace(origin, spaceRequested, WTFMove(callback));
+    session->storageManager().requestSpace(origin, spaceRequested, WTFMove(callback));
 }
 
 Engine::Engine(NetworkSession& networkSession, String&& rootPath)

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2022-03-03 05:08:03 UTC (rev 290766)
@@ -255,4 +255,12 @@
 }
 #endif
 
+const String& NetworkProcess::uiProcessBundleIdentifier() const
+{
+    if (m_uiProcessBundleIdentifier.isNull())
+        m_uiProcessBundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
+
+    return m_uiProcessBundleIdentifier;
+}
+
 } // namespace WebKit

Deleted: trunk/Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/curl/RemoteNetworkingContextCurl.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1,48 +0,0 @@
-/*
- * 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 "RemoteNetworkingContext.h"
-
-#include "NetworkProcess.h"
-#include "NetworkSession.h"
-#include "WebsiteDataStoreParameters.h"
-#include <WebCore/NetworkStorageSession.h>
-
-namespace WebKit {
-
-using namespace WebCore;
-
-void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& networkProcess, const WebsiteDataStoreParameters& parameters)
-{
-    auto sessionID = parameters.networkSessionParameters.sessionID;
-    if (networkProcess.storageSession(sessionID))
-        return;
-
-    networkProcess.ensureSession(sessionID, parameters.networkSessionParameters.shouldUseTestingNetworkSession, String::number(sessionID.toUInt64()));
-    networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, parameters.networkSessionParameters));
-}
-
-}

Deleted: trunk/Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2012 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 "RemoteNetworkingContext.h"
-
-#import "CookieStorageUtilsCF.h"
-#import "LegacyCustomProtocolManager.h"
-#import "NetworkProcess.h"
-#import "NetworkSession.h"
-#import "NetworkSessionCreationParameters.h"
-#import "WebErrors.h"
-#import "WebsiteDataStoreParameters.h"
-#import <WebCore/NetworkStorageSession.h>
-#import <WebCore/ResourceError.h>
-#import <pal/SessionID.h>
-#import <wtf/MainThread.h>
-#import <wtf/text/StringConcatenateNumbers.h>
-
-namespace WebKit {
-
-void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& networkProcess, const WebsiteDataStoreParameters& parameters)
-{
-    auto sessionID = parameters.networkSessionParameters.sessionID;
-    if (networkProcess.storageSession(sessionID))
-        return;
-
-    String base = networkProcess.uiProcessBundleIdentifier();
-    if (base.isNull())
-        base = [[NSBundle mainBundle] bundleIdentifier];
-
-    if (!sessionID.isEphemeral())
-        SandboxExtension::consumePermanently(parameters.cookieStoragePathExtensionHandle);
-
-    RetainPtr<CFHTTPCookieStorageRef> uiProcessCookieStorage;
-    if (!sessionID.isEphemeral() && !parameters.uiProcessCookieStorageIdentifier.isEmpty() && parameters.networkSessionParameters.sessionID != PAL::SessionID::defaultSessionID())
-        uiProcessCookieStorage = cookieStorageFromIdentifyingData(parameters.uiProcessCookieStorageIdentifier);
-
-    networkProcess.ensureSession(sessionID, parameters.networkSessionParameters.shouldUseTestingNetworkSession, makeString(base, '.', sessionID.toUInt64()), WTFMove(uiProcessCookieStorage));
-
-    networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, parameters.networkSessionParameters));
-}
-
-}

Deleted: trunk/Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp (290765 => 290766)


--- trunk/Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/NetworkProcess/soup/RemoteNetworkingContextSoup.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- * Copyright (C) 2013 University of Szeged. All rights reserved.
- * Copyright (C) 2013 Company 100 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 "RemoteNetworkingContext.h"
-
-#include "NetworkProcess.h"
-#include "NetworkSession.h"
-#include "WebsiteDataStoreParameters.h"
-#include <WebCore/NetworkStorageSession.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-void RemoteNetworkingContext::ensureWebsiteDataStoreSession(NetworkProcess& networkProcess, const WebsiteDataStoreParameters& parameters)
-{
-    auto sessionID = parameters.networkSessionParameters.sessionID;
-    if (networkProcess.storageSession(sessionID))
-        return;
-
-    networkProcess.ensureSession(sessionID, parameters.networkSessionParameters.shouldUseTestingNetworkSession, String::number(sessionID.toUInt64()));
-    networkProcess.setSession(sessionID, NetworkSession::create(networkProcess, parameters.networkSessionParameters));
-}
-
-}

Modified: trunk/Source/WebKit/PlatformPlayStation.cmake (290765 => 290766)


--- trunk/Source/WebKit/PlatformPlayStation.cmake	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/PlatformPlayStation.cmake	2022-03-03 05:08:03 UTC (rev 290766)
@@ -48,7 +48,6 @@
     NetworkProcess/curl/NetworkProcessCurl.cpp
     NetworkProcess/curl/NetworkProcessMainCurl.cpp
     NetworkProcess/curl/NetworkSessionCurl.cpp
-    NetworkProcess/curl/RemoteNetworkingContextCurl.cpp
 
     Platform/IPC/unix/AttachmentUnix.cpp
     Platform/IPC/unix/ConnectionUnix.cpp

Modified: trunk/Source/WebKit/PlatformWin.cmake (290765 => 290766)


--- trunk/Source/WebKit/PlatformWin.cmake	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/PlatformWin.cmake	2022-03-03 05:08:03 UTC (rev 290766)
@@ -176,7 +176,6 @@
         NetworkProcess/curl/NetworkDataTaskCurl.cpp
         NetworkProcess/curl/NetworkProcessCurl.cpp
         NetworkProcess/curl/NetworkSessionCurl.cpp
-        NetworkProcess/curl/RemoteNetworkingContextCurl.cpp
 
         Shared/API/c/cairo/WKImageCairo.cpp
 

Modified: trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp (290765 => 290766)


--- trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -31,9 +31,7 @@
 
 namespace WebKit {
 
-WebsiteDataStoreParameters::~WebsiteDataStoreParameters()
-{
-}
+WebsiteDataStoreParameters::~WebsiteDataStoreParameters() = default;
 
 void WebsiteDataStoreParameters::encode(IPC::Encoder& encoder) const
 {
@@ -40,20 +38,6 @@
     encoder << networkSessionParameters;
     encoder << uiProcessCookieStorageIdentifier;
     encoder << cookieStoragePathExtensionHandle;
-    encoder << indexedDatabaseDirectory << indexedDatabaseDirectoryExtensionHandle;
-
-#if ENABLE(SERVICE_WORKER)
-    encoder << serviceWorkerRegistrationDirectory << serviceWorkerRegistrationDirectoryExtensionHandle << serviceWorkerProcessTerminationDelayEnabled;
-#endif
-
-    encoder << localStorageDirectory << localStorageDirectoryExtensionHandle;
-    encoder << cacheStorageDirectory << cacheStorageDirectoryExtensionHandle;
-    encoder << generalStorageDirectory << generalStorageDirectoryHandle;
-
-    encoder << perOriginStorageQuota;
-    encoder << perThirdPartyOriginStorageQuota;
-
-    encoder << shouldUseCustomStoragePaths;
 }
 
 std::optional<WebsiteDataStoreParameters> WebsiteDataStoreParameters::decode(IPC::Decoder& decoder)
@@ -78,92 +62,6 @@
         return std::nullopt;
     parameters.cookieStoragePathExtensionHandle = WTFMove(*cookieStoragePathExtensionHandle);
 
-    std::optional<String> indexedDatabaseDirectory;
-    decoder >> indexedDatabaseDirectory;
-    if (!indexedDatabaseDirectory)
-        return std::nullopt;
-    parameters.indexedDatabaseDirectory = WTFMove(*indexedDatabaseDirectory);
-    
-    std::optional<SandboxExtension::Handle> indexedDatabaseDirectoryExtensionHandle;
-    decoder >> indexedDatabaseDirectoryExtensionHandle;
-    if (!indexedDatabaseDirectoryExtensionHandle)
-        return std::nullopt;
-    parameters.indexedDatabaseDirectoryExtensionHandle = WTFMove(*indexedDatabaseDirectoryExtensionHandle);
-
-#if ENABLE(SERVICE_WORKER)
-    std::optional<String> serviceWorkerRegistrationDirectory;
-    decoder >> serviceWorkerRegistrationDirectory;
-    if (!serviceWorkerRegistrationDirectory)
-        return std::nullopt;
-    parameters.serviceWorkerRegistrationDirectory = WTFMove(*serviceWorkerRegistrationDirectory);
-    
-    std::optional<SandboxExtension::Handle> serviceWorkerRegistrationDirectoryExtensionHandle;
-    decoder >> serviceWorkerRegistrationDirectoryExtensionHandle;
-    if (!serviceWorkerRegistrationDirectoryExtensionHandle)
-        return std::nullopt;
-    parameters.serviceWorkerRegistrationDirectoryExtensionHandle = WTFMove(*serviceWorkerRegistrationDirectoryExtensionHandle);
-    
-    std::optional<bool> serviceWorkerProcessTerminationDelayEnabled;
-    decoder >> serviceWorkerProcessTerminationDelayEnabled;
-    if (!serviceWorkerProcessTerminationDelayEnabled)
-        return std::nullopt;
-    parameters.serviceWorkerProcessTerminationDelayEnabled = WTFMove(*serviceWorkerProcessTerminationDelayEnabled);
-#endif
-
-    std::optional<String> localStorageDirectory;
-    decoder >> localStorageDirectory;
-    if (!localStorageDirectory)
-        return std::nullopt;
-    parameters.localStorageDirectory = WTFMove(*localStorageDirectory);
-
-    std::optional<SandboxExtension::Handle> localStorageDirectoryExtensionHandle;
-    decoder >> localStorageDirectoryExtensionHandle;
-    if (!localStorageDirectoryExtensionHandle)
-        return std::nullopt;
-    parameters.localStorageDirectoryExtensionHandle = WTFMove(*localStorageDirectoryExtensionHandle);
-
-    std::optional<String> cacheStorageDirectory;
-    decoder >> cacheStorageDirectory;
-    if (!cacheStorageDirectory)
-        return std::nullopt;
-    parameters.cacheStorageDirectory = WTFMove(*cacheStorageDirectory);
-
-    std::optional<SandboxExtension::Handle> cacheStorageDirectoryExtensionHandle;
-    decoder >> cacheStorageDirectoryExtensionHandle;
-    if (!cacheStorageDirectoryExtensionHandle)
-        return std::nullopt;
-    parameters.cacheStorageDirectoryExtensionHandle = WTFMove(*cacheStorageDirectoryExtensionHandle);
-
-    std::optional<String> generalStorageDirectory;
-    decoder >> generalStorageDirectory;
-    if (!generalStorageDirectory)
-        return std::nullopt;
-    parameters.generalStorageDirectory = WTFMove(*generalStorageDirectory);
-
-    std::optional<SandboxExtension::Handle> generalStorageDirectoryHandle;
-    decoder >> generalStorageDirectoryHandle;
-    if (!generalStorageDirectoryHandle)
-        return std::nullopt;
-    parameters.generalStorageDirectoryHandle = WTFMove(*generalStorageDirectoryHandle);
-
-    std::optional<uint64_t> perOriginStorageQuota;
-    decoder >> perOriginStorageQuota;
-    if (!perOriginStorageQuota)
-        return std::nullopt;
-    parameters.perOriginStorageQuota = *perOriginStorageQuota;
-
-    std::optional<uint64_t> perThirdPartyOriginStorageQuota;
-    decoder >> perThirdPartyOriginStorageQuota;
-    if (!perThirdPartyOriginStorageQuota)
-        return std::nullopt;
-    parameters.perThirdPartyOriginStorageQuota = *perThirdPartyOriginStorageQuota;
-
-    std::optional<bool> shouldUseCustomStoragePaths;
-    decoder >> shouldUseCustomStoragePaths;
-    if (!shouldUseCustomStoragePaths)
-        return std::nullopt;
-    parameters.shouldUseCustomStoragePaths = *shouldUseCustomStoragePaths;
-    
     return parameters;
 }
 

Modified: trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h (290765 => 290766)


--- trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/Shared/WebsiteDataStoreParameters.h	2022-03-03 05:08:03 UTC (rev 290766)
@@ -52,29 +52,6 @@
     Vector<uint8_t> uiProcessCookieStorageIdentifier;
     SandboxExtension::Handle cookieStoragePathExtensionHandle;
     NetworkSessionCreationParameters networkSessionParameters;
-
-    String indexedDatabaseDirectory;
-    SandboxExtension::Handle indexedDatabaseDirectoryExtensionHandle;
-
-#if ENABLE(SERVICE_WORKER)
-    String serviceWorkerRegistrationDirectory;
-    SandboxExtension::Handle serviceWorkerRegistrationDirectoryExtensionHandle;
-    bool serviceWorkerProcessTerminationDelayEnabled { true };
-#endif
-
-    String localStorageDirectory;
-    SandboxExtension::Handle localStorageDirectoryExtensionHandle;
-
-    String cacheStorageDirectory;
-    SandboxExtension::Handle cacheStorageDirectoryExtensionHandle;
-
-    String generalStorageDirectory;
-    SandboxExtension::Handle generalStorageDirectoryHandle;
-
-    uint64_t perOriginStorageQuota;
-    uint64_t perThirdPartyOriginStorageQuota;
-
-    bool shouldUseCustomStoragePaths { false };
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/SourcesCocoa.txt (290765 => 290766)


--- trunk/Source/WebKit/SourcesCocoa.txt	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2022-03-03 05:08:03 UTC (rev 290766)
@@ -54,7 +54,6 @@
 NetworkProcess/ios/NetworkProcessIOS.mm
 
 NetworkProcess/mac/NetworkProcessMac.mm
-NetworkProcess/mac/RemoteNetworkingContext.mm
 
 NetworkProcess/webrtc/LibWebRTCSocketClient.cpp
 NetworkProcess/webrtc/NetworkRTCMonitor.cpp

Modified: trunk/Source/WebKit/SourcesGTK.txt (290765 => 290766)


--- trunk/Source/WebKit/SourcesGTK.txt	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/SourcesGTK.txt	2022-03-03 05:08:03 UTC (rev 290766)
@@ -42,7 +42,6 @@
 NetworkProcess/soup/NetworkProcessMainSoup.cpp
 NetworkProcess/soup/NetworkProcessSoup.cpp
 NetworkProcess/soup/NetworkSessionSoup.cpp
-NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
 NetworkProcess/soup/WebKitDirectoryInputStream.cpp
 NetworkProcess/soup/WebSocketTaskSoup.cpp
 

Modified: trunk/Source/WebKit/SourcesWPE.txt (290765 => 290766)


--- trunk/Source/WebKit/SourcesWPE.txt	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/SourcesWPE.txt	2022-03-03 05:08:03 UTC (rev 290766)
@@ -42,7 +42,6 @@
 NetworkProcess/soup/NetworkProcessMainSoup.cpp
 NetworkProcess/soup/NetworkProcessSoup.cpp
 NetworkProcess/soup/NetworkSessionSoup.cpp
-NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
 NetworkProcess/soup/WebKitDirectoryInputStream.cpp
 NetworkProcess/soup/WebSocketTaskSoup.cpp
 

Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (290765 => 290766)


--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1420,7 +1420,7 @@
         send(Messages::NetworkProcess::AddWebsiteDataStore { store.parameters() }, 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
     auto sessionID = store.sessionID();
     if (!sessionID.isEphemeral())
-        createSymLinkForFileUpgrade(store.resolvedIndexedDatabaseDirectory());
+        createSymLinkForFileUpgrade(store.resolvedIndexedDBDatabaseDirectory());
 }
 
 void NetworkProcessProxy::removeSession(WebsiteDataStore& websiteDataStore)

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (290765 => 290766)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2022-03-03 05:08:03 UTC (rev 290766)
@@ -1843,55 +1843,52 @@
 #if !HAVE(NSURLSESSION_WEBSOCKET)
     networkSessionParameters.shouldAcceptInsecureCertificatesForWebSockets = m_configuration->shouldAcceptInsecureCertificatesForWebSockets();
 #endif
+    networkSessionParameters.shouldUseCustomStoragePaths = m_configuration->shouldUseCustomStoragePaths();
+    networkSessionParameters.perOriginStorageQuota = perOriginStorageQuota();
+    networkSessionParameters.perThirdPartyOriginStorageQuota = perThirdPartyOriginStorageQuota();
 
-    parameters.networkSessionParameters = WTFMove(networkSessionParameters);
+    if (auto directory = resolvedLocalStorageDirectory(); !directory.isEmpty()) {
+        networkSessionParameters.localStorageDirectory = directory;
+        // FIXME: SandboxExtension::createHandleForReadWriteDirectory resolves the directory, but that has already been done. Remove this duplicate work.
+        if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(directory))
+            networkSessionParameters.localStorageDirectoryExtensionHandle = WTFMove(*handle);
+#if PLATFORM(IOS_FAMILY)
+        // FIXME: we should move file system operations to background thread.
+        FileSystem::makeAllDirectories(directory);
+        FileSystem::excludeFromBackup(directory);
+#endif
+    }
 
-    parameters.indexedDatabaseDirectory = resolvedIndexedDatabaseDirectory();
-    if (!parameters.indexedDatabaseDirectory.isEmpty()) {
+    if (auto directory = resolvedIndexedDBDatabaseDirectory(); !directory.isEmpty()) {
+        networkSessionParameters.indexedDBDirectory = directory;
         // FIXME: SandboxExtension::createHandleForReadWriteDirectory resolves the directory, but that has already been done. Remove this duplicate work.
-        if (auto handle =  SandboxExtension::createHandleForReadWriteDirectory(parameters.indexedDatabaseDirectory))
-            parameters.indexedDatabaseDirectoryExtensionHandle = WTFMove(*handle);
+        if (auto handle =  SandboxExtension::createHandleForReadWriteDirectory(directory))
+            networkSessionParameters.indexedDBDirectoryExtensionHandle = WTFMove(*handle);
     }
 
 #if ENABLE(SERVICE_WORKER)
-    parameters.serviceWorkerRegistrationDirectory = resolvedServiceWorkerRegistrationDirectory();
-    if (!parameters.serviceWorkerRegistrationDirectory.isEmpty()) {
+    if (auto directory = resolvedServiceWorkerRegistrationDirectory(); !directory.isEmpty()) {
+        networkSessionParameters.serviceWorkerRegistrationDirectory = directory;
         // FIXME: SandboxExtension::createHandleForReadWriteDirectory resolves the directory, but that has already been done. Remove this duplicate work.
-        if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(parameters.serviceWorkerRegistrationDirectory))
-            parameters.serviceWorkerRegistrationDirectoryExtensionHandle = WTFMove(*handle);
+        if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(directory))
+            networkSessionParameters.serviceWorkerRegistrationDirectoryExtensionHandle = WTFMove(*handle);
     }
-    parameters.serviceWorkerProcessTerminationDelayEnabled = m_configuration->serviceWorkerProcessTerminationDelayEnabled();
+    networkSessionParameters.serviceWorkerProcessTerminationDelayEnabled = m_configuration->serviceWorkerProcessTerminationDelayEnabled();
 #endif
 
-    auto localStorageDirectory = resolvedLocalStorageDirectory();
-    if (!localStorageDirectory.isEmpty()) {
-        parameters.localStorageDirectory = localStorageDirectory;
-        // FIXME: SandboxExtension::createHandleForReadWriteDirectory resolves the directory, but that has already been done. Remove this duplicate work.
-        if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(localStorageDirectory))
-            parameters.localStorageDirectoryExtensionHandle = WTFMove(*handle);
-#if PLATFORM(IOS_FAMILY)
-        FileSystem::makeAllDirectories(localStorageDirectory);
-        FileSystem::excludeFromBackup(localStorageDirectory);
-#endif
+    if (auto directory = resolvedGeneralStorageDirectory(); !directory.isEmpty()) {
+        networkSessionParameters.generalStorageDirectory = directory;
+        if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(directory))
+            networkSessionParameters.generalStorageDirectoryHandle = WTFMove(*handle);
     }
 
-    auto cacheStorageDirectory = this->cacheStorageDirectory();
-    if (!cacheStorageDirectory.isEmpty()) {
-        parameters.cacheStorageDirectory = cacheStorageDirectory;
-        if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(cacheStorageDirectory))
-            parameters.cacheStorageDirectoryExtensionHandle = WTFMove(*handle);
-    }
-
-    if (auto directory = resolvedGeneralStorageDirectory(); !directory.isEmpty()) {
-        parameters.generalStorageDirectory = directory;
+    if (auto directory = cacheStorageDirectory(); !directory.isEmpty()) {
+        networkSessionParameters.cacheStorageDirectory = directory;
         if (auto handle = SandboxExtension::createHandleForReadWriteDirectory(directory))
-            parameters.generalStorageDirectoryHandle = WTFMove(*handle);
+            networkSessionParameters.cacheStorageDirectoryExtensionHandle = WTFMove(*handle);
     }
-    parameters.shouldUseCustomStoragePaths = configuration().shouldUseCustomStoragePaths();
 
-    parameters.perOriginStorageQuota = perOriginStorageQuota();
-    parameters.perThirdPartyOriginStorageQuota = perThirdPartyOriginStorageQuota();
-
+    parameters.networkSessionParameters = WTFMove(networkSessionParameters);
 #if ENABLE(INTELLIGENT_TRACKING_PREVENTION)
     parameters.networkSessionParameters.resourceLoadStatisticsParameters.enabled = m_resourceLoadStatisticsEnabled;
 #endif
@@ -1900,7 +1897,7 @@
     parameters.networkSessionParameters.appHasRequestedCrossWebsiteTrackingPermission = hasRequestedCrossWebsiteTrackingPermission();
     parameters.networkSessionParameters.useNetworkLoader = useNetworkLoader();
 #endif
-    
+
     return parameters;
 }
 

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (290765 => 290766)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2022-03-03 05:05:11 UTC (rev 290765)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2022-03-03 05:08:03 UTC (rev 290766)
@@ -253,7 +253,7 @@
     const String& resolvedDatabaseDirectory() const { return m_resolvedConfiguration->webSQLDatabaseDirectory(); }
     const String& resolvedJavaScriptConfigurationDirectory() const { return m_resolvedConfiguration->_javascript_ConfigurationDirectory(); }
     const String& resolvedCookieStorageFile() const { return m_resolvedConfiguration->cookieStorageFile(); }
-    const String& resolvedIndexedDatabaseDirectory() const { return m_resolvedConfiguration->indexedDBDatabaseDirectory(); }
+    const String& resolvedIndexedDBDatabaseDirectory() const { return m_resolvedConfiguration->indexedDBDatabaseDirectory(); }
     const String& resolvedServiceWorkerRegistrationDirectory() const { return m_resolvedConfiguration->serviceWorkerRegistrationDirectory(); }
     const String& resolvedResourceLoadStatisticsDirectory() const { return m_resolvedConfiguration->resourceLoadStatisticsDirectory(); }
     const String& resolvedHSTSStorageDirectory() const { return m_resolvedConfiguration->hstsStorageDirectory(); }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to