Bump default cache storage quota to 20MB
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 20:41:00 +0000 (20:41 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 11 Oct 2017 20:41:00 +0000 (20:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178132

Patch by Youenn Fablet <youenn@apple.com> on 2017-10-11
Reviewed by Alex Christensen.

Source/WebCore:

Covered by http/wpt/cache-storage/cache-quota.any.html.

* platform/network/NetworkStorageSession.h:
(WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const):
(WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota):

Source/WebKit:

Adding the ability to set the quota per origin through WebsiteDataStore.
Moving cache storage directory setting also in WebsiteDataStore.

* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/mac/RemoteNetworkingContext.mm:
(WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
* Shared/WebsiteDataStoreParameters.cpp:
(WebKit::WebsiteDataStoreParameters::encode const):
(WebKit::WebsiteDataStoreParameters::decode):
* Shared/WebsiteDataStoreParameters.h:
* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::createWithLegacyOptions):
(API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
(API::ProcessPoolConfiguration::ProcessPoolConfiguration):
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/C/WKContextConfigurationRef.cpp:
* UIProcess/API/C/WKContextConfigurationRef.h:
* UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
(-[WKWebsiteDataStore _cacheStoragePerOriginQuota]):
(-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]):
(-[WKWebsiteDataStore _cacheStorageDirectory]):
(-[WKWebsiteDataStore _setCacheStorageDirectory:]):
* UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
* UIProcess/WebProcessPool.cpp:
(WebKit::legacyWebsiteDataStoreConfiguration):
(WebKit::WebProcessPool::ensureNetworkProcess):
(WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
* UIProcess/WebProcessPool.h:
* UIProcess/WebsiteData/WebsiteDataStore.h:
(WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const):
(WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota):
(WebKit::WebsiteDataStore::cacheStorageDirectory const):
(WebKit::WebsiteDataStore::setCacheStorageDirectory):

Tools:

* WebKitTestRunner/TestController.cpp:
(WTR::TestController::generateContextConfiguration const):
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::initializeWebViewConfiguration): Setting quota to 400kb

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

21 files changed:
Source/WebCore/ChangeLog
Source/WebCore/platform/network/NetworkStorageSession.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp
Source/WebKit/NetworkProcess/NetworkProcess.cpp
Source/WebKit/NetworkProcess/mac/RemoteNetworkingContext.mm
Source/WebKit/Shared/WebsiteDataStoreParameters.cpp
Source/WebKit/Shared/WebsiteDataStoreParameters.h
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.cpp
Source/WebKit/UIProcess/API/C/WKContextConfigurationRef.h
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStore.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h
Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/UIProcess/WebProcessPool.h
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
Tools/ChangeLog
Tools/WebKitTestRunner/TestController.cpp
Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm

index 453195c..e6633b8 100644 (file)
@@ -1,3 +1,16 @@
+2017-10-11  Youenn Fablet  <youenn@apple.com>
+
+        Bump default cache storage quota to 20MB
+        https://bugs.webkit.org/show_bug.cgi?id=178132
+
+        Reviewed by Alex Christensen.
+
+        Covered by http/wpt/cache-storage/cache-quota.any.html.
+
+        * platform/network/NetworkStorageSession.h:
+        (WebCore::NetworkStorageSession::cacheStoragePerOriginQuota const):
+        (WebCore::NetworkStorageSession::setCacheStoragePerOriginQuota):
+
 2017-10-11  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Allow PAL to log messages
index aa36df1..67cc1e9 100644 (file)
@@ -79,6 +79,8 @@ public:
 
     const String& cacheStorageDirectory() const { return m_cacheStorageDirectory; }
     void setCacheStorageDirectory(String&& path) { m_cacheStorageDirectory = WTFMove(path); }
+    uint64_t cacheStoragePerOriginQuota() const { return m_cacheStoragePerOriginQuota; }
+    void setCacheStoragePerOriginQuota(uint64_t quota) { m_cacheStoragePerOriginQuota = quota; }
 
 #if PLATFORM(COCOA) || USE(CFURLCONNECTION)
     WEBCORE_EXPORT static void ensureSession(PAL::SessionID, const String& identifierBase, RetainPtr<CFHTTPCookieStorageRef>&&);
@@ -146,6 +148,7 @@ private:
     CredentialStorage m_credentialStorage;
 
     String m_cacheStorageDirectory;
+    uint64_t m_cacheStoragePerOriginQuota { 0 };
 
 #if HAVE(CFNETWORK_STORAGE_PARTITIONING)
     bool shouldPartitionCookies(const String& topPrivatelyControlledDomain) const;
index 870ce98..640d70d 100644 (file)
@@ -1,3 +1,49 @@
+2017-10-11  Youenn Fablet  <youenn@apple.com>
+
+        Bump default cache storage quota to 20MB
+        https://bugs.webkit.org/show_bug.cgi?id=178132
+
+        Reviewed by Alex Christensen.
+
+        Adding the ability to set the quota per origin through WebsiteDataStore.
+        Moving cache storage directory setting also in WebsiteDataStore.
+
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession):
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        * NetworkProcess/mac/RemoteNetworkingContext.mm:
+        (WebKit::RemoteNetworkingContext::ensureWebsiteDataStoreSession):
+        * Shared/WebsiteDataStoreParameters.cpp:
+        (WebKit::WebsiteDataStoreParameters::encode const):
+        (WebKit::WebsiteDataStoreParameters::decode):
+        * Shared/WebsiteDataStoreParameters.h:
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::createWithLegacyOptions):
+        (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration):
+        (API::ProcessPoolConfiguration::ProcessPoolConfiguration):
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/C/WKContextConfigurationRef.cpp:
+        * UIProcess/API/C/WKContextConfigurationRef.h:
+        * UIProcess/API/Cocoa/WKWebsiteDataStore.mm:
+        (-[WKWebsiteDataStore _cacheStoragePerOriginQuota]):
+        (-[WKWebsiteDataStore _setCacheStoragePerOriginQuota:]):
+        (-[WKWebsiteDataStore _cacheStorageDirectory]):
+        (-[WKWebsiteDataStore _setCacheStorageDirectory:]):
+        * UIProcess/API/Cocoa/WKWebsiteDataStorePrivate.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::legacyWebsiteDataStoreConfiguration):
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+        (WebKit::WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled):
+        * UIProcess/WebProcessPool.h:
+        * UIProcess/WebsiteData/WebsiteDataStore.h:
+        (WebKit::WebsiteDataStore::cacheStoragePerOriginQuota const):
+        (WebKit::WebsiteDataStore::setCacheStoragePerOriginQuota):
+        (WebKit::WebsiteDataStore::cacheStorageDirectory const):
+        (WebKit::WebsiteDataStore::setCacheStorageDirectory):
+
 2017-10-11  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Allow PAL to log messages
index ed713c5..db4e9e9 100644 (file)
@@ -48,6 +48,7 @@
 #include "SessionTracker.h"
 #include "WebCoreArgumentCoders.h"
 #include "WebErrors.h"
+#include "WebsiteDataStore.h"
 #include "WebsiteDataStoreParameters.h"
 #include <WebCore/NetworkStorageSession.h>
 #include <WebCore/PingHandle.h>
@@ -467,7 +468,7 @@ void NetworkConnectionToWebProcess::setCaptureExtraNetworkLoadMetricsEnabled(boo
 
 void NetworkConnectionToWebProcess::ensureLegacyPrivateBrowsingSession()
 {
-    NetworkProcess::singleton().ensurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, { }});
+    NetworkProcess::singleton().ensurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }});
 }
 
 } // namespace WebKit
index dd9744c..3bdaba7 100644 (file)
@@ -50,6 +50,7 @@
 #include "WebProcessPoolMessages.h"
 #include "WebsiteData.h"
 #include "WebsiteDataFetchOption.h"
+#include "WebsiteDataStore.h"
 #include "WebsiteDataStoreParameters.h"
 #include "WebsiteDataType.h"
 #include <WebCore/DNS.h>
@@ -238,7 +239,7 @@ void NetworkProcess::initializeNetworkProcess(NetworkProcessCreationParameters&&
 
     // FIXME: instead of handling this here, a message should be sent later (scales to multiple sessions)
     if (parameters.privateBrowsingEnabled)
-        RemoteNetworkingContext::ensurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, { }});
+        RemoteNetworkingContext::ensurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }});
 
     if (parameters.shouldUseTestingNetworkSession)
         NetworkStorageSession::switchToNewTestingSession();
index 899e4a4..1d36fe5 100644 (file)
@@ -131,6 +131,7 @@ void RemoteNetworkingContext::ensureWebsiteDataStoreSession(WebsiteDataStorePara
     if (!parameters.cacheStorageDirectory.isNull()) {
         SandboxExtension::consumePermanently(parameters.cacheStorageDirectoryExtensionHandle);
         session->setCacheStorageDirectory(WTFMove(parameters.cacheStorageDirectory));
+        session->setCacheStoragePerOriginQuota(parameters.cacheStoragePerOriginQuota);
     }
 
 #if USE(NETWORK_SESSION)
index d808583..4d9b33f 100644 (file)
@@ -41,6 +41,7 @@ void WebsiteDataStoreParameters::encode(IPC::Encoder& encoder) const
     encoder << cookieStoragePathExtensionHandle;
     encoder << pendingCookies;
     encoder << cacheStorageDirectory;
+    encoder << cacheStoragePerOriginQuota;
     encoder << cacheStorageDirectoryExtensionHandle;
 }
 
@@ -64,6 +65,9 @@ bool WebsiteDataStoreParameters::decode(IPC::Decoder& decoder, WebsiteDataStoreP
     if (!decoder.decode(parameters.cacheStorageDirectory))
         return false;
 
+    if (!decoder.decode(parameters.cacheStoragePerOriginQuota))
+        return false;
+
     if (!decoder.decode(parameters.cacheStorageDirectoryExtensionHandle))
         return false;
 
index 460c436..b078e08 100644 (file)
@@ -51,6 +51,7 @@ struct WebsiteDataStoreParameters {
     SandboxExtension::Handle cookieStoragePathExtensionHandle;
     Vector<WebCore::Cookie> pendingCookies;
     String cacheStorageDirectory;
+    uint64_t cacheStoragePerOriginQuota { 0 };
     SandboxExtension::Handle cacheStorageDirectoryExtensionHandle;
 };
 
index 2735dd4..56dc889 100644 (file)
@@ -46,9 +46,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions(
 
     configuration->m_applicationCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory();
     configuration->m_applicationCacheFlatFileSubdirectoryName = "ApplicationCache";
-#if PLATFORM(COCOA)
-    configuration->m_cacheStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultCacheStorageDirectory();
-#endif
     configuration->m_diskCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory();
     configuration->m_mediaCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory();
     configuration->m_indexedDBDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
@@ -66,7 +63,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithWebsiteDataSto
 
     configuration->m_applicationCacheDirectory = legacyConfiguration.applicationCacheDirectory;
     configuration->m_applicationCacheFlatFileSubdirectoryName = legacyConfiguration.applicationCacheFlatFileSubdirectoryName;
-    configuration->m_cacheStorageDirectory = legacyConfiguration.cacheStorageDirectory;
     configuration->m_diskCacheDirectory = legacyConfiguration.networkCacheDirectory;
     configuration->m_mediaCacheDirectory = legacyConfiguration.mediaCacheDirectory;
     configuration->m_indexedDBDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();
@@ -81,9 +77,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithWebsiteDataSto
 ProcessPoolConfiguration::ProcessPoolConfiguration()
     : m_applicationCacheDirectory(WebsiteDataStore::defaultApplicationCacheDirectory())
     , m_applicationCacheFlatFileSubdirectoryName("Files")
-#if PLATFORM(COCOA)
-    , m_cacheStorageDirectory(WebsiteDataStore::defaultCacheStorageDirectory())
-#endif
     , m_diskCacheDirectory(WebsiteDataStore::defaultNetworkCacheDirectory())
     , m_mediaCacheDirectory(WebsiteDataStore::defaultMediaCacheDirectory())
     , m_indexedDBDatabaseDirectory(WebsiteDataStore::defaultIndexedDBDatabaseDirectory())
@@ -110,9 +103,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     copy->m_diskCacheSizeOverride = this->m_diskCacheSizeOverride;
     copy->m_applicationCacheDirectory = this->m_applicationCacheDirectory;
     copy->m_applicationCacheFlatFileSubdirectoryName = this->m_applicationCacheFlatFileSubdirectoryName;
-    copy->m_cacheStorageDirectory = this->m_cacheStorageDirectory;
-    copy->m_cacheStorageDirectory = this->m_cacheStorageDirectory;
-    copy->m_cacheStoragePerOriginQuota = this->m_cacheStoragePerOriginQuota;
     copy->m_mediaCacheDirectory = this->m_mediaCacheDirectory;
     copy->m_indexedDBDatabaseDirectory = this->m_indexedDBDatabaseDirectory;
     copy->m_injectedBundlePath = this->m_injectedBundlePath;
@@ -137,7 +127,7 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
     copy->m_ctDataConnectionServiceType = this->m_ctDataConnectionServiceType;
 #endif
     copy->m_presentingApplicationPID = this->m_presentingApplicationPID;
-    
+
     return copy;
 }
 
index 1f29a31..3f68ecc 100644 (file)
@@ -67,10 +67,6 @@ public:
 
     const WTF::String& applicationCacheFlatFileSubdirectoryName() const { return m_applicationCacheFlatFileSubdirectoryName; }
 
-    const WTF::String& cacheStorageDirectory() const { return m_cacheStorageDirectory; }
-    void setCacheStorageDirectory(WTF::String&& cacheStorageDirectory) { m_cacheStorageDirectory = WTFMove(cacheStorageDirectory); }
-    uint64_t cacheStoragePerOriginQuota() const { return m_cacheStoragePerOriginQuota; }
-
     const WTF::String& diskCacheDirectory() const { return m_diskCacheDirectory; }
     void setDiskCacheDirectory(const WTF::String& diskCacheDirectory) { m_diskCacheDirectory = diskCacheDirectory; }
 
@@ -152,8 +148,6 @@ private:
 
     WTF::String m_applicationCacheDirectory;
     WTF::String m_applicationCacheFlatFileSubdirectoryName;
-    WTF::String m_cacheStorageDirectory;
-    uint64_t m_cacheStoragePerOriginQuota { 400 * 1024 };
     WTF::String m_diskCacheDirectory;
     WTF::String m_mediaCacheDirectory;
     WTF::String m_indexedDBDatabaseDirectory;
index a509bf7..8ac81dd 100644 (file)
@@ -58,16 +58,6 @@ void WKContextConfigurationSetDiskCacheDirectory(WKContextConfigurationRef confi
     toImpl(configuration)->setDiskCacheDirectory(toImpl(diskCacheDirectory)->string());
 }
 
-WKStringRef WKContextConfigurationCopyCacheStorageDirectory(WKContextConfigurationRef configuration)
-{
-    return toCopiedAPI(toImpl(configuration)->cacheStorageDirectory());
-}
-
-void WKContextConfigurationSetCacheStorageDirectory(WKContextConfigurationRef configuration, WKStringRef cacheStorageDirectory)
-{
-    toImpl(configuration)->setCacheStorageDirectory(toImpl(cacheStorageDirectory)->string());
-}
-
 WKStringRef WKContextConfigurationCopyApplicationCacheDirectory(WKContextConfigurationRef configuration)
 {
     return toCopiedAPI(toImpl(configuration)->applicationCacheDirectory());
index c333907..d69bb85 100644 (file)
@@ -41,9 +41,6 @@ WK_EXPORT void WKContextConfigurationSetApplicationCacheDirectory(WKContextConfi
 WK_EXPORT WKStringRef WKContextConfigurationCopyDiskCacheDirectory(WKContextConfigurationRef configuration);
 WK_EXPORT void WKContextConfigurationSetDiskCacheDirectory(WKContextConfigurationRef configuration, WKStringRef diskCacheDirectory);
 
-WK_EXPORT WKStringRef WKContextConfigurationCopyCacheStorageDirectory(WKContextConfigurationRef configuration);
-WK_EXPORT void WKContextConfigurationSetCacheStorageDirectory(WKContextConfigurationRef configuration, WKStringRef cacheStorageDirectory);
-
 WK_EXPORT WKStringRef WKContextConfigurationCopyIndexedDBDatabaseDirectory(WKContextConfigurationRef configuration);
 WK_EXPORT void WKContextConfigurationSetIndexedDBDatabaseDirectory(WKContextConfigurationRef configuration, WKStringRef indexedDBDatabaseDirectory);
 
index 39b0afd..16d2f97 100644 (file)
@@ -231,6 +231,26 @@ static Vector<WebKit::WebsiteDataRecord> toWebsiteDataRecords(NSArray *dataRecor
     _websiteDataStore->websiteDataStore().setResourceLoadStatisticsEnabled(enabled);
 }
 
+- (NSUInteger)_cacheStoragePerOriginQuota
+{
+    return _websiteDataStore->websiteDataStore().cacheStoragePerOriginQuota();
+}
+
+- (void)_setCacheStoragePerOriginQuota:(NSUInteger)size
+{
+    _websiteDataStore->websiteDataStore().setCacheStoragePerOriginQuota(size);
+}
+
+- (NSString *)_cacheStorageDirectory
+{
+    return _websiteDataStore->websiteDataStore().cacheStorageDirectory();
+}
+
+- (void)_setCacheStorageDirectory:(NSString *)directory
+{
+    _websiteDataStore->websiteDataStore().setCacheStorageDirectory(directory);
+}
+
 - (void)_resourceLoadStatisticsSetLastSeen:(double)seconds forHost:(NSString *)host
 {
     auto* store = _websiteDataStore->websiteDataStore().resourceLoadStatistics();
index 8217425..ec8c38b 100644 (file)
@@ -45,6 +45,8 @@ typedef NS_OPTIONS(NSUInteger, _WKWebsiteDataStoreFetchOptions) {
 - (void)_fetchDataRecordsOfTypes:(NSSet<NSString *> *)dataTypes withOptions:(_WKWebsiteDataStoreFetchOptions)options completionHandler:(void (^)(NSArray<WKWebsiteDataRecord *> *))completionHandler;
 
 @property (nonatomic, setter=_setResourceLoadStatisticsEnabled:) BOOL _resourceLoadStatisticsEnabled WK_API_AVAILABLE(macosx(10.12), ios(10.0));
+@property (nonatomic, setter=_setCacheStoragePerOriginQuota:) NSUInteger _cacheStoragePerOriginQuota WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_MAC_TBA));
+@property (nonatomic, setter=_setCacheStorageDirectory:) NSString* _cacheStorageDirectory WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_MAC_TBA));
 
 // ResourceLoadStatistics SPI for testing.
 - (void)_resourceLoadStatisticsSetLastSeen:(double)seconds forHost:(NSString *)host WK_API_AVAILABLE(macosx(10.13), ios(11.0));
index d2efeb8..feef0ce 100644 (file)
@@ -446,15 +446,6 @@ String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()
     return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);
 }
 
-String WebProcessPool::legacyPlatformDefaultCacheStorageDirectory()
-{
-    RetainPtr<NSString> cacheStoragePath = adoptNS((NSString *)_CFURLCacheCopyCacheDirectory([[NSURLCache sharedURLCache] _CFURLCache]));
-    if (!cacheStoragePath)
-        cacheStoragePath = @"~/Library/WebKit/CacheStorage";
-
-    return stringByResolvingSymlinksInPath([cacheStoragePath stringByStandardizingPath]);
-}
-
 String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()
 {
     RetainPtr<NSString> cachePath = adoptNS((NSString *)_CFURLCacheCopyCacheDirectory([[NSURLCache sharedURLCache] _CFURLCache]));
index 025488b..0183a52 100644 (file)
@@ -196,7 +196,6 @@ static WebsiteDataStore::Configuration legacyWebsiteDataStoreConfiguration(API::
     configuration.mediaCacheDirectory = processPoolConfiguration.mediaCacheDirectory();
     configuration.mediaKeysStorageDirectory = processPoolConfiguration.mediaKeysStorageDirectory();
     configuration.resourceLoadStatisticsDirectory = processPoolConfiguration.resourceLoadStatisticsDirectory();
-    configuration.cacheStorageDirectory = processPoolConfiguration.cacheStorageDirectory();
     configuration.networkCacheDirectory = processPoolConfiguration.diskCacheDirectory();
     configuration.javaScriptConfigurationDirectory = processPoolConfiguration.javaScriptConfigurationDirectory();
 
@@ -433,10 +432,11 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
     for (auto& scheme : m_urlSchemesRegisteredForCustomProtocols)
         parameters.urlSchemesRegisteredForCustomProtocols.append(scheme);
 
-    parameters.cacheStorageDirectory = m_configuration->cacheStorageDirectory();
-    parameters.cacheStoragePerOriginQuota = m_configuration->cacheStoragePerOriginQuota();
-    if (!parameters.cacheStorageDirectory.isEmpty())
+    parameters.cacheStorageDirectory = m_websiteDataStore ? m_websiteDataStore->websiteDataStore().cacheStorageDirectory() : String { };
+    if (!parameters.cacheStorageDirectory.isEmpty()) {
         SandboxExtension::createHandleForReadWriteDirectory(parameters.cacheStorageDirectory, parameters.cacheStorageDirectoryExtensionHandle);
+        parameters.cacheStoragePerOriginQuota = m_websiteDataStore ? m_websiteDataStore->websiteDataStore().cacheStoragePerOriginQuota() : WebsiteDataStore::defaultCacheStoragePerOriginQuota;
+    }
 
     parameters.diskCacheDirectory = m_configuration->diskCacheDirectory();
     if (!parameters.diskCacheDirectory.isEmpty())
@@ -620,7 +620,7 @@ void WebProcessPool::setAnyPageGroupMightHavePrivateBrowsingEnabled(bool private
 {
     if (networkProcess()) {
         if (privateBrowsingEnabled)
-            networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, { }}), 0);
+            networkProcess()->send(Messages::NetworkProcess::EnsurePrivateBrowsingSession({PAL::SessionID::legacyPrivateSessionID(), { }, { }, { }, { }, WebsiteDataStore::defaultCacheStoragePerOriginQuota, { }}), 0);
         else
             networkProcess()->send(Messages::NetworkProcess::DestroySession(PAL::SessionID::legacyPrivateSessionID()), 0);
     }
index 1017ecb..4b988e4 100644 (file)
@@ -388,7 +388,6 @@ public:
     static String legacyPlatformDefaultMediaKeysStorageDirectory();
     static String legacyPlatformDefaultMediaCacheDirectory();
     static String legacyPlatformDefaultApplicationCacheDirectory();
-    static String legacyPlatformDefaultCacheStorageDirectory();
     static String legacyPlatformDefaultNetworkCacheDirectory();
     static String legacyPlatformDefaultJavaScriptConfigurationDirectory();
     static bool isNetworkCacheEnabled();
index 1478b27..7fe349a 100644 (file)
@@ -69,7 +69,7 @@ class WebsiteDataStore : public RefCounted<WebsiteDataStore>, public WebProcessL
 public:
     struct Configuration {
         String cacheStorageDirectory;
-        String cacheStorageSubdirectoryName;
+        uint64_t cacheStoragePerOriginQuota;
         String networkCacheDirectory;
         String applicationCacheDirectory;
         String applicationCacheFlatFileSubdirectoryName;
@@ -87,11 +87,19 @@ public:
     static Ref<WebsiteDataStore> create(Configuration, PAL::SessionID);
     virtual ~WebsiteDataStore();
 
+    constexpr static uint64_t defaultCacheStoragePerOriginQuota = 20 * 1024 * 1024;
+
     bool isPersistent() const { return !m_sessionID.isEphemeral(); }
     PAL::SessionID sessionID() const { return m_sessionID; }
 
     bool resourceLoadStatisticsEnabled() const;
     void setResourceLoadStatisticsEnabled(bool);
+
+    uint64_t cacheStoragePerOriginQuota() const { return m_resolvedConfiguration.cacheStoragePerOriginQuota; }
+    void setCacheStoragePerOriginQuota(uint64_t quota) { m_resolvedConfiguration.cacheStoragePerOriginQuota = quota; }
+    const String& cacheStorageDirectory() const { return m_resolvedConfiguration.cacheStorageDirectory; }
+    void setCacheStorageDirectory(String&& directory) { m_resolvedConfiguration.cacheStorageDirectory = WTFMove(directory); }
+
     WebResourceLoadStatisticsStore* resourceLoadStatistics() const { return m_resourceLoadStatistics.get(); }
     void clearResourceLoadStatisticsInWebProcesses();
 
index 3cbdbc7..63c36f6 100644 (file)
@@ -1,3 +1,15 @@
+2017-10-11  Youenn Fablet  <youenn@apple.com>
+
+        Bump default cache storage quota to 20MB
+        https://bugs.webkit.org/show_bug.cgi?id=178132
+
+        Reviewed by Alex Christensen.
+
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::generateContextConfiguration const):
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::initializeWebViewConfiguration): Setting quota to 400kb
+
 2017-10-11  Commit Queue  <commit-queue@webkit.org>
 
         Unreviewed, rolling out r223113 and r223121.
index d0ae474..2e34555 100644 (file)
@@ -409,7 +409,6 @@ WKRetainPtr<WKContextConfigurationRef> TestController::generateContextConfigurat
 
         WKContextConfigurationSetApplicationCacheDirectory(configuration.get(), toWK(temporaryFolder + separator + "ApplicationCache").get());
         WKContextConfigurationSetDiskCacheDirectory(configuration.get(), toWK(temporaryFolder + separator + "Cache").get());
-        WKContextConfigurationSetCacheStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "CacheStorage").get());
         WKContextConfigurationSetIndexedDBDatabaseDirectory(configuration.get(), toWK(temporaryFolder + separator + "Databases" + separator + "IndexedDB").get());
         WKContextConfigurationSetLocalStorageDirectory(configuration.get(), toWK(temporaryFolder + separator + "LocalStorage").get());
         WKContextConfigurationSetWebSQLDatabaseDirectory(configuration.get(), toWK(temporaryFolder + separator + "Databases" + separator + "WebSQL").get());
index d68df32..0c24cd3 100644 (file)
@@ -79,6 +79,13 @@ void initializeWebViewConfiguration(const char* libraryPath, WKStringRef injecte
     WKCookieManagerSetCookieStoragePartitioningEnabled(WKContextGetCookieManager(context), true);
 #endif
 
+    WKWebsiteDataStore* poolWebsiteDataStore = (WKWebsiteDataStore *)WKContextGetWebsiteDataStore((WKContextRef)globalWebViewConfiguration.processPool);
+    [poolWebsiteDataStore _setCacheStoragePerOriginQuota: 400 * 1024];
+    if (libraryPath) {
+        String cacheStorageDirectory = String(libraryPath) + '/' + "CacheStorage";
+        [poolWebsiteDataStore _setCacheStorageDirectory: cacheStorageDirectory];
+    }
+
     [globalWebViewConfiguration.websiteDataStore _setResourceLoadStatisticsEnabled:YES];
     [globalWebViewConfiguration.websiteDataStore _resourceLoadStatisticsSetShouldSubmitTelemetry:NO];