Changeset 263724 in webkit
- Timestamp:
- Jun 29, 2020 9:39:50 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r263723 r263724 1 2020-06-29 Alex Christensen <achristensen@webkit.org> 2 3 Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory 4 https://bugs.webkit.org/show_bug.cgi?id=213048 5 6 Reviewed by Youenn Fablet. 7 8 * wtf/PlatformHave.h: 9 1 10 2020-06-29 Geoffrey Garen <ggaren@apple.com> 2 11 -
trunk/Source/WTF/wtf/PlatformHave.h
r263380 r263724 408 408 #endif 409 409 410 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) \ 411 || ((PLATFORM(IOS) || PLATFORM(MACCATALYST)) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) \ 412 || (PLATFORM(WATCHOS) && __WATCH_OS_VERSION_MIN_REQUIRED >= 70000) \ 413 || (PLATFORM(APPLETV) && __TV_OS_VERSION_MIN_REQUIRED >= 140000) 414 #define HAVE_HSTS_STORAGE 1 415 #endif 416 410 417 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000) 411 418 #define HAVE_CFNETWORK_METRICS_APIS_V4 1 -
trunk/Source/WebCore/PAL/ChangeLog
r263700 r263724 1 2020-06-29 Alex Christensen <achristensen@webkit.org> 2 3 Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory 4 https://bugs.webkit.org/show_bug.cgi?id=213048 5 6 Reviewed by Youenn Fablet. 7 8 * pal/spi/cf/CFNetworkSPI.h: 9 1 10 2020-06-29 Tetsuharu Ohzeki <tetsuharu.ohzeki@gmail.com> 2 11 -
trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h
r262930 r263724 408 408 Boolean _CFNetworkSetATSContext(CFDataRef); 409 409 410 #if PLATFORM(COCOA) 410 #if PLATFORM(COCOA) && !HAVE(HSTS_STORAGE) 411 411 extern const CFStringRef _kCFNetworkHSTSPreloaded; 412 412 CFDictionaryRef _CFNetworkCopyHSTSPolicies(CFURLStorageSessionRef); … … 459 459 @end 460 460 461 #if HAVE(HSTS_STORAGE) 462 @interface _NSHSTSStorage : NSObject 463 -(instancetype)initPersistentStoreWithURL:(nullable NSURL*)path; 464 -(BOOL)shouldPromoteHostToHTTPS:(NSString *)host; 465 -(NSArray<NSString *> *)nonPreloadedHosts; 466 -(void)resetHSTSForHost:(NSString *)host; 467 -(void)resetHSTSHostsSinceDate:(NSDate *)date; 468 @end 469 #endif 470 461 471 @interface NSURLSessionConfiguration () 462 472 // FIXME: Remove this once rdar://problem/40650244 is in a build. 463 473 @property (copy) NSDictionary *_socketStreamProperties; 474 #if HAVE(HSTS_STORAGE) 475 @property (nullable, retain) _NSHSTSStorage *_hstsStorage; 476 #endif 464 477 @end 465 478 -
trunk/Source/WebKit/ChangeLog
r263721 r263724 1 2020-06-29 Alex Christensen <achristensen@webkit.org> 2 3 Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to replace _WKProcessPoolConfiguration.hstsStorageDirectory 4 https://bugs.webkit.org/show_bug.cgi?id=213048 5 6 Reviewed by Youenn Fablet. 7 8 This uses CFNetwork SPI introduced in rdar://problem/50109631 to allow HSTS storage per NSURLSession. 9 To be complete, I also deprecated our UI process HSTS state removal attempt SPIs, WKContextResetHSTSHosts and 10 WKContextResetHSTSHostsAddedAfterDate, which had their last use removed in rdar://problem/64220838. 11 12 I manually verified that this new SPI puts HSTS data in the specified location, and I also verified that HSTS 13 state querying and removal works with the new CFNetwork SPI as it did with the old one. 14 15 * NetworkProcess/NetworkProcess.cpp: 16 (WebKit::NetworkProcess::fetchWebsiteData): 17 (WebKit::NetworkProcess::deleteWebsiteData): 18 (WebKit::NetworkProcess::deleteWebsiteDataForOrigins): 19 (WebKit::NetworkProcess::deleteAndRestrictWebsiteDataForRegistrableDomains): 20 (WebKit::NetworkProcess::registrableDomainsWithWebsiteData): 21 * NetworkProcess/NetworkProcess.h: 22 * NetworkProcess/NetworkSessionCreationParameters.cpp: 23 (WebKit::NetworkSessionCreationParameters::encode const): 24 (WebKit::NetworkSessionCreationParameters::decode): 25 * NetworkProcess/NetworkSessionCreationParameters.h: 26 * NetworkProcess/cocoa/NetworkProcessCocoa.mm: 27 (WebKit::NetworkProcess::hostNamesWithHSTSCache const): 28 (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): 29 (WebKit::NetworkProcess::clearHSTSCache): 30 (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. 31 * NetworkProcess/cocoa/NetworkSessionCocoa.h: 32 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 33 (WebKit::NetworkSessionCocoa::hstsStorage const): 34 (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 35 * NetworkProcess/soup/NetworkProcessSoup.cpp: 36 (WebKit::NetworkProcess::hostNamesWithHSTSCache const): 37 (WebKit::NetworkProcess::deleteHSTSCacheForHostNames): 38 (WebKit::NetworkProcess::clearHSTSCache): 39 (WebKit::NetworkProcess::getHostNamesWithHSTSCache): Deleted. 40 * UIProcess/API/C/mac/WKContextPrivateMac.h: 41 * UIProcess/API/C/mac/WKContextPrivateMac.mm: 42 (WKContextResetHSTSHosts): 43 (WKContextResetHSTSHostsAddedAfterDate): 44 * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: 45 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: 46 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: 47 (-[_WKWebsiteDataStoreConfiguration hstsStorageDirectory]): 48 (-[_WKWebsiteDataStoreConfiguration setHSTSStorageDirectory:]): 49 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 50 (WebKit::privateBrowsingSession): Deleted. 51 (WebKit::WebProcessPool::resetHSTSHosts): Deleted. 52 (WebKit::WebProcessPool::resetHSTSHostsAddedAfterDate): Deleted. 53 * UIProcess/WebProcessPool.h: 54 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 55 (WebKit::WebsiteDataStore::resolveDirectoriesIfNecessary): 56 (WebKit::WebsiteDataStore::parameters): 57 * UIProcess/WebsiteData/WebsiteDataStore.h: 58 (WebKit::WebsiteDataStore::resolvedHSTSStorageDirectory const): 59 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: 60 (WebKit::WebsiteDataStoreConfiguration::copy const): 61 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 62 1 63 2020-06-29 Tim Horton <timothy_horton@apple.com> 2 64 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp
r263422 r263724 1535 1535 1536 1536 #if PLATFORM(COCOA) || USE(SOUP) 1537 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { 1538 if (auto* networkStorageSession = storageSession(sessionID)) 1539 getHostNamesWithHSTSCache(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithHSTSCache); 1540 } 1537 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) 1538 callbackAggregator->m_websiteData.hostNamesWithHSTSCache = hostNamesWithHSTSCache(sessionID); 1541 1539 #endif 1542 1540 … … 1597 1595 { 1598 1596 #if PLATFORM(COCOA) || USE(SOUP) 1599 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { 1600 if (auto* networkStorageSession = storageSession(sessionID)) 1601 clearHSTSCache(*networkStorageSession, modifiedSince); 1602 } 1597 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) 1598 clearHSTSCache(sessionID, modifiedSince); 1603 1599 #endif 1604 1600 … … 1702 1698 1703 1699 #if PLATFORM(COCOA) || USE(SOUP) 1704 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { 1705 if (auto* networkStorageSession = storageSession(sessionID)) 1706 deleteHSTSCacheForHostNames(*networkStorageSession, HSTSCacheHostNames); 1707 } 1700 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) 1701 deleteHSTSCacheForHostNames(sessionID, HSTSCacheHostNames); 1708 1702 #endif 1709 1703 … … 1873 1867 #if PLATFORM(COCOA) || USE(SOUP) 1874 1868 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { 1875 if (auto* networkStorageSession = storageSession(sessionID)) { 1876 getHostNamesWithHSTSCache(*networkStorageSession, hostNamesWithHSTSCache); 1877 hostnamesWithHSTSToDelete = filterForRegistrableDomains(domainsToDeleteAllNonCookieWebsiteDataFor, hostNamesWithHSTSCache); 1878 1879 for (const auto& host : hostnamesWithHSTSToDelete) 1880 callbackAggregator->m_domains.add(RegistrableDomain::uncheckedCreateFromHost(host)); 1881 1882 deleteHSTSCacheForHostNames(*networkStorageSession, hostnamesWithHSTSToDelete); 1883 } 1869 hostNamesWithHSTSCache = this->hostNamesWithHSTSCache(sessionID); 1870 hostnamesWithHSTSToDelete = filterForRegistrableDomains(domainsToDeleteAllNonCookieWebsiteDataFor, hostNamesWithHSTSCache); 1871 1872 for (const auto& host : hostnamesWithHSTSToDelete) 1873 callbackAggregator->m_domains.add(RegistrableDomain::uncheckedCreateFromHost(host)); 1874 1875 deleteHSTSCacheForHostNames(sessionID, hostnamesWithHSTSToDelete); 1884 1876 } 1885 1877 #endif … … 2058 2050 })); 2059 2051 2060 auto& websiteData Store= callbackAggregator->m_websiteData;2052 auto& websiteData = callbackAggregator->m_websiteData; 2061 2053 2062 2054 if (websiteDataTypes.contains(WebsiteDataType::Cookies)) { 2063 2055 if (auto* networkStorageSession = storageSession(sessionID)) 2064 networkStorageSession->getHostnamesWithCookies(websiteData Store.hostNamesWithCookies);2056 networkStorageSession->getHostnamesWithCookies(websiteData.hostNamesWithCookies); 2065 2057 } 2066 2058 2067 2059 #if PLATFORM(COCOA) || USE(SOUP) 2068 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) { 2069 if (auto* networkStorageSession = storageSession(sessionID)) 2070 getHostNamesWithHSTSCache(*networkStorageSession, websiteDataStore.hostNamesWithHSTSCache); 2071 } 2060 if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) 2061 websiteData.hostNamesWithHSTSCache = hostNamesWithHSTSCache(sessionID); 2072 2062 #endif 2073 2063 -
trunk/Source/WebKit/NetworkProcess/NetworkProcess.h
r263444 r263724 194 194 #endif 195 195 #if PLATFORM(COCOA) || USE(SOUP) 196 void getHostNamesWithHSTSCache(WebCore::NetworkStorageSession&, HashSet<String>&);197 void deleteHSTSCacheForHostNames( WebCore::NetworkStorageSession&, const Vector<String>&);198 void clearHSTSCache( WebCore::NetworkStorageSession&, WallTime modifiedSince);196 HashSet<String> hostNamesWithHSTSCache(PAL::SessionID) const; 197 void deleteHSTSCacheForHostNames(PAL::SessionID, const Vector<String>&); 198 void clearHSTSCache(PAL::SessionID, WallTime modifiedSince); 199 199 #endif 200 200 -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
r263444 r263724 58 58 encoder << http3Enabled; 59 59 #endif 60 encoder << hstsStorageDirectory; 61 encoder << hstsStorageDirectoryExtensionHandle; 60 62 #if USE(SOUP) 61 63 encoder << cookiePersistentStoragePath; … … 154 156 #endif 155 157 158 Optional<String> hstsStorageDirectory; 159 decoder >> hstsStorageDirectory; 160 if (!hstsStorageDirectory) 161 return WTF::nullopt; 162 163 Optional<SandboxExtension::Handle> hstsStorageDirectoryExtensionHandle; 164 decoder >> hstsStorageDirectoryExtensionHandle; 165 if (!hstsStorageDirectoryExtensionHandle) 166 return WTF::nullopt; 167 156 168 #if USE(SOUP) 157 169 Optional<String> cookiePersistentStoragePath; … … 276 288 , WTFMove(*http3Enabled) 277 289 #endif 290 , WTFMove(*hstsStorageDirectory) 291 , WTFMove(*hstsStorageDirectoryExtensionHandle) 278 292 #if USE(SOUP) 279 293 , WTFMove(*cookiePersistentStoragePath) -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
r263444 r263724 70 70 bool http3Enabled { false }; 71 71 #endif 72 String hstsStorageDirectory; 73 SandboxExtension::Handle hstsStorageDirectoryExtensionHandle; 72 74 #if USE(SOUP) 73 75 String cookiePersistentStoragePath; -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
r263551 r263724 135 135 } 136 136 137 #if !HAVE(HSTS_STORAGE) 137 138 static void filterPreloadHSTSEntry(const void* key, const void* value, void* context) 138 139 { … … 153 154 hostnames->add((CFStringRef)key); 154 155 } 155 156 void NetworkProcess::getHostNamesWithHSTSCache(WebCore::NetworkStorageSession& session, HashSet<String>& hostNames) 157 { 158 if (auto HSTSPolicies = adoptCF(_CFNetworkCopyHSTSPolicies(session.platformSession()))) 159 CFDictionaryApplyFunction(HSTSPolicies.get(), filterPreloadHSTSEntry, &hostNames); 160 } 161 162 void NetworkProcess::deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession& session, const Vector<String>& hostNames) 163 { 164 for (auto& hostName : hostNames) { 165 auto url = URL({ }, makeString("https://", hostName)); 166 _CFNetworkResetHSTS(url.createCFURL().get(), session.platformSession()); 167 } 168 } 169 170 void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& session, WallTime modifiedSince) 156 #endif 157 158 HashSet<String> NetworkProcess::hostNamesWithHSTSCache(PAL::SessionID sessionID) const 159 { 160 HashSet<String> hostNames; 161 #if HAVE(HSTS_STORAGE) 162 if (auto* networkSession = static_cast<NetworkSessionCocoa*>(this->networkSession(sessionID))) { 163 for (NSString *host in networkSession->hstsStorage().nonPreloadedHosts) 164 hostNames.add(host); 165 } 166 #else 167 if (auto* session = storageSession(sessionID)) { 168 if (auto HSTSPolicies = adoptCF(_CFNetworkCopyHSTSPolicies(session->platformSession()))) 169 CFDictionaryApplyFunction(HSTSPolicies.get(), filterPreloadHSTSEntry, &hostNames); 170 } 171 #endif 172 return hostNames; 173 } 174 175 void NetworkProcess::deleteHSTSCacheForHostNames(PAL::SessionID sessionID, const Vector<String>& hostNames) 176 { 177 #if HAVE(HSTS_STORAGE) 178 if (auto* networkSession = static_cast<NetworkSessionCocoa*>(this->networkSession(sessionID))) { 179 for (auto& hostName : hostNames) 180 [networkSession->hstsStorage() resetHSTSForHost:hostName]; 181 } 182 #else 183 if (auto* session = storageSession(sessionID)) { 184 for (auto& hostName : hostNames) { 185 auto url = URL({ }, makeString("https://", hostName)); 186 _CFNetworkResetHSTS(url.createCFURL().get(), session->platformSession()); 187 } 188 } 189 #endif 190 } 191 192 void NetworkProcess::clearHSTSCache(PAL::SessionID sessionID, WallTime modifiedSince) 171 193 { 172 194 NSTimeInterval timeInterval = modifiedSince.secondsSinceEpoch().seconds(); 173 195 NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval]; 174 175 _CFNetworkResetHSTSHostsSinceDate(session.platformSession(), (__bridge CFDateRef)date); 196 #if HAVE(HSTS_STORAGE) 197 if (auto* networkSession = static_cast<NetworkSessionCocoa*>(this->networkSession(sessionID))) 198 [networkSession->hstsStorage() resetHSTSHostsSinceDate:date]; 199 #else 200 if (auto* session = storageSession(sessionID)) 201 _CFNetworkResetHSTSHostsSinceDate(session->platformSession(), (__bridge CFDateRef)date); 202 #endif 176 203 } 177 204 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
r263122 r263724 34 34 OBJC_CLASS WKNetworkSessionDelegate; 35 35 OBJC_CLASS WKNetworkSessionWebSocketDelegate; 36 OBJC_CLASS _NSHSTSStorage; 36 37 37 38 #include "DownloadID.h" … … 105 106 void taskFailed(NetworkDataTaskCocoa::TaskIdentifier); 106 107 NSURLCredential *successfulClientCertificateForHost(const String& host, uint16_t port) const; 108 _NSHSTSStorage *hstsStorage() const; 107 109 108 110 private: -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r263460 r263724 68 68 69 69 #import "DeviceManagementSoftLink.h" 70 71 // FIXME: Remove this soft link once rdar://problem/50109631 is in a build and bots are updated. 72 SOFT_LINK_FRAMEWORK(CFNetwork) 73 SOFT_LINK_CLASS_OPTIONAL(CFNetwork, _NSHSTSStorage) 70 74 71 75 using namespace WebKit; … … 1093 1097 } 1094 1098 1099 _NSHSTSStorage *NetworkSessionCocoa::hstsStorage() const 1100 { 1101 #if HAVE(HSTS_STORAGE) 1102 NSURLSessionConfiguration *configuration = m_sessionWithCredentialStorage.session.get().configuration; 1103 // FIXME: Remove this respondsToSelector check once rdar://problem/50109631 is in a build and bots are updated. 1104 if ([configuration respondsToSelector:@selector(_hstsStorage)]) 1105 return m_sessionWithCredentialStorage.session.get().configuration._hstsStorage; 1106 #endif 1107 return nil; 1108 } 1109 1095 1110 const String& NetworkSessionCocoa::boundInterfaceIdentifier() const 1096 1111 { … … 1172 1187 1173 1188 NSURLSessionConfiguration *configuration = configurationForSessionID(m_sessionID); 1189 1190 #if HAVE(HSTS_STORAGE) 1191 if (!!parameters.hstsStorageDirectory && !m_sessionID.isEphemeral()) { 1192 SandboxExtension::consumePermanently(parameters.hstsStorageDirectoryExtensionHandle); 1193 // FIXME: Remove this respondsToSelector check once rdar://problem/50109631 is in a build and bots are updated. 1194 if ([configuration respondsToSelector:@selector(_hstsStorage)]) 1195 configuration._hstsStorage = [[alloc_NSHSTSStorageInstance() initPersistentStoreWithURL:[NSURL fileURLWithPath:parameters.hstsStorageDirectory isDirectory:YES]] autorelease]; 1196 } 1197 #endif 1174 1198 1175 1199 #if HAVE(APP_SSO) || PLATFORM(MACCATALYST) -
trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp
r263444 r263724 95 95 } 96 96 97 void NetworkProcess::getHostNamesWithHSTSCache(WebCore::NetworkStorageSession& storageSession, HashSet<String>& hostNames) 98 { 99 const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID())); 97 HashSet<String> NetworkProcess::hostNamesWithHSTSCache(PAL::SessionID sessionID) const 98 { 99 HashSet<String> hostNames; 100 const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID)); 100 101 session->soupNetworkSession().getHostNamesWithHSTSCache(hostNames); 101 } 102 103 void NetworkProcess::deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession& storageSession, const Vector<String>& hostNames) 104 { 105 const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID())); 102 return hostNames; 103 } 104 105 void NetworkProcess::deleteHSTSCacheForHostNames(PAL::SessionID sessionID, const Vector<String>& hostNames) 106 { 107 const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID)); 106 108 session->soupNetworkSession().deleteHSTSCacheForHostNames(hostNames); 107 109 } 108 110 109 void NetworkProcess::clearHSTSCache( WebCore::NetworkStorageSession& storageSession, WallTime modifiedSince)110 { 111 const auto* session = static_cast<NetworkSessionSoup*>(networkSession(s torageSession.sessionID()));111 void NetworkProcess::clearHSTSCache(PAL::SessionID sessionID, WallTime modifiedSince) 112 { 113 const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID)); 112 114 session->soupNetworkSession().clearHSTSCache(modifiedSince); 113 115 } -
trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.h
r234960 r263724 28 28 29 29 #include <WebKit/WKBase.h> 30 #include <WebKit/WKDeprecated.h> 30 31 #include <WebKit/WKPluginLoadPolicy.h> 31 32 … … 44 45 WK_EXPORT void WKContextGetInfoForInstalledPlugIns(WKContextRef context, WKContextGetInfoForInstalledPlugInsBlock block); 45 46 46 WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context); 47 48 // The time here is relative to the Unix epoch. 49 WK_EXPORT void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970); 47 WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context) WK_C_API_DEPRECATED; 48 WK_EXPORT void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970) WK_C_API_DEPRECATED; 50 49 51 50 WK_EXPORT void WKContextRegisterSchemeForCustomProtocol(WKContextRef context, WKStringRef scheme); -
trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm
r262826 r263724 102 102 } 103 103 104 void WKContextResetHSTSHosts(WKContextRef context)104 void WKContextResetHSTSHosts(WKContextRef) 105 105 { 106 return WebKit::toImpl(context)->resetHSTSHosts();107 106 } 108 107 109 void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970)108 void WKContextResetHSTSHostsAddedAfterDate(WKContextRef, double) 110 109 { 111 return WebKit::toImpl(context)->resetHSTSHostsAddedAfterDate(startDateIntervalSince1970);112 110 } 113 111 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
r260334 r263724 69 69 @property (nonatomic) BOOL pageCacheEnabled WK_API_AVAILABLE(macos(10.14), ios(12.0)); 70 70 @property (nonatomic, getter=isJITEnabled) BOOL JITEnabled WK_API_AVAILABLE(macos(10.14.4), ios(12.2)); 71 @property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_ AVAILABLE(macos(10.15), ios(13.0));71 @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)); 72 72 73 73 @property (nonatomic) BOOL configureJSCForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h
r260334 r263724 73 73 @property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 74 74 @property (nonatomic) BOOL allowsServerPreconnect WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 75 @property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 75 76 76 77 @property (nonatomic, nullable, copy) NSURL *alternativeServicesStorageDirectory WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm
r260169 r263724 291 291 } 292 292 293 - (NSURL *)hstsStorageDirectory 294 { 295 return [NSURL fileURLWithPath:_configuration->hstsStorageDirectory() isDirectory:YES]; 296 } 297 298 - (void)setHSTSStorageDirectory:(NSURL *)url 299 { 300 if (!_configuration->isPersistent()) 301 [NSException raise:NSInvalidArgumentException format:@"Cannot set mediaKeysStorageDirectory on a non-persistent _WKWebsiteDataStoreConfiguration."]; 302 checkURLArgument(url); 303 _configuration->setHSTSStorageDirectory(url.path); 304 } 305 293 306 - (NSURL *)alternativeServicesStorageDirectory 294 307 { -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r263636 r263724 729 729 } 730 730 731 static CFURLStorageSessionRef privateBrowsingSession()732 {733 static CFURLStorageSessionRef session;734 static dispatch_once_t once;735 dispatch_once(&once, ^{736 NSString *identifier = [NSString stringWithFormat:@"%@.PrivateBrowsing", [[NSBundle mainBundle] bundleIdentifier]];737 session = createPrivateStorageSession((__bridge CFStringRef)identifier);738 });739 740 return session;741 }742 743 731 bool WebProcessPool::isURLKnownHSTSHost(const String& urlString) const 744 732 { … … 746 734 747 735 return _CFNetworkIsKnownHSTSHostWithSession(url.get(), nullptr); 748 }749 750 void WebProcessPool::resetHSTSHosts()751 {752 _CFNetworkResetHSTSHostsWithSession(nullptr);753 _CFNetworkResetHSTSHostsWithSession(privateBrowsingSession());754 }755 756 void WebProcessPool::resetHSTSHostsAddedAfterDate(double startDateIntervalSince1970)757 {758 NSDate *startDate = [NSDate dateWithTimeIntervalSince1970:startDateIntervalSince1970];759 _CFNetworkResetHSTSHostsSinceDate(nullptr, (__bridge CFDateRef)startDate);760 _CFNetworkResetHSTSHostsSinceDate(privateBrowsingSession(), (__bridge CFDateRef)startDate);761 736 } 762 737 -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r263383 r263724 423 423 424 424 bool isURLKnownHSTSHost(const String& urlString) const; 425 void resetHSTSHosts();426 void resetHSTSHostsAddedAfterDate(double startDateIntervalSince1970);427 425 428 426 static void registerGlobalURLSchemeAsHavingCustomProtocolHandlers(const String&); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r263570 r263724 233 233 if (!m_configuration->cacheStorageDirectory().isEmpty() && m_resolvedConfiguration->cacheStorageDirectory().isEmpty()) 234 234 m_resolvedConfiguration->setCacheStorageDirectory(resolvePathForSandboxExtension(m_configuration->cacheStorageDirectory())); 235 if (!m_configuration->hstsStorageDirectory().isEmpty() && m_resolvedConfiguration->hstsStorageDirectory().isEmpty()) 236 m_resolvedConfiguration->setHSTSStorageDirectory(resolvePathForSandboxExtension(m_configuration->hstsStorageDirectory())); 235 237 236 238 // Resolve directories for file paths. … … 2260 2262 SandboxExtension::createHandleForReadWriteDirectory(networkCacheDirectory, networkCacheDirectoryExtensionHandle); 2261 2263 2264 auto hstsStorageDirectory = resolvedHSTSStorageDirectory(); 2265 SandboxExtension::Handle hstsStorageDirectoryExtensionHandle; 2266 if (!hstsStorageDirectory.isEmpty()) 2267 SandboxExtension::createHandleForReadWriteDirectory(hstsStorageDirectory, hstsStorageDirectoryExtensionHandle); 2268 2262 2269 bool shouldIncludeLocalhostInResourceLoadStatistics = false; 2263 2270 bool enableResourceLoadStatisticsDebugMode = false; … … 2301 2308 networkSessionParameters.networkCacheDirectory = WTFMove(networkCacheDirectory); 2302 2309 networkSessionParameters.networkCacheDirectoryExtensionHandle = WTFMove(networkCacheDirectoryExtensionHandle); 2310 networkSessionParameters.hstsStorageDirectory = WTFMove(hstsStorageDirectory); 2311 networkSessionParameters.hstsStorageDirectoryExtensionHandle = WTFMove(hstsStorageDirectoryExtensionHandle); 2303 2312 networkSessionParameters.dataConnectionServiceType = m_configuration->dataConnectionServiceType(); 2304 2313 networkSessionParameters.fastServerTrustEvaluationEnabled = m_configuration->fastServerTrustEvaluationEnabled(); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h
r263444 r263724 225 225 const String& resolvedServiceWorkerRegistrationDirectory() const { return m_resolvedConfiguration->serviceWorkerRegistrationDirectory(); } 226 226 const String& resolvedResourceLoadStatisticsDirectory() const { return m_resolvedConfiguration->resourceLoadStatisticsDirectory(); } 227 const String& resolvedHSTSStorageDirectory() const { return m_resolvedConfiguration->hstsStorageDirectory(); } 227 228 228 229 DeviceIdHashSaltStorage& deviceIdHashSaltStorage() { return m_deviceIdHashSaltStorage.get(); } -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
r260169 r263724 68 68 copy->m_serviceWorkerRegistrationDirectory = this->m_serviceWorkerRegistrationDirectory; 69 69 copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory; 70 #if USE(GLIB)71 70 copy->m_hstsStorageDirectory = this->m_hstsStorageDirectory; 72 #endif73 71 copy->m_localStorageDirectory = this->m_localStorageDirectory; 74 72 copy->m_mediaKeysStorageDirectory = this->m_mediaKeysStorageDirectory; -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h
r263269 r263724 67 67 const String& webSQLDatabaseDirectory() const { return m_webSQLDatabaseDirectory; } 68 68 void setWebSQLDatabaseDirectory(String&& directory) { m_webSQLDatabaseDirectory = WTFMove(directory); } 69 #if USE(GLIB) // According to r245075 this will eventually move here. 69 70 70 const String& hstsStorageDirectory() const { return m_hstsStorageDirectory; } 71 71 void setHSTSStorageDirectory(String&& directory) { m_hstsStorageDirectory = WTFMove(directory); } 72 #endif 72 73 73 const String& localStorageDirectory() const { return m_localStorageDirectory; } 74 74 void setLocalStorageDirectory(String&& directory) { m_localStorageDirectory = WTFMove(directory); } … … 175 175 String m_serviceWorkerRegistrationDirectory; 176 176 String m_webSQLDatabaseDirectory; 177 String m_hstsStorageDirectory; 177 178 #if USE(GLIB) 178 String m_hstsStorageDirectory;179 179 bool m_networkCacheSpeculativeValidationEnabled { true }; 180 180 #else
Note: See TracChangeset
for help on using the changeset viewer.