Move HSTS storage directory to LegacyGlobalSettings
authorachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Sep 2019 18:54:38 +0000 (18:54 +0000)
committerachristensen@apple.com <achristensen@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Sep 2019 18:54:38 +0000 (18:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=202059

Reviewed by Tim Horton.

I continue my lamentation begun in r245075.
Remove the glib setting of it on the WebKitWebContext because they use it on the WebsiteDataStore.  We should do that too when we can.

* UIProcess/API/APIProcessPoolConfiguration.cpp:
(API::ProcessPoolConfiguration::copy):
* UIProcess/API/APIProcessPoolConfiguration.h:
* UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
(-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]):
(-[_WKProcessPoolConfiguration hstsStorageDirectory]):
* UIProcess/LegacyGlobalSettings.h:
(WebKit::LegacyGlobalSettings::setHSTSStorageDirectory):
(WebKit::LegacyGlobalSettings::hstsStorageDirectory const):
* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::ensureNetworkProcess):

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

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.h
Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp
Source/WebKit/UIProcess/LegacyGlobalSettings.h
Source/WebKit/UIProcess/WebProcessPool.cpp

index 896b789..a18bb55 100644 (file)
@@ -1,3 +1,25 @@
+2019-09-24  Alex Christensen  <achristensen@webkit.org>
+
+        Move HSTS storage directory to LegacyGlobalSettings
+        https://bugs.webkit.org/show_bug.cgi?id=202059
+
+        Reviewed by Tim Horton.
+
+        I continue my lamentation begun in r245075.
+        Remove the glib setting of it on the WebKitWebContext because they use it on the WebsiteDataStore.  We should do that too when we can.
+
+        * UIProcess/API/APIProcessPoolConfiguration.cpp:
+        (API::ProcessPoolConfiguration::copy):
+        * UIProcess/API/APIProcessPoolConfiguration.h:
+        * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm:
+        (-[_WKProcessPoolConfiguration setHSTSStorageDirectory:]):
+        (-[_WKProcessPoolConfiguration hstsStorageDirectory]):
+        * UIProcess/LegacyGlobalSettings.h:
+        (WebKit::LegacyGlobalSettings::setHSTSStorageDirectory):
+        (WebKit::LegacyGlobalSettings::hstsStorageDirectory const):
+        * UIProcess/WebProcessPool.cpp:
+        (WebKit::WebProcessPool::ensureNetworkProcess):
+
 2019-09-24  Keith Rollin  <krollin@apple.com>
 
         Coalesce or remove PLATFORM(MAC) || PLATFORM(IOS_FAMILY)
index 7a9e112..294c11e 100644 (file)
@@ -77,7 +77,6 @@ Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::copy()
 #endif
     copy->m_customWebContentServiceBundleIdentifier = this->m_customWebContentServiceBundleIdentifier;
     copy->m_usesSingleWebProcess = m_usesSingleWebProcess;
-    copy->m_hstsStorageDirectory = m_hstsStorageDirectory;
 
     return copy;
 }
index 0cacc14..b1f6aa7 100644 (file)
@@ -147,9 +147,6 @@ public:
 
     const WTF::String& customWebContentServiceBundleIdentifier() const { return m_customWebContentServiceBundleIdentifier; }
     void setCustomWebContentServiceBundleIdentifier(const WTF::String& customWebContentServiceBundleIdentifier) { m_customWebContentServiceBundleIdentifier = customWebContentServiceBundleIdentifier; }
-
-    const WTF::String& hstsStorageDirectory() const { return m_hstsStorageDirectory; }
-    void setHSTSStorageDirectory(WTF::String&& directory) { m_hstsStorageDirectory = WTFMove(directory); }
     
 #if PLATFORM(COCOA)
     bool suppressesConnectionTerminationOnSystemChange() const { return m_suppressesConnectionTerminationOnSystemChange; }
@@ -187,7 +184,6 @@ private:
     bool m_isJITEnabled { true };
     bool m_usesSingleWebProcess { false };
     uint32_t m_downloadMonitorSpeedMultiplier { 1 };
-    WTF::String m_hstsStorageDirectory;
 
 #if PLATFORM(IOS_FAMILY)
     WTF::String m_ctDataConnectionServiceType;
index c4ee01e..ef17b07 100644 (file)
         [NSException raise:NSInvalidArgumentException format:@"%@ is not a file URL", directory];
 
     // FIXME: Move this to _WKWebsiteDataStoreConfiguration once rdar://problem/50109631 is fixed.
-    _processPoolConfiguration->setHSTSStorageDirectory(directory.path);
+    WebKit::LegacyGlobalSettings::singleton().setHSTSStorageDirectory(directory.path);
 }
 
 - (NSURL *)hstsStorageDirectory
 {
-    return [NSURL fileURLWithPath:_processPoolConfiguration->hstsStorageDirectory() isDirectory:YES];
+    return [NSURL fileURLWithPath:WebKit::LegacyGlobalSettings::singleton().hstsStorageDirectory() isDirectory:YES];
 }
 
 - (void)setDownloadMonitorSpeedMultiplierForTesting:(NSUInteger)multiplier
index ed17416..4efea56 100644 (file)
@@ -328,7 +328,7 @@ static void webkitWebContextConstructed(GObject* object)
         priv->websiteDataManager = adoptGRef(webkit_website_data_manager_new("local-storage-directory", priv->localStorageDirectory.data(), nullptr));
 
     if (!webkit_website_data_manager_is_ephemeral(priv->websiteDataManager.get()))
-        configuration.setHSTSStorageDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_hsts_cache_directory(priv->websiteDataManager.get())));
+        WebKit::LegacyGlobalSettings::singleton().setHSTSStorageDirectory(FileSystem::stringFromFileSystemRepresentation(webkit_website_data_manager_get_hsts_cache_directory(priv->websiteDataManager.get())));
 
     priv->processPool = WebProcessPool::create(configuration);
     priv->processPool->setPrimaryDataStore(webkitWebsiteDataManagerGetDataStore(priv->websiteDataManager.get()));
index f968deb..be084a4 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "CacheModel.h"
 #include <wtf/Forward.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebKit {
 
@@ -38,11 +39,15 @@ public:
     void setCacheModel(CacheModel);
     CacheModel cacheModel() const { return m_cacheModel; }
     
+    void setHSTSStorageDirectory(String&& directory) { m_hstsStorageDirectory = WTFMove(directory); }
+    const String& hstsStorageDirectory() const { return m_hstsStorageDirectory; }
+    
 private:
     friend class NeverDestroyed<LegacyGlobalSettings>;
     LegacyGlobalSettings();
     
     CacheModel m_cacheModel { CacheModel::PrimaryWebBrowser };
+    String m_hstsStorageDirectory;
 };
 
 } // namespace WebKit
index 7fe27d9..e613c66 100644 (file)
@@ -520,7 +520,7 @@ NetworkProcessProxy& WebProcessPool::ensureNetworkProcess(WebsiteDataStore* with
 #endif
 #endif
 
-    parameters.hstsStorageDirectory = m_configuration->hstsStorageDirectory();
+    parameters.hstsStorageDirectory = LegacyGlobalSettings::singleton().hstsStorageDirectory();
     if (!parameters.hstsStorageDirectory.isNull())
         SandboxExtension::createHandleForReadWriteDirectory(parameters.hstsStorageDirectory, parameters.hstsStorageDirectoryExtensionHandle);