Title: [263736] trunk/Source
Revision
263736
Author
commit-qu...@webkit.org
Date
2020-06-30 02:26:57 -0700 (Tue, 30 Jun 2020)

Log Message

Unreviewed, reverting r263724.
https://bugs.webkit.org/show_bug.cgi?id=213781

Reverted changeset:

"Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
replace _WKProcessPoolConfiguration.hstsStorageDirectory"
https://bugs.webkit.org/show_bug.cgi?id=213048
https://trac.webkit.org/changeset/263724

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (263735 => 263736)


--- trunk/Source/WTF/ChangeLog	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WTF/ChangeLog	2020-06-30 09:26:57 UTC (rev 263736)
@@ -1,3 +1,16 @@
+2020-06-30  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r263724.
+        https://bugs.webkit.org/show_bug.cgi?id=213781
+
+
+        Reverted changeset:
+
+        "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
+        replace _WKProcessPoolConfiguration.hstsStorageDirectory"
+        https://bugs.webkit.org/show_bug.cgi?id=213048
+        https://trac.webkit.org/changeset/263724
+
 2020-06-29  Geoffrey Garen  <gga...@apple.com>
 
         Unreviewed, rolling out an accidental change from r263723.

Modified: trunk/Source/WTF/wtf/PlatformHave.h (263735 => 263736)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -407,13 +407,6 @@
 #define HAVE_BROKEN_DOWNLOAD_RESUME_UNLINK 1
 #endif
 
-#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) \
-    || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) \
-    || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 70000) \
-    || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 140000)
-#define HAVE_HSTS_STORAGE 1
-#endif
-
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
 #define HAVE_CFNETWORK_METRICS_APIS_V4 1
 #endif

Modified: trunk/Source/WebCore/PAL/ChangeLog (263735 => 263736)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-06-30 09:26:57 UTC (rev 263736)
@@ -1,3 +1,16 @@
+2020-06-30  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r263724.
+        https://bugs.webkit.org/show_bug.cgi?id=213781
+
+
+        Reverted changeset:
+
+        "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
+        replace _WKProcessPoolConfiguration.hstsStorageDirectory"
+        https://bugs.webkit.org/show_bug.cgi?id=213048
+        https://trac.webkit.org/changeset/263724
+
 2020-06-29  Alex Christensen  <achristen...@webkit.org>
 
         Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory

Modified: trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h (263735 => 263736)


--- trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -407,7 +407,7 @@
 CFDataRef _CFNetworkCopyATSContext(void);
 Boolean _CFNetworkSetATSContext(CFDataRef);
 
-#if PLATFORM(COCOA) && !HAVE(HSTS_STORAGE)
+#if PLATFORM(COCOA)
 extern const CFStringRef _kCFNetworkHSTSPreloaded;
 CFDictionaryRef _CFNetworkCopyHSTSPolicies(CFURLStorageSessionRef);
 void _CFNetworkResetHSTS(CFURLRef, CFURLStorageSessionRef);
@@ -458,22 +458,9 @@
 - (void)_setMIMEType:(NSString *)type;
 @end
 
-#if HAVE(HSTS_STORAGE)
-@interface _NSHSTSStorage : NSObject
--(instancetype)initPersistentStoreWithURL:(nullable NSURL*)path;
--(BOOL)shouldPromoteHostToHTTPS:(NSString *)host;
--(NSArray<NSString *> *)nonPreloadedHosts;
--(void)resetHSTSForHost:(NSString *)host;
--(void)resetHSTSHostsSinceDate:(NSDate *)date;
-@end
-#endif
-
 @interface NSURLSessionConfiguration ()
 // FIXME: Remove this once rdar://problem/40650244 is in a build.
 @property (copy) NSDictionary *_socketStreamProperties;
-#if HAVE(HSTS_STORAGE)
-@property (nullable, retain) _NSHSTSStorage *_hstsStorage;
-#endif
 @end
 
 @interface NSURLSessionTask ()

Modified: trunk/Source/WebKit/ChangeLog (263735 => 263736)


--- trunk/Source/WebKit/ChangeLog	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/ChangeLog	2020-06-30 09:26:57 UTC (rev 263736)
@@ -1,3 +1,16 @@
+2020-06-30  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, reverting r263724.
+        https://bugs.webkit.org/show_bug.cgi?id=213781
+
+
+        Reverted changeset:
+
+        "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
+        replace _WKProcessPoolConfiguration.hstsStorageDirectory"
+        https://bugs.webkit.org/show_bug.cgi?id=213048
+        https://trac.webkit.org/changeset/263724
+
 2020-06-30  Youenn Fablet  <you...@apple.com>
 
         Add VP9 WebRTC codec runtime flag

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp	2020-06-30 09:26:57 UTC (rev 263736)
@@ -1534,8 +1534,10 @@
     }
 
 #if PLATFORM(COCOA) || USE(SOUP)
-    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
-        callbackAggregator->m_websiteData.hostNamesWithHSTSCache = hostNamesWithHSTSCache(sessionID);
+    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
+        if (auto* networkStorageSession = storageSession(sessionID))
+            getHostNamesWithHSTSCache(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithHSTSCache);
+    }
 #endif
 
 #if ENABLE(INDEXED_DATABASE)
@@ -1594,8 +1596,10 @@
 void NetworkProcess::deleteWebsiteData(PAL::SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, WallTime modifiedSince, CallbackID callbackID)
 {
 #if PLATFORM(COCOA) || USE(SOUP)
-    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
-        clearHSTSCache(sessionID, modifiedSince);
+    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
+        if (auto* networkStorageSession = storageSession(sessionID))
+            clearHSTSCache(*networkStorageSession, modifiedSince);
+    }
 #endif
 
     if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
@@ -1697,8 +1701,10 @@
     }
 
 #if PLATFORM(COCOA) || USE(SOUP)
-    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
-        deleteHSTSCacheForHostNames(sessionID, HSTSCacheHostNames);
+    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
+        if (auto* networkStorageSession = storageSession(sessionID))
+            deleteHSTSCacheForHostNames(*networkStorageSession, HSTSCacheHostNames);
+    }
 #endif
 
 #if HAVE(CFNETWORK_ALTERNATIVE_SERVICE)
@@ -1866,13 +1872,15 @@
     Vector<String> hostnamesWithHSTSToDelete;
 #if PLATFORM(COCOA) || USE(SOUP)
     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
-        hostNamesWithHSTSCache = this->hostNamesWithHSTSCache(sessionID);
-        hostnamesWithHSTSToDelete = filterForRegistrableDomains(domainsToDeleteAllNonCookieWebsiteDataFor, hostNamesWithHSTSCache);
+        if (auto* networkStorageSession = storageSession(sessionID)) {
+            getHostNamesWithHSTSCache(*networkStorageSession, hostNamesWithHSTSCache);
+            hostnamesWithHSTSToDelete = filterForRegistrableDomains(domainsToDeleteAllNonCookieWebsiteDataFor, hostNamesWithHSTSCache);
 
-        for (const auto& host : hostnamesWithHSTSToDelete)
-            callbackAggregator->m_domains.add(RegistrableDomain::uncheckedCreateFromHost(host));
+            for (const auto& host : hostnamesWithHSTSToDelete)
+                callbackAggregator->m_domains.add(RegistrableDomain::uncheckedCreateFromHost(host));
 
-        deleteHSTSCacheForHostNames(sessionID, hostnamesWithHSTSToDelete);
+            deleteHSTSCacheForHostNames(*networkStorageSession, hostnamesWithHSTSToDelete);
+        }
     }
 #endif
 
@@ -2049,16 +2057,18 @@
         });
     }));
     
-    auto& websiteData = callbackAggregator->m_websiteData;
+    auto& websiteDataStore = callbackAggregator->m_websiteData;
     
     if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
         if (auto* networkStorageSession = storageSession(sessionID))
-            networkStorageSession->getHostnamesWithCookies(websiteData.hostNamesWithCookies);
+            networkStorageSession->getHostnamesWithCookies(websiteDataStore.hostNamesWithCookies);
     }
     
 #if PLATFORM(COCOA) || USE(SOUP)
-    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
-        websiteData.hostNamesWithHSTSCache = hostNamesWithHSTSCache(sessionID);
+    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
+        if (auto* networkStorageSession = storageSession(sessionID))
+            getHostNamesWithHSTSCache(*networkStorageSession, websiteDataStore.hostNamesWithHSTSCache);
+    }
 #endif
 
     if (websiteDataTypes.contains(WebsiteDataType::Credentials)) {

Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -193,9 +193,9 @@
     RetainPtr<CFDataRef> sourceApplicationAuditData() const;
 #endif
 #if PLATFORM(COCOA) || USE(SOUP)
-    HashSet<String> hostNamesWithHSTSCache(PAL::SessionID) const;
-    void deleteHSTSCacheForHostNames(PAL::SessionID, const Vector<String>&);
-    void clearHSTSCache(PAL::SessionID, WallTime modifiedSince);
+    void getHostNamesWithHSTSCache(WebCore::NetworkStorageSession&, HashSet<String>&);
+    void deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession&, const Vector<String>&);
+    void clearHSTSCache(WebCore::NetworkStorageSession&, WallTime modifiedSince);
 #endif
 
     void findPendingDownloadLocation(NetworkDataTask&, ResponseCompletionHandler&&, const WebCore::ResourceResponse&);

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp	2020-06-30 09:26:57 UTC (rev 263736)
@@ -57,8 +57,6 @@
     encoder << alternativeServiceDirectoryExtensionHandle;
     encoder << http3Enabled;
 #endif
-    encoder << hstsStorageDirectory;
-    encoder << hstsStorageDirectoryExtensionHandle;
 #if USE(SOUP)
     encoder << cookiePersistentStoragePath;
     encoder << cookiePersistentStorageType;
@@ -155,16 +153,6 @@
         return WTF::nullopt;
 #endif
 
-    Optional<String> hstsStorageDirectory;
-    decoder >> hstsStorageDirectory;
-    if (!hstsStorageDirectory)
-        return WTF::nullopt;
-
-    Optional<SandboxExtension::Handle> hstsStorageDirectoryExtensionHandle;
-    decoder >> hstsStorageDirectoryExtensionHandle;
-    if (!hstsStorageDirectoryExtensionHandle)
-        return WTF::nullopt;
-    
 #if USE(SOUP)
     Optional<String> cookiePersistentStoragePath;
     decoder >> cookiePersistentStoragePath;
@@ -287,8 +275,6 @@
         , WTFMove(*alternativeServiceDirectoryExtensionHandle)
         , WTFMove(*http3Enabled)
 #endif
-        , WTFMove(*hstsStorageDirectory)
-        , WTFMove(*hstsStorageDirectoryExtensionHandle)
 #if USE(SOUP)
         , WTFMove(*cookiePersistentStoragePath)
         , WTFMove(*cookiePersistentStorageType)

Modified: trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -69,8 +69,6 @@
     SandboxExtension::Handle alternativeServiceDirectoryExtensionHandle;
     bool http3Enabled { false };
 #endif
-    String hstsStorageDirectory;
-    SandboxExtension::Handle hstsStorageDirectoryExtensionHandle;
 #if USE(SOUP)
     String cookiePersistentStoragePath;
     SoupCookiePersistentStorageType cookiePersistentStorageType { SoupCookiePersistentStorageType::Text };

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm	2020-06-30 09:26:57 UTC (rev 263736)
@@ -134,7 +134,6 @@
 #endif
 }
 
-#if !HAVE(HSTS_STORAGE)
 static void filterPreloadHSTSEntry(const void* key, const void* value, void* context)
 {
     RELEASE_ASSERT(context);
@@ -153,53 +152,27 @@
     if (CFDictionaryGetValue(val, _kCFNetworkHSTSPreloaded) != kCFBooleanTrue)
         hostnames->add((CFStringRef)key);
 }
-#endif
 
-HashSet<String> NetworkProcess::hostNamesWithHSTSCache(PAL::SessionID sessionID) const
+void NetworkProcess::getHostNamesWithHSTSCache(WebCore::NetworkStorageSession& session, HashSet<String>& hostNames)
 {
-    HashSet<String> hostNames;
-#if HAVE(HSTS_STORAGE)
-    if (auto* networkSession = static_cast<NetworkSessionCocoa*>(this->networkSession(sessionID))) {
-        for (NSString *host in networkSession->hstsStorage().nonPreloadedHosts)
-            hostNames.add(host);
-    }
-#else
-    if (auto* session = storageSession(sessionID)) {
-        if (auto HSTSPolicies = adoptCF(_CFNetworkCopyHSTSPolicies(session->platformSession())))
-            CFDictionaryApplyFunction(HSTSPolicies.get(), filterPreloadHSTSEntry, &hostNames);
-    }
-#endif
-    return hostNames;
+    if (auto HSTSPolicies = adoptCF(_CFNetworkCopyHSTSPolicies(session.platformSession())))
+        CFDictionaryApplyFunction(HSTSPolicies.get(), filterPreloadHSTSEntry, &hostNames);
 }
 
-void NetworkProcess::deleteHSTSCacheForHostNames(PAL::SessionID sessionID, const Vector<String>& hostNames)
+void NetworkProcess::deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession& session, const Vector<String>& hostNames)
 {
-#if HAVE(HSTS_STORAGE)
-    if (auto* networkSession = static_cast<NetworkSessionCocoa*>(this->networkSession(sessionID))) {
-        for (auto& hostName : hostNames)
-            [networkSession->hstsStorage() resetHSTSForHost:hostName];
+    for (auto& hostName : hostNames) {
+        auto url = "" }, makeString("https://", hostName));
+        _CFNetworkResetHSTS(url.createCFURL().get(), session.platformSession());
     }
-#else
-    if (auto* session = storageSession(sessionID)) {
-        for (auto& hostName : hostNames) {
-            auto url = "" }, makeString("https://", hostName));
-            _CFNetworkResetHSTS(url.createCFURL().get(), session->platformSession());
-        }
-    }
-#endif
 }
 
-void NetworkProcess::clearHSTSCache(PAL::SessionID sessionID, WallTime modifiedSince)
+void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& session, WallTime modifiedSince)
 {
     NSTimeInterval timeInterval = modifiedSince.secondsSinceEpoch().seconds();
     NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
-#if HAVE(HSTS_STORAGE)
-    if (auto* networkSession = static_cast<NetworkSessionCocoa*>(this->networkSession(sessionID)))
-        [networkSession->hstsStorage() resetHSTSHostsSinceDate:date];
-#else
-    if (auto* session = storageSession(sessionID))
-        _CFNetworkResetHSTSHostsSinceDate(session->platformSession(), (__bridge CFDateRef)date);
-#endif
+
+    _CFNetworkResetHSTSHostsSinceDate(session.platformSession(), (__bridge CFDateRef)date);
 }
 
 void NetworkProcess::clearDiskCache(WallTime modifiedSince, CompletionHandler<void()>&& completionHandler)

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -33,7 +33,6 @@
 OBJC_CLASS NSOperationQueue;
 OBJC_CLASS WKNetworkSessionDelegate;
 OBJC_CLASS WKNetworkSessionWebSocketDelegate;
-OBJC_CLASS _NSHSTSStorage;
 
 #include "DownloadID.h"
 #include "NetworkDataTaskCocoa.h"
@@ -105,7 +104,6 @@
     void taskServerConnectionSucceeded(NetworkDataTaskCocoa::TaskIdentifier);
     void taskFailed(NetworkDataTaskCocoa::TaskIdentifier);
     NSURLCredential *successfulClientCertificateForHost(const String& host, uint16_t port) const;
-    _NSHSTSStorage *hstsStorage() const;
 
 private:
     void invalidateAndCancel() override;

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2020-06-30 09:26:57 UTC (rev 263736)
@@ -68,10 +68,6 @@
 
 #import "DeviceManagementSoftLink.h"
 
-// FIXME: Remove this soft link once rdar://problem/50109631 is in a build and bots are updated.
-SOFT_LINK_FRAMEWORK(CFNetwork)
-SOFT_LINK_CLASS_OPTIONAL(CFNetwork, _NSHSTSStorage)
-
 using namespace WebKit;
 
 CFStringRef const WebKit2HTTPProxyDefaultsKey = static_cast<CFStringRef>(@"WebKit2HTTPProxy");
@@ -1096,17 +1092,6 @@
     return m_successfulClientCertificates.get(key).get();
 }
 
-_NSHSTSStorage *NetworkSessionCocoa::hstsStorage() const
-{
-#if HAVE(HSTS_STORAGE)
-    NSURLSessionConfiguration *configuration = m_sessionWithCredentialStorage.session.get().configuration;
-    // FIXME: Remove this respondsToSelector check once rdar://problem/50109631 is in a build and bots are updated.
-    if ([configuration respondsToSelector:@selector(_hstsStorage)])
-        return m_sessionWithCredentialStorage.session.get().configuration._hstsStorage;
-#endif
-    return nil;
-}
-
 const String& NetworkSessionCocoa::boundInterfaceIdentifier() const
 {
     return m_boundInterfaceIdentifier;
@@ -1187,15 +1172,6 @@
 
     NSURLSessionConfiguration *configuration = configurationForSessionID(m_sessionID);
 
-#if HAVE(HSTS_STORAGE)
-    if (!!parameters.hstsStorageDirectory && !m_sessionID.isEphemeral()) {
-        SandboxExtension::consumePermanently(parameters.hstsStorageDirectoryExtensionHandle);
-        // FIXME: Remove this respondsToSelector check once rdar://problem/50109631 is in a build and bots are updated.
-        if ([configuration respondsToSelector:@selector(_hstsStorage)])
-            configuration._hstsStorage = [[alloc_NSHSTSStorageInstance() initPersistentStoreWithURL:[NSURL fileURLWithPath:parameters.hstsStorageDirectory isDirectory:YES]] autorelease];
-    }
-#endif
-
 #if HAVE(APP_SSO) || PLATFORM(MACCATALYST)
     configuration._preventsAppSSO = true;
 #endif

Modified: trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp (263735 => 263736)


--- trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp	2020-06-30 09:26:57 UTC (rev 263736)
@@ -94,23 +94,21 @@
     return builder.toString().utf8();
 }
 
-HashSet<String> NetworkProcess::hostNamesWithHSTSCache(PAL::SessionID sessionID) const
+void NetworkProcess::getHostNamesWithHSTSCache(WebCore::NetworkStorageSession& storageSession, HashSet<String>& hostNames)
 {
-    HashSet<String> hostNames;
-    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID));
+    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID()));
     session->soupNetworkSession().getHostNamesWithHSTSCache(hostNames);
-    return hostNames;
 }
 
-void NetworkProcess::deleteHSTSCacheForHostNames(PAL::SessionID sessionID, const Vector<String>& hostNames)
+void NetworkProcess::deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession& storageSession, const Vector<String>& hostNames)
 {
-    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID));
+    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID()));
     session->soupNetworkSession().deleteHSTSCacheForHostNames(hostNames);
 }
 
-void NetworkProcess::clearHSTSCache(PAL::SessionID sessionID, WallTime modifiedSince)
+void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& storageSession, WallTime modifiedSince)
 {
-    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID));
+    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID()));
     session->soupNetworkSession().clearHSTSCache(modifiedSince);
 }
 

Modified: trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.h (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -27,7 +27,6 @@
 #define WKContextPrivateMac_h
 
 #include <WebKit/WKBase.h>
-#include <WebKit/WKDeprecated.h>
 #include <WebKit/WKPluginLoadPolicy.h>
 
 #ifdef __cplusplus
@@ -44,9 +43,11 @@
 typedef void (^WKContextGetInfoForInstalledPlugInsBlock)(WKArrayRef, WKErrorRef);
 WK_EXPORT void WKContextGetInfoForInstalledPlugIns(WKContextRef context, WKContextGetInfoForInstalledPlugInsBlock block);
 
-WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context) WK_C_API_DEPRECATED;
-WK_EXPORT void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970) WK_C_API_DEPRECATED;
+WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context);
 
+// The time here is relative to the Unix epoch.
+WK_EXPORT void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970);
+
 WK_EXPORT void WKContextRegisterSchemeForCustomProtocol(WKContextRef context, WKStringRef scheme);
 WK_EXPORT void WKContextUnregisterSchemeForCustomProtocol(WKContextRef context, WKStringRef scheme);
 

Modified: trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm	2020-06-30 09:26:57 UTC (rev 263736)
@@ -101,12 +101,14 @@
 #endif
 }
 
-void WKContextResetHSTSHosts(WKContextRef)
+void WKContextResetHSTSHosts(WKContextRef context)
 {
+    return WebKit::toImpl(context)->resetHSTSHosts();
 }
 
-void WKContextResetHSTSHostsAddedAfterDate(WKContextRef, double)
+void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970)
 {
+    return WebKit::toImpl(context)->resetHSTSHostsAddedAfterDate(startDateIntervalSince1970);
 }
 
 void WKContextRegisterSchemeForCustomProtocol(WKContextRef context, WKStringRef scheme)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -68,7 +68,7 @@
 @property (nonatomic) BOOL usesWebProcessCache WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
 @property (nonatomic) BOOL pageCacheEnabled WK_API_AVAILABLE(macos(10.14), ios(12.0));
 @property (nonatomic, getter=isJITEnabled) BOOL JITEnabled WK_API_AVAILABLE(macos(10.14.4), ios(12.2));
-@property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_DEPRECATED_WITH_REPLACEMENT("_WKWebsiteDataStoreConfiguration.hstsStorageDirectory", macos(10.15, WK_MAC_TBA), ios(13.0, WK_IOS_TBA));
+@property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_AVAILABLE(macos(10.15), ios(13.0));
 
 @property (nonatomic) BOOL configureJSCForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -72,7 +72,6 @@
 @property (nonatomic) NSUInteger testSpeedMultiplier WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 @property (nonatomic) BOOL allowsServerPreconnect WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
-@property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 
 @property (nonatomic, nullable, copy) NSURL *alternativeServicesStorageDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
 

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm	2020-06-30 09:26:57 UTC (rev 263736)
@@ -290,19 +290,6 @@
     _configuration->setMediaKeysStorageDirectory(url.path);
 }
 
-- (NSURL *)hstsStorageDirectory
-{
-    return [NSURL fileURLWithPath:_configuration->hstsStorageDirectory() isDirectory:YES];
-}
-
-- (void)setHSTSStorageDirectory:(NSURL *)url
-{
-    if (!_configuration->isPersistent())
-        [NSException raise:NSInvalidArgumentException format:@"Cannot set mediaKeysStorageDirectory on a non-persistent _WKWebsiteDataStoreConfiguration."];
-    checkURLArgument(url);
-    _configuration->setHSTSStorageDirectory(url.path);
-}
-
 - (NSURL *)alternativeServicesStorageDirectory
 {
     return [NSURL fileURLWithPath:_configuration->alternativeServicesDirectory() isDirectory:YES];

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm	2020-06-30 09:26:57 UTC (rev 263736)
@@ -728,6 +728,18 @@
     [[NSNotificationCenter defaultCenter] removeObserver:m_activationObserver.get()];
 }
 
+static CFURLStorageSessionRef privateBrowsingSession()
+{
+    static CFURLStorageSessionRef session;
+    static dispatch_once_t once;
+    dispatch_once(&once, ^{
+        NSString *identifier = [NSString stringWithFormat:@"%@.PrivateBrowsing", [[NSBundle mainBundle] bundleIdentifier]];
+        session = createPrivateStorageSession((__bridge CFStringRef)identifier);
+    });
+
+    return session;
+}
+
 bool WebProcessPool::isURLKnownHSTSHost(const String& urlString) const
 {
     RetainPtr<CFURLRef> url = "" urlString).createCFURL();
@@ -735,6 +747,19 @@
     return _CFNetworkIsKnownHSTSHostWithSession(url.get(), nullptr);
 }
 
+void WebProcessPool::resetHSTSHosts()
+{
+    _CFNetworkResetHSTSHostsWithSession(nullptr);
+    _CFNetworkResetHSTSHostsWithSession(privateBrowsingSession());
+}
+
+void WebProcessPool::resetHSTSHostsAddedAfterDate(double startDateIntervalSince1970)
+{
+    NSDate *startDate = [NSDate dateWithTimeIntervalSince1970:startDateIntervalSince1970];
+    _CFNetworkResetHSTSHostsSinceDate(nullptr, (__bridge CFDateRef)startDate);
+    _CFNetworkResetHSTSHostsSinceDate(privateBrowsingSession(), (__bridge CFDateRef)startDate);
+}
+
 #if PLATFORM(MAC) && ENABLE(WEBPROCESS_WINDOWSERVER_BLOCKING)
 Optional<unsigned> WebProcessPool::nominalFramesPerSecondForDisplay(WebCore::PlatformDisplayID displayID)
 {

Modified: trunk/Source/WebKit/UIProcess/WebProcessPool.h (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/WebProcessPool.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/WebProcessPool.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -422,6 +422,8 @@
     static void didReceiveInvalidMessage(IPC::MessageName);
 
     bool isURLKnownHSTSHost(const String& urlString) const;
+    void resetHSTSHosts();
+    void resetHSTSHostsAddedAfterDate(double startDateIntervalSince1970);
 
     static void registerGlobalURLSchemeAsHavingCustomProtocolHandlers(const String&);
     static void unregisterGlobalURLSchemeAsHavingCustomProtocolHandlers(const String&);

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp	2020-06-30 09:26:57 UTC (rev 263736)
@@ -232,8 +232,6 @@
         m_resolvedConfiguration->setJavaScriptConfigurationDirectory(resolvePathForSandboxExtension(m_configuration->_javascript_ConfigurationDirectory()));
     if (!m_configuration->cacheStorageDirectory().isEmpty() && m_resolvedConfiguration->cacheStorageDirectory().isEmpty())
         m_resolvedConfiguration->setCacheStorageDirectory(resolvePathForSandboxExtension(m_configuration->cacheStorageDirectory()));
-    if (!m_configuration->hstsStorageDirectory().isEmpty() && m_resolvedConfiguration->hstsStorageDirectory().isEmpty())
-        m_resolvedConfiguration->setHSTSStorageDirectory(resolvePathForSandboxExtension(m_configuration->hstsStorageDirectory()));
 
     // Resolve directories for file paths.
     if (!m_configuration->cookieStorageFile().isEmpty()) {
@@ -2261,11 +2259,6 @@
     if (!networkCacheDirectory.isEmpty())
         SandboxExtension::createHandleForReadWriteDirectory(networkCacheDirectory, networkCacheDirectoryExtensionHandle);
 
-    auto hstsStorageDirectory = resolvedHSTSStorageDirectory();
-    SandboxExtension::Handle hstsStorageDirectoryExtensionHandle;
-    if (!hstsStorageDirectory.isEmpty())
-        SandboxExtension::createHandleForReadWriteDirectory(hstsStorageDirectory, hstsStorageDirectoryExtensionHandle);
-
     bool shouldIncludeLocalhostInResourceLoadStatistics = false;
     bool enableResourceLoadStatisticsDebugMode = false;
     auto firstPartyWebsiteDataRemovalMode = WebCore::FirstPartyWebsiteDataRemovalMode::AllButCookies;
@@ -2307,8 +2300,6 @@
     networkSessionParameters.allLoadsBlockedByDeviceManagementRestrictionsForTesting = m_configuration->allLoadsBlockedByDeviceManagementRestrictionsForTesting();
     networkSessionParameters.networkCacheDirectory = WTFMove(networkCacheDirectory);
     networkSessionParameters.networkCacheDirectoryExtensionHandle = WTFMove(networkCacheDirectoryExtensionHandle);
-    networkSessionParameters.hstsStorageDirectory = WTFMove(hstsStorageDirectory);
-    networkSessionParameters.hstsStorageDirectoryExtensionHandle = WTFMove(hstsStorageDirectoryExtensionHandle);
     networkSessionParameters.dataConnectionServiceType = m_configuration->dataConnectionServiceType();
     networkSessionParameters.fastServerTrustEvaluationEnabled = m_configuration->fastServerTrustEvaluationEnabled();
     networkSessionParameters.networkCacheSpeculativeValidationEnabled = m_configuration->networkCacheSpeculativeValidationEnabled();

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -224,7 +224,6 @@
     const String& resolvedIndexedDatabaseDirectory() 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(); }
 
     DeviceIdHashSaltStorage& deviceIdHashSaltStorage() { return m_deviceIdHashSaltStorage.get(); }
 

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp	2020-06-30 09:26:57 UTC (rev 263736)
@@ -67,7 +67,9 @@
     copy->m_indexedDBDatabaseDirectory = this->m_indexedDBDatabaseDirectory;
     copy->m_serviceWorkerRegistrationDirectory = this->m_serviceWorkerRegistrationDirectory;
     copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory;
+#if USE(GLIB)
     copy->m_hstsStorageDirectory = this->m_hstsStorageDirectory;
+#endif
     copy->m_localStorageDirectory = this->m_localStorageDirectory;
     copy->m_mediaKeysStorageDirectory = this->m_mediaKeysStorageDirectory;
     copy->m_alternativeServicesDirectory = this->m_alternativeServicesDirectory;

Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h (263735 => 263736)


--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h	2020-06-30 08:20:08 UTC (rev 263735)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h	2020-06-30 09:26:57 UTC (rev 263736)
@@ -66,10 +66,10 @@
 
     const String& webSQLDatabaseDirectory() const { return m_webSQLDatabaseDirectory; }
     void setWebSQLDatabaseDirectory(String&& directory) { m_webSQLDatabaseDirectory = WTFMove(directory); }
-
+#if USE(GLIB) // According to r245075 this will eventually move here.
     const String& hstsStorageDirectory() const { return m_hstsStorageDirectory; }
     void setHSTSStorageDirectory(String&& directory) { m_hstsStorageDirectory = WTFMove(directory); }
-
+#endif
     const String& localStorageDirectory() const { return m_localStorageDirectory; }
     void setLocalStorageDirectory(String&& directory) { m_localStorageDirectory = WTFMove(directory); }
 
@@ -174,8 +174,8 @@
     String m_indexedDBDatabaseDirectory;
     String m_serviceWorkerRegistrationDirectory;
     String m_webSQLDatabaseDirectory;
+#if USE(GLIB)
     String m_hstsStorageDirectory;
-#if USE(GLIB)
     bool m_networkCacheSpeculativeValidationEnabled { true };
 #else
     bool m_networkCacheSpeculativeValidationEnabled { false };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to