Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteData...
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2019 22:07:09 +0000 (22:07 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 4 Apr 2019 22:07:09 +0000 (22:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196543

Reviewed by Alex Christensen.

Source/WebCore:

Add a default routine to compute a third party quota from a per origin quota.
No change of behavior.

* storage/StorageQuotaManager.h:
(WebCore::StorageQuotaManager::defaultThirdPartyQuotaFromPerOriginQuota):
(WebCore::StorageQuotaManager::defaultThirdPartyQuota):

Source/WebKit:

Renamed methods used to set cache storage quota to be storage generic
since they will apply to all storage.

Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
to NetworkProcess (start-up time and new WebsiteDataStore time).

Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::addWebsiteDataStore):
(WebKit::NetworkProcess::initializeStorageQuota):
(WebKit::NetworkProcess::setCacheStorageParameters):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcess.messages.in:
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
(WKWebsiteDataStoreSetPerOriginStorageQuota):
(WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
* UIProcess/API/C/WKWebsiteDataStoreRef.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _perOriginStorageQuota]):
(-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
(-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
(-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
* UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::WebsiteDataStore::parameters):
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::perOriginStorageQuota const):
(WebKit::WebsiteDataStore::setPerOriginStorageQuota):
(WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
(WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
(WebKit::WebsiteDataStoreConfiguration::copy):
* UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
(WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
(WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
(WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
(WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::generatePageConfiguration):

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

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/storage/StorageQuotaManager.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.h
Source/WebKit/NetworkProcess/NetworkProcess.messages.in
Source/WebKit/Shared/WebsiteDataStoreParameters.cpp
Source/WebKit/Shared/WebsiteDataStoreParameters.h
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.cpp
Source/WebKit/UIProcess/API/C/WKWebsiteDataStoreRef.h
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp

index a189b5d..fcd5273 100644 (file)
@@ -1,3 +1,17 @@
+2019-04-04  Youenn Fablet  <youenn@apple.com>
+
+        Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
+        https://bugs.webkit.org/show_bug.cgi?id=196543
+
+        Reviewed by Alex Christensen.
+
+        Add a default routine to compute a third party quota from a per origin quota.
+        No change of behavior.
+
+        * storage/StorageQuotaManager.h:
+        (WebCore::StorageQuotaManager::defaultThirdPartyQuotaFromPerOriginQuota):
+        (WebCore::StorageQuotaManager::defaultThirdPartyQuota):
+
 2019-04-04  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r243807 and r243824.
index 44d4fbf..4935ad9 100644 (file)
@@ -46,8 +46,10 @@ public:
     }
     WEBCORE_EXPORT ~StorageQuotaManager();
 
+    static constexpr uint64_t defaultThirdPartyQuotaFromPerOriginQuota(uint64_t quota) { return quota / 10; }
+
     static constexpr uint64_t defaultQuota() { return 1000 * MB; }
-    static constexpr uint64_t defaultThirdPartyQuota() { return 100 * MB; }
+    static constexpr uint64_t defaultThirdPartyQuota() { return defaultThirdPartyQuotaFromPerOriginQuota(defaultQuota()); }
 
     WEBCORE_EXPORT void addUser(StorageQuotaUser&);
     WEBCORE_EXPORT void removeUser(StorageQuotaUser&);
index 503e728..8b5d4dc 100644 (file)
@@ -1,3 +1,56 @@
+2019-04-04  Youenn Fablet  <youenn@apple.com>
+
+        Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
+        https://bugs.webkit.org/show_bug.cgi?id=196543
+
+        Reviewed by Alex Christensen.
+
+        Renamed methods used to set cache storage quota to be storage generic
+        since they will apply to all storage.
+
+        Pass quota parameters as part of WebsiteDataStoreParameters from UIProcess
+        to NetworkProcess (start-up time and new WebsiteDataStore time).
+
+        Compute on UIProcess the quota for third party origins using the default rule of dividing by 10.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::addWebsiteDataStore):
+        (WebKit::NetworkProcess::initializeStorageQuota):
+        (WebKit::NetworkProcess::setCacheStorageParameters):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcess.messages.in:
+        * Shared/WebsiteDataStoreParameters.cpp:
+        (WebKit::WebsiteDataStoreParameters::encode const):
+        (WebKit::WebsiteDataStoreParameters::decode):
+        * Shared/WebsiteDataStoreParameters.h:
+        * UIProcess/API/C/WKWebsiteDataStoreRef.cpp:
+        (WKWebsiteDataStoreSetPerOriginStorageQuota):
+        (WKWebsiteDataStoreSetCacheStoragePerOriginQuota): Deleted.
+        * UIProcess/API/C/WKWebsiteDataStoreRef.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _perOriginStorageQuota]):
+        (-[WKWebsiteDataStore _setPerOriginStorageQuota:]):
+        (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]): Deleted.
+        (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+        * UIProcess/Network/NetworkProcessProxy.cpp:
+        (WebKit::NetworkProcessProxy::retrieveCacheStorageParameters):
+        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+        (WebKit::WebsiteDataStore::parameters):
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::perOriginStorageQuota const):
+        (WebKit::WebsiteDataStore::setPerOriginStorageQuota):
+        (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const): Deleted.
+        (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota): Deleted.
+        * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp:
+        (WebKit::WebsiteDataStoreConfiguration::copy):
+        * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h:
+        (WebKit::WebsiteDataStoreConfiguration::perOriginStorageQuota):
+        (WebKit::WebsiteDataStoreConfiguration::setPerOriginStorageQuota):
+        (WebKit::WebsiteDataStoreConfiguration::cacheStoragePerOriginQuota): Deleted.
+        (WebKit::WebsiteDataStoreConfiguration::setCacheStoragePerOriginQuota): Deleted.
+
 2019-04-04  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Changing default website policies shouldn't change default website policies in subsequent navigations
index 393adaa..1cb4b67 100644 (file)
@@ -322,6 +322,7 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
         m_shouldDisableServiceWorkerProcessTerminationDelay = parameters.shouldDisableServiceWorkerProcessTerminationDelay;
     }
 #endif
+    initializeStorageQuota(parameters.defaultDataStoreParameters);
 
     auto* defaultSession = networkSession(PAL::SessionID::defaultSessionID());
     for (const auto& cookie : parameters.defaultDataStoreParameters.pendingCookies)
@@ -455,9 +456,19 @@ void NetworkProcess::addWebsiteDataStore(WebsiteDataStoreParameters&& parameters
         addServiceWorkerSession(parameters.networkSessionParameters.sessionID, parameters.serviceWorkerRegistrationDirectory, parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
 #endif
 
+    initializeStorageQuota(parameters);
+
     RemoteNetworkingContext::ensureWebsiteDataStoreSession(*this, WTFMove(parameters));
 }
 
+void NetworkProcess::initializeStorageQuota(const WebsiteDataStoreParameters& parameters)
+{
+    auto& managers =  m_storageQuotaManagers.ensure(parameters.networkSessionParameters.sessionID, [] {
+        return StorageQuotaManagers { };
+    }).iterator->value;
+    managers.setDefaultQuotas(parameters.perOriginStorageQuota, parameters.perThirdPartyOriginStorageQuota);
+}
+
 void NetworkProcess::switchToNewTestingSession()
 {
 #if PLATFORM(COCOA)
@@ -2029,13 +2040,8 @@ void NetworkProcess::cacheStorageRootPath(PAL::SessionID sessionID, CacheStorage
     }).iterator->value.append(WTFMove(callback));
 }
 
-void NetworkProcess::setCacheStorageParameters(PAL::SessionID sessionID, uint64_t quota, String&& cacheStorageDirectory, SandboxExtension::Handle&& handle)
+void NetworkProcess::setCacheStorageParameters(PAL::SessionID sessionID, String&& cacheStorageDirectory, SandboxExtension::Handle&& handle)
 {
-    auto& managers =  m_storageQuotaManagers.ensure(sessionID, [] {
-        return StorageQuotaManagers { };
-    }).iterator->value;
-    managers.setDefaultQuotas(quota, quota / 10);
-
     auto iterator = m_cacheStorageParametersCallbacks.find(sessionID);
     if (iterator == m_cacheStorageParametersCallbacks.end())
         return;
index e7d80aa..6347c18 100644 (file)
@@ -380,7 +380,7 @@ private:
 
     void clearCachedCredentials();
 
-    void setCacheStorageParameters(PAL::SessionID, uint64_t quota, String&& cacheStorageDirectory, SandboxExtension::Handle&&);
+    void setCacheStorageParameters(PAL::SessionID, String&& cacheStorageDirectory, SandboxExtension::Handle&&);
     void initializeQuotaUsers(WebCore::StorageQuotaManager&, PAL::SessionID, const WebCore::ClientOrigin&);
 
     // FIXME: This should take a session ID so we can identify which disk cache to delete.
@@ -460,6 +460,7 @@ private:
     void ensurePathExists(const String& path);
 
     void clearStorageQuota(PAL::SessionID);
+    void initializeStorageQuota(const WebsiteDataStoreParameters&);
 
     // Connections to WebProcesses.
     Vector<Ref<NetworkConnectionToWebProcess>> m_webProcessConnections;
index 7d9d2e0..dbf3ca7 100644 (file)
@@ -151,7 +151,7 @@ messages -> NetworkProcess LegacyReceiver {
     RegisterURLSchemeAsCORSEnabled(String scheme)
     RegisterURLSchemeAsCanDisplayOnlyIfCanRequest(String scheme)
 
-    SetCacheStorageParameters(PAL::SessionID sessionID, uint64_t quota, String cacheStorageDirectory, WebKit::SandboxExtension::Handle handle);
+    SetCacheStorageParameters(PAL::SessionID sessionID, String cacheStorageDirectory, WebKit::SandboxExtension::Handle handle);
 
 #if ENABLE(SERVICE_WORKER)
     PostMessageToServiceWorkerClient(struct WebCore::ServiceWorkerClientIdentifier destinationIdentifier, struct WebCore::MessageWithMessagePorts message, WebCore::ServiceWorkerIdentifier sourceIdentifier, String sourceOrigin)
index e5dbfcc..d91a34f 100644 (file)
@@ -52,6 +52,9 @@ void WebsiteDataStoreParameters::encode(IPC::Encoder& encoder) const
 #if ENABLE(SERVICE_WORKER)
     encoder << serviceWorkerRegistrationDirectory << serviceWorkerRegistrationDirectoryExtensionHandle;
 #endif
+
+    encoder << perOriginStorageQuota;
+    encoder << perThirdPartyOriginStorageQuota;
 }
 
 Optional<WebsiteDataStoreParameters> WebsiteDataStoreParameters::decode(IPC::Decoder& decoder)
@@ -117,6 +120,18 @@ Optional<WebsiteDataStoreParameters> WebsiteDataStoreParameters::decode(IPC::Dec
         return WTF::nullopt;
     parameters.serviceWorkerRegistrationDirectoryExtensionHandle = WTFMove(*serviceWorkerRegistrationDirectoryExtensionHandle);
 #endif
+
+    Optional<uint64_t> perOriginStorageQuota;
+    decoder >> perOriginStorageQuota;
+    if (!perOriginStorageQuota)
+        return WTF::nullopt;
+    parameters.perOriginStorageQuota = *perOriginStorageQuota;
+
+    Optional<uint64_t> perThirdPartyOriginStorageQuota;
+    decoder >> perThirdPartyOriginStorageQuota;
+    if (!perThirdPartyOriginStorageQuota)
+        return WTF::nullopt;
+    parameters.perThirdPartyOriginStorageQuota = *perThirdPartyOriginStorageQuota;
     
     return parameters;
 }
index f4a5ce2..992fee9 100644 (file)
@@ -28,6 +28,7 @@
 #include "NetworkSessionCreationParameters.h"
 #include "SandboxExtension.h"
 #include <WebCore/Cookie.h>
+#include <WebCore/StorageQuotaManager.h>
 #include <pal/SessionID.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
@@ -68,6 +69,9 @@ struct WebsiteDataStoreParameters {
     String serviceWorkerRegistrationDirectory;
     SandboxExtension::Handle serviceWorkerRegistrationDirectoryExtensionHandle;
 #endif
+
+    uint64_t perOriginStorageQuota { WebCore::StorageQuotaManager::defaultQuota() };
+    uint64_t perThirdPartyOriginStorageQuota { WebCore::StorageQuotaManager::defaultThirdPartyQuota() };
 };
 
 } // namespace WebKit
index b5d8e2a..1b76bed 100644 (file)
@@ -573,9 +573,9 @@ void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreR
     WebKit::toImpl(dataStoreRef)->websiteDataStore().setServiceWorkerRegistrationDirectory(WebKit::toImpl(serviceWorkerRegistrationDirectory)->string());
 }
 
-void WKWebsiteDataStoreSetCacheStoragePerOriginQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota)
+void WKWebsiteDataStoreSetPerOriginStorageQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota)
 {
-    WebKit::toImpl(dataStoreRef)->websiteDataStore().setCacheStoragePerOriginQuota(quota); 
+    WebKit::toImpl(dataStoreRef)->websiteDataStore().setPerOriginStorageQuota(quota);
 }
 
 void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configurationRef)
index 479cad4..be12592 100644 (file)
@@ -125,7 +125,7 @@ WK_EXPORT void WKWebsiteDataStoreGetFetchCacheSizeForOrigin(WKWebsiteDataStoreRe
 WK_EXPORT WKStringRef WKWebsiteDataStoreCopyServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef);
 WK_EXPORT void WKWebsiteDataStoreSetServiceWorkerRegistrationDirectory(WKWebsiteDataStoreRef dataStoreRef, WKStringRef serviceWorkerRegistrationDirectory);
 
-WK_EXPORT void WKWebsiteDataStoreSetCacheStoragePerOriginQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota);
+WK_EXPORT void WKWebsiteDataStoreSetPerOriginStorageQuota(WKWebsiteDataStoreRef dataStoreRef, uint64_t quota);
 
 WK_EXPORT void WKWebsiteDataStoreSetWebAuthenticationMockConfiguration(WKWebsiteDataStoreRef dataStoreRef, WKDictionaryRef configuration);
 
index 00fd7ff..26e1182 100644 (file)
@@ -306,14 +306,14 @@ static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecor
 #endif
 }
 
-- (NSUInteger)_cacheStoragePerOriginQuota
+- (NSUInteger)_perOriginStorageQuota
 {
-    return _websiteDataStore->websiteDataStore().cacheStoragePerOriginQuota();
+    return _websiteDataStore->websiteDataStore().perOriginStorageQuota();
 }
 
-- (void)_setCacheStoragePerOriginQuota:(NSUInteger)size
+- (void)_setPerOriginStorageQuota:(NSUInteger)size
 {
-    _websiteDataStore->websiteDataStore().setCacheStoragePerOriginQuota(size);
+    _websiteDataStore->websiteDataStore().setPerOriginStorageQuota(size);
 }
 
 - (NSString *)_cacheStorageDirectory
index f24f845..6d0e7f8 100644 (file)
@@ -48,7 +48,7 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
 
 @property (nonatomic, setter=_setResourceLoadStatisticsEnabled:) BOOL _resourceLoadStatisticsEnabled WK_API_AVAILABLE(macos(10.12), ios(10.0));
 @property (nonatomic, setter=_setResourceLoadStatisticsDebugMode:) BOOL _resourceLoadStatisticsDebugMode WK_API_AVAILABLE(macos(10.14), ios(12.0));
-@property (nonatomic, setter=_setCacheStoragePerOriginQuota:) NSUInteger _cacheStoragePerOriginQuota WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
+@property (nonatomic, setter=_setPerOriginStorageQuota:) NSUInteger _perOriginStorageQuota WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
 @property (nonatomic, setter=_setCacheStorageDirectory:) NSString* _cacheStorageDirectory WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
 @property (nonatomic, setter=_setServiceWorkerRegistrationDirectory:) NSString* _serviceWorkerRegistrationDirectory WK_API_AVAILABLE(macos(10.13.4), ios(11.3));
 
index c1631f9..2d8dbc5 100644 (file)
@@ -1138,8 +1138,7 @@ void NetworkProcessProxy::retrieveCacheStorageParameters(PAL::SessionID sessionI
 
     if (!store) {
         RELEASE_LOG_ERROR(CacheStorage, "%p - NetworkProcessProxy is unable to retrieve CacheStorage parameters from the given session ID %" PRIu64, this, sessionID.sessionID());
-        auto quota = m_processPool.websiteDataStore() ? m_processPool.websiteDataStore()->websiteDataStore().cacheStoragePerOriginQuota() : WebsiteDataStoreConfiguration::defaultCacheStoragePerOriginQuota;
-        send(Messages::NetworkProcess::SetCacheStorageParameters { sessionID, quota, { }, { } }, 0);
+        send(Messages::NetworkProcess::SetCacheStorageParameters { sessionID, { }, { } }, 0);
         return;
     }
 
@@ -1148,7 +1147,7 @@ void NetworkProcessProxy::retrieveCacheStorageParameters(PAL::SessionID sessionI
     if (!cacheStorageDirectory.isEmpty())
         SandboxExtension::createHandleForReadWriteDirectory(cacheStorageDirectory, cacheStorageDirectoryExtensionHandle);
 
-    send(Messages::NetworkProcess::SetCacheStorageParameters { sessionID, store->cacheStoragePerOriginQuota(), cacheStorageDirectory, cacheStorageDirectoryExtensionHandle }, 0);
+    send(Messages::NetworkProcess::SetCacheStorageParameters { sessionID, cacheStorageDirectory, cacheStorageDirectoryExtensionHandle }, 0);
 }
 
 #if ENABLE(CONTENT_EXTENSIONS)
index e3ffae9..64242ed 100644 (file)
@@ -589,6 +589,9 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
             enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
             manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
         }
+
+        parameters.defaultDataStoreParameters.perOriginStorageQuota = withWebsiteDataStore->perOriginStorageQuota();
+        parameters.defaultDataStoreParameters.perThirdPartyOriginStorageQuota = withWebsiteDataStore->perThirdPartyOriginStorageQuota();
     } else if (m_websiteDataStore) {
         enableResourceLoadStatistics = m_websiteDataStore->resourceLoadStatisticsEnabled();
         if (enableResourceLoadStatistics) {
@@ -597,6 +600,9 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
             enableResourceLoadStatisticsDebugMode = networkSessionParameters.enableResourceLoadStatisticsDebugMode;
             manualPrevalentResource = networkSessionParameters.resourceLoadStatisticsManualPrevalentResource;
         }
+
+        parameters.defaultDataStoreParameters.perOriginStorageQuota = m_websiteDataStore->websiteDataStore().perOriginStorageQuota();
+        parameters.defaultDataStoreParameters.perThirdPartyOriginStorageQuota = m_websiteDataStore->websiteDataStore().perThirdPartyOriginStorageQuota();
     }
 
     parameters.defaultDataStoreParameters.networkSessionParameters.enableResourceLoadStatistics = enableResourceLoadStatistics;
index 7d99db7..716a231 100644 (file)
@@ -160,6 +160,9 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
         SandboxExtension::createHandleForReadWriteDirectory(parameters.serviceWorkerRegistrationDirectory, parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
 #endif
 
+    parameters.perOriginStorageQuota = perOriginStorageQuota();
+    parameters.perThirdPartyOriginStorageQuota = perThirdPartyOriginStorageQuota();
+
     return parameters;
 }
 
index fd08441..3f6e9a7 100644 (file)
@@ -50,6 +50,7 @@
 #include <WebCore/RegistrableDomain.h>
 #include <WebCore/SecurityOrigin.h>
 #include <WebCore/SecurityOriginData.h>
+#include <WebCore/StorageQuotaManager.h>
 #include <wtf/CallbackAggregator.h>
 #include <wtf/CompletionHandler.h>
 #include <wtf/CrossThreadCopier.h>
@@ -2102,6 +2103,12 @@ void WebsiteDataStore::clearPendingCookies()
     m_pendingCookies.clear();
 }
 
+uint64_t WebsiteDataStore::perThirdPartyOriginStorageQuota() const
+{
+    // FIXME: Consider whether allowing to set a perThirdPartyOriginStorageQuota from a WebsiteDataStore.
+    return WebCore::StorageQuotaManager::defaultThirdPartyQuotaFromPerOriginQuota(perOriginStorageQuota());
+}
+
 #if !PLATFORM(COCOA)
 WebsiteDataStoreParameters WebsiteDataStore::parameters()
 {
@@ -2122,6 +2129,9 @@ WebsiteDataStoreParameters WebsiteDataStore::parameters()
         SandboxExtension::createHandleForReadWriteDirectory(parameters.serviceWorkerRegistrationDirectory, parameters.serviceWorkerRegistrationDirectoryExtensionHandle);
 #endif
 
+    parameters.perOriginStorageQuota = perOriginStorageQuota();
+    parameters.perThirdPartyOriginStorageQuota = perThirdPartyOriginStorageQuota();
+
     platformSetNetworkParameters(parameters);
 
     return parameters;
index dffd787..1450e76 100644 (file)
@@ -107,8 +107,9 @@ public:
     void setResourceLoadStatisticsDebugMode(bool);
     void setResourceLoadStatisticsDebugMode(bool, CompletionHandler<void()>&&);
 
-    uint64_t cacheStoragePerOriginQuota() const { return m_resolvedConfiguration->cacheStoragePerOriginQuota(); }
-    void setCacheStoragePerOriginQuota(uint64_t quota) { m_resolvedConfiguration->setCacheStoragePerOriginQuota(quota); }
+    uint64_t perOriginStorageQuota() const { return m_resolvedConfiguration->perOriginStorageQuota(); }
+    uint64_t perThirdPartyOriginStorageQuota() const;
+    void setPerOriginStorageQuota(uint64_t quota) { m_resolvedConfiguration->setPerOriginStorageQuota(quota); }
     const String& cacheStorageDirectory() const { return m_resolvedConfiguration->cacheStorageDirectory(); }
     void setCacheStorageDirectory(String&& directory) { m_resolvedConfiguration->setCacheStorageDirectory(WTFMove(directory)); }
     const String& serviceWorkerRegistrationDirectory() const { return m_resolvedConfiguration->serviceWorkerRegistrationDirectory(); }
index d876733..99f57e4 100644 (file)
@@ -40,7 +40,7 @@ Ref<WebsiteDataStoreConfiguration> WebsiteDataStoreConfiguration::copy()
     auto copy = WebsiteDataStoreConfiguration::create();
 
     copy->m_cacheStorageDirectory = this->m_cacheStorageDirectory;
-    copy->m_cacheStoragePerOriginQuota = this->m_cacheStoragePerOriginQuota;
+    copy->m_perOriginStorageQuota = this->m_perOriginStorageQuota;
     copy->m_networkCacheDirectory = this->m_networkCacheDirectory;
     copy->m_applicationCacheDirectory = this->m_applicationCacheDirectory;
     copy->m_applicationCacheFlatFileSubdirectoryName = this->m_applicationCacheFlatFileSubdirectoryName;
index 1012cb3..9cc8a50 100644 (file)
@@ -37,8 +37,8 @@ public:
 
     Ref<WebsiteDataStoreConfiguration> copy();
 
-    uint64_t cacheStoragePerOriginQuota() { return m_cacheStoragePerOriginQuota; }
-    void setCacheStoragePerOriginQuota(uint64_t quota) { m_cacheStoragePerOriginQuota = quota; }
+    uint64_t perOriginStorageQuota() { return m_perOriginStorageQuota; }
+    void setPerOriginStorageQuota(uint64_t quota) { m_perOriginStorageQuota = quota; }
 
     const String& applicationCacheDirectory() const { return m_applicationCacheDirectory; }
     void setApplicationCacheDirectory(String&& directory) { m_applicationCacheDirectory = WTFMove(directory); }
@@ -97,13 +97,13 @@ public:
     const URL& httpsProxy() const { return m_httpsProxy; }
     void setHTTPSProxy(URL&& proxy) { m_httpsProxy = WTFMove(proxy); }
 
-    constexpr static uint64_t defaultCacheStoragePerOriginQuota = 50 * 1024 * 1024;
+    constexpr static uint64_t defaultPerOriginStorageQuota = 50 * 1024 * 1024;
 
 private:
     WebsiteDataStoreConfiguration();
 
     String m_cacheStorageDirectory;
-    uint64_t m_cacheStoragePerOriginQuota { defaultCacheStoragePerOriginQuota };
+    uint64_t m_perOriginStorageQuota { defaultPerOriginStorageQuota };
     String m_networkCacheDirectory;
     String m_applicationCacheDirectory;
     String m_applicationCacheFlatFileSubdirectoryName;
index 6bed266..a7b5d11 100644 (file)
@@ -1,3 +1,13 @@
+2019-04-04  Youenn Fablet  <youenn@apple.com>
+
+        Pass storage quota parameters from UIProcess to NetworkProcess as part of WebsiteDataStore parameters
+        https://bugs.webkit.org/show_bug.cgi?id=196543
+
+        Reviewed by Alex Christensen.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::generatePageConfiguration):
+
 2019-04-04  Aakash Jain  <aakash_jain@apple.com>
 
         [ews-app] Status bubble should not display skipped buildbot steps
index 22dc071..501a90f 100644 (file)
@@ -523,7 +523,7 @@ WKRetainPtr<WKPageConfigurationRef> TestController::generatePageConfiguration(co
         WKContextSetCacheModel(m_context.get(), kWKCacheModelDocumentBrowser);
 
         auto* websiteDataStore = WKContextGetWebsiteDataStore(m_context.get());
-        WKWebsiteDataStoreSetCacheStoragePerOriginQuota(websiteDataStore, 400 * 1024);
+        WKWebsiteDataStoreSetPerOriginStorageQuota(websiteDataStore, 400 * 1024);
 
         platformInitializeContext();
     }