Changeset 263736 in webkit


Ignore:
Timestamp:
Jun 30, 2020 2:26:57 AM (4 years ago)
Author:
commit-queue@webkit.org
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

Location:
trunk/Source
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r263726 r263736  
     12020-06-30  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r263724.
     4        https://bugs.webkit.org/show_bug.cgi?id=213781
     5
     6
     7        Reverted changeset:
     8
     9        "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
     10        replace _WKProcessPoolConfiguration.hstsStorageDirectory"
     11        https://bugs.webkit.org/show_bug.cgi?id=213048
     12        https://trac.webkit.org/changeset/263724
     13
    1142020-06-29  Geoffrey Garen  <ggaren@apple.com>
    215
  • trunk/Source/WTF/wtf/PlatformHave.h

    r263724 r263736  
    408408#endif
    409409
    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 
    417410#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101600) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 140000)
    418411#define HAVE_CFNETWORK_METRICS_APIS_V4 1
  • trunk/Source/WebCore/PAL/ChangeLog

    r263724 r263736  
     12020-06-30  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r263724.
     4        https://bugs.webkit.org/show_bug.cgi?id=213781
     5
     6
     7        Reverted changeset:
     8
     9        "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
     10        replace _WKProcessPoolConfiguration.hstsStorageDirectory"
     11        https://bugs.webkit.org/show_bug.cgi?id=213048
     12        https://trac.webkit.org/changeset/263724
     13
    1142020-06-29  Alex Christensen  <achristensen@webkit.org>
    215
  • trunk/Source/WebCore/PAL/pal/spi/cf/CFNetworkSPI.h

    r263724 r263736  
    408408Boolean _CFNetworkSetATSContext(CFDataRef);
    409409
    410 #if PLATFORM(COCOA) && !HAVE(HSTS_STORAGE)
     410#if PLATFORM(COCOA)
    411411extern const CFStringRef _kCFNetworkHSTSPreloaded;
    412412CFDictionaryRef _CFNetworkCopyHSTSPolicies(CFURLStorageSessionRef);
     
    459459@end
    460460
    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 
    471461@interface NSURLSessionConfiguration ()
    472462// FIXME: Remove this once rdar://problem/40650244 is in a build.
    473463@property (copy) NSDictionary *_socketStreamProperties;
    474 #if HAVE(HSTS_STORAGE)
    475 @property (nullable, retain) _NSHSTSStorage *_hstsStorage;
    476 #endif
    477464@end
    478465
  • trunk/Source/WebKit/ChangeLog

    r263734 r263736  
     12020-06-30  Commit Queue  <commit-queue@webkit.org>
     2
     3        Unreviewed, reverting r263724.
     4        https://bugs.webkit.org/show_bug.cgi?id=213781
     5
     6
     7        Reverted changeset:
     8
     9        "Make _WKWebsiteDataStoreConfiguration SPI for HSTS storage to
     10        replace _WKProcessPoolConfiguration.hstsStorageDirectory"
     11        https://bugs.webkit.org/show_bug.cgi?id=213048
     12        https://trac.webkit.org/changeset/263724
     13
    1142020-06-30  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp

    r263724 r263736  
    15351535
    15361536#if PLATFORM(COCOA) || USE(SOUP)
    1537     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
    1538         callbackAggregator->m_websiteData.hostNamesWithHSTSCache = hostNamesWithHSTSCache(sessionID);
     1537    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
     1538        if (auto* networkStorageSession = storageSession(sessionID))
     1539            getHostNamesWithHSTSCache(*networkStorageSession, callbackAggregator->m_websiteData.hostNamesWithHSTSCache);
     1540    }
    15391541#endif
    15401542
     
    15951597{
    15961598#if PLATFORM(COCOA) || USE(SOUP)
    1597     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
    1598         clearHSTSCache(sessionID, modifiedSince);
     1599    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
     1600        if (auto* networkStorageSession = storageSession(sessionID))
     1601            clearHSTSCache(*networkStorageSession, modifiedSince);
     1602    }
    15991603#endif
    16001604
     
    16981702
    16991703#if PLATFORM(COCOA) || USE(SOUP)
    1700     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
    1701         deleteHSTSCacheForHostNames(sessionID, HSTSCacheHostNames);
     1704    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
     1705        if (auto* networkStorageSession = storageSession(sessionID))
     1706            deleteHSTSCacheForHostNames(*networkStorageSession, HSTSCacheHostNames);
     1707    }
    17021708#endif
    17031709
     
    18671873#if PLATFORM(COCOA) || USE(SOUP)
    18681874    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
    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);
     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        }
    18761884    }
    18771885#endif
     
    20502058    }));
    20512059   
    2052     auto& websiteData = callbackAggregator->m_websiteData;
     2060    auto& websiteDataStore = callbackAggregator->m_websiteData;
    20532061   
    20542062    if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
    20552063        if (auto* networkStorageSession = storageSession(sessionID))
    2056             networkStorageSession->getHostnamesWithCookies(websiteData.hostNamesWithCookies);
     2064            networkStorageSession->getHostnamesWithCookies(websiteDataStore.hostNamesWithCookies);
    20572065    }
    20582066   
    20592067#if PLATFORM(COCOA) || USE(SOUP)
    2060     if (websiteDataTypes.contains(WebsiteDataType::HSTSCache))
    2061         websiteData.hostNamesWithHSTSCache = hostNamesWithHSTSCache(sessionID);
     2068    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
     2069        if (auto* networkStorageSession = storageSession(sessionID))
     2070            getHostNamesWithHSTSCache(*networkStorageSession, websiteDataStore.hostNamesWithHSTSCache);
     2071    }
    20622072#endif
    20632073
  • trunk/Source/WebKit/NetworkProcess/NetworkProcess.h

    r263724 r263736  
    194194#endif
    195195#if PLATFORM(COCOA) || USE(SOUP)
    196     HashSet<String> hostNamesWithHSTSCache(PAL::SessionID) const;
    197     void deleteHSTSCacheForHostNames(PAL::SessionID, const Vector<String>&);
    198     void clearHSTSCache(PAL::SessionID, WallTime modifiedSince);
     196    void getHostNamesWithHSTSCache(WebCore::NetworkStorageSession&, HashSet<String>&);
     197    void deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession&, const Vector<String>&);
     198    void clearHSTSCache(WebCore::NetworkStorageSession&, WallTime modifiedSince);
    199199#endif
    200200
  • trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp

    r263724 r263736  
    5858    encoder << http3Enabled;
    5959#endif
    60     encoder << hstsStorageDirectory;
    61     encoder << hstsStorageDirectoryExtensionHandle;
    6260#if USE(SOUP)
    6361    encoder << cookiePersistentStoragePath;
     
    156154#endif
    157155
    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    
    168156#if USE(SOUP)
    169157    Optional<String> cookiePersistentStoragePath;
     
    288276        , WTFMove(*http3Enabled)
    289277#endif
    290         , WTFMove(*hstsStorageDirectory)
    291         , WTFMove(*hstsStorageDirectoryExtensionHandle)
    292278#if USE(SOUP)
    293279        , WTFMove(*cookiePersistentStoragePath)
  • trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h

    r263724 r263736  
    7070    bool http3Enabled { false };
    7171#endif
    72     String hstsStorageDirectory;
    73     SandboxExtension::Handle hstsStorageDirectoryExtensionHandle;
    7472#if USE(SOUP)
    7573    String cookiePersistentStoragePath;
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm

    r263724 r263736  
    135135}
    136136
    137 #if !HAVE(HSTS_STORAGE)
    138137static void filterPreloadHSTSEntry(const void* key, const void* value, void* context)
    139138{
     
    154153        hostnames->add((CFStringRef)key);
    155154}
    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);
     155
     156void 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
     162void 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());
    165167    }
    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)
     168}
     169
     170void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& session, WallTime modifiedSince)
    193171{
    194172    NSTimeInterval timeInterval = modifiedSince.secondsSinceEpoch().seconds();
    195173    NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
    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
     174
     175    _CFNetworkResetHSTSHostsSinceDate(session.platformSession(), (__bridge CFDateRef)date);
    203176}
    204177
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h

    r263724 r263736  
    3434OBJC_CLASS WKNetworkSessionDelegate;
    3535OBJC_CLASS WKNetworkSessionWebSocketDelegate;
    36 OBJC_CLASS _NSHSTSStorage;
    3736
    3837#include "DownloadID.h"
     
    106105    void taskFailed(NetworkDataTaskCocoa::TaskIdentifier);
    107106    NSURLCredential *successfulClientCertificateForHost(const String& host, uint16_t port) const;
    108     _NSHSTSStorage *hstsStorage() const;
    109107
    110108private:
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r263724 r263736  
    6868
    6969#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)
    7470
    7571using namespace WebKit;
     
    10971093}
    10981094
    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 
    11101095const String& NetworkSessionCocoa::boundInterfaceIdentifier() const
    11111096{
     
    11871172
    11881173    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
    11981174
    11991175#if HAVE(APP_SSO) || PLATFORM(MACCATALYST)
  • trunk/Source/WebKit/NetworkProcess/soup/NetworkProcessSoup.cpp

    r263724 r263736  
    9595}
    9696
    97 HashSet<String> NetworkProcess::hostNamesWithHSTSCache(PAL::SessionID sessionID) const
    98 {
    99     HashSet<String> hostNames;
    100     const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID));
     97void NetworkProcess::getHostNamesWithHSTSCache(WebCore::NetworkStorageSession& storageSession, HashSet<String>& hostNames)
     98{
     99    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID()));
    101100    session->soupNetworkSession().getHostNamesWithHSTSCache(hostNames);
    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));
     101}
     102
     103void NetworkProcess::deleteHSTSCacheForHostNames(WebCore::NetworkStorageSession& storageSession, const Vector<String>& hostNames)
     104{
     105    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID()));
    108106    session->soupNetworkSession().deleteHSTSCacheForHostNames(hostNames);
    109107}
    110108
    111 void NetworkProcess::clearHSTSCache(PAL::SessionID sessionID, WallTime modifiedSince)
    112 {
    113     const auto* session = static_cast<NetworkSessionSoup*>(networkSession(sessionID));
     109void NetworkProcess::clearHSTSCache(WebCore::NetworkStorageSession& storageSession, WallTime modifiedSince)
     110{
     111    const auto* session = static_cast<NetworkSessionSoup*>(networkSession(storageSession.sessionID()));
    114112    session->soupNetworkSession().clearHSTSCache(modifiedSince);
    115113}
  • trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.h

    r263724 r263736  
    2828
    2929#include <WebKit/WKBase.h>
    30 #include <WebKit/WKDeprecated.h>
    3130#include <WebKit/WKPluginLoadPolicy.h>
    3231
     
    4544WK_EXPORT void WKContextGetInfoForInstalledPlugIns(WKContextRef context, WKContextGetInfoForInstalledPlugInsBlock block);
    4645
    47 WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context) WK_C_API_DEPRECATED;
    48 WK_EXPORT void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970) WK_C_API_DEPRECATED;
     46WK_EXPORT void WKContextResetHSTSHosts(WKContextRef context);
     47
     48// The time here is relative to the Unix epoch.
     49WK_EXPORT void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970);
    4950
    5051WK_EXPORT void WKContextRegisterSchemeForCustomProtocol(WKContextRef context, WKStringRef scheme);
  • trunk/Source/WebKit/UIProcess/API/C/mac/WKContextPrivateMac.mm

    r263724 r263736  
    102102}
    103103
    104 void WKContextResetHSTSHosts(WKContextRef)
     104void WKContextResetHSTSHosts(WKContextRef context)
    105105{
     106    return WebKit::toImpl(context)->resetHSTSHosts();
    106107}
    107108
    108 void WKContextResetHSTSHostsAddedAfterDate(WKContextRef, double)
     109void WKContextResetHSTSHostsAddedAfterDate(WKContextRef context, double startDateIntervalSince1970)
    109110{
     111    return WebKit::toImpl(context)->resetHSTSHostsAddedAfterDate(startDateIntervalSince1970);
    110112}
    111113
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h

    r263724 r263736  
    6969@property (nonatomic) BOOL pageCacheEnabled WK_API_AVAILABLE(macos(10.14), ios(12.0));
    7070@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_DEPRECATED_WITH_REPLACEMENT("_WKWebsiteDataStoreConfiguration.hstsStorageDirectory", macos(10.15, WK_MAC_TBA), ios(13.0, WK_IOS_TBA));
     71@property (nonatomic, nullable, copy, setter=setHSTSStorageDirectory:) NSURL *hstsStorageDirectory WK_API_AVAILABLE(macos(10.15), ios(13.0));
    7272
    7373@property (nonatomic) BOOL configureJSCForTesting WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
  • trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h

    r263724 r263736  
    7373@property (nonatomic) BOOL suppressesConnectionTerminationOnSystemChange WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA));
    7474@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));
    7675
    7776@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

    r263724 r263736  
    291291}
    292292
    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 
    306293- (NSURL *)alternativeServicesStorageDirectory
    307294{
  • trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm

    r263724 r263736  
    729729}
    730730
     731static 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
    731743bool WebProcessPool::isURLKnownHSTSHost(const String& urlString) const
    732744{
     
    734746
    735747    return _CFNetworkIsKnownHSTSHostWithSession(url.get(), nullptr);
     748}
     749
     750void WebProcessPool::resetHSTSHosts()
     751{
     752    _CFNetworkResetHSTSHostsWithSession(nullptr);
     753    _CFNetworkResetHSTSHostsWithSession(privateBrowsingSession());
     754}
     755
     756void WebProcessPool::resetHSTSHostsAddedAfterDate(double startDateIntervalSince1970)
     757{
     758    NSDate *startDate = [NSDate dateWithTimeIntervalSince1970:startDateIntervalSince1970];
     759    _CFNetworkResetHSTSHostsSinceDate(nullptr, (__bridge CFDateRef)startDate);
     760    _CFNetworkResetHSTSHostsSinceDate(privateBrowsingSession(), (__bridge CFDateRef)startDate);
    736761}
    737762
  • trunk/Source/WebKit/UIProcess/WebProcessPool.h

    r263724 r263736  
    423423
    424424    bool isURLKnownHSTSHost(const String& urlString) const;
     425    void resetHSTSHosts();
     426    void resetHSTSHostsAddedAfterDate(double startDateIntervalSince1970);
    425427
    426428    static void registerGlobalURLSchemeAsHavingCustomProtocolHandlers(const String&);
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r263724 r263736  
    233233    if (!m_configuration->cacheStorageDirectory().isEmpty() && m_resolvedConfiguration->cacheStorageDirectory().isEmpty())
    234234        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()));
    237235
    238236    // Resolve directories for file paths.
     
    22622260        SandboxExtension::createHandleForReadWriteDirectory(networkCacheDirectory, networkCacheDirectoryExtensionHandle);
    22632261
    2264     auto hstsStorageDirectory = resolvedHSTSStorageDirectory();
    2265     SandboxExtension::Handle hstsStorageDirectoryExtensionHandle;
    2266     if (!hstsStorageDirectory.isEmpty())
    2267         SandboxExtension::createHandleForReadWriteDirectory(hstsStorageDirectory, hstsStorageDirectoryExtensionHandle);
    2268 
    22692262    bool shouldIncludeLocalhostInResourceLoadStatistics = false;
    22702263    bool enableResourceLoadStatisticsDebugMode = false;
     
    23082301    networkSessionParameters.networkCacheDirectory = WTFMove(networkCacheDirectory);
    23092302    networkSessionParameters.networkCacheDirectoryExtensionHandle = WTFMove(networkCacheDirectoryExtensionHandle);
    2310     networkSessionParameters.hstsStorageDirectory = WTFMove(hstsStorageDirectory);
    2311     networkSessionParameters.hstsStorageDirectoryExtensionHandle = WTFMove(hstsStorageDirectoryExtensionHandle);
    23122303    networkSessionParameters.dataConnectionServiceType = m_configuration->dataConnectionServiceType();
    23132304    networkSessionParameters.fastServerTrustEvaluationEnabled = m_configuration->fastServerTrustEvaluationEnabled();
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r263724 r263736  
    225225    const String& resolvedServiceWorkerRegistrationDirectory() const { return m_resolvedConfiguration->serviceWorkerRegistrationDirectory(); }
    226226    const String& resolvedResourceLoadStatisticsDirectory() const { return m_resolvedConfiguration->resourceLoadStatisticsDirectory(); }
    227     const String& resolvedHSTSStorageDirectory() const { return m_resolvedConfiguration->hstsStorageDirectory(); }
    228227
    229228    DeviceIdHashSaltStorage& deviceIdHashSaltStorage() { return m_deviceIdHashSaltStorage.get(); }
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp

    r263724 r263736  
    6868    copy->m_serviceWorkerRegistrationDirectory = this->m_serviceWorkerRegistrationDirectory;
    6969    copy->m_webSQLDatabaseDirectory = this->m_webSQLDatabaseDirectory;
     70#if USE(GLIB)
    7071    copy->m_hstsStorageDirectory = this->m_hstsStorageDirectory;
     72#endif
    7173    copy->m_localStorageDirectory = this->m_localStorageDirectory;
    7274    copy->m_mediaKeysStorageDirectory = this->m_mediaKeysStorageDirectory;
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h

    r263724 r263736  
    6767    const String& webSQLDatabaseDirectory() const { return m_webSQLDatabaseDirectory; }
    6868    void setWebSQLDatabaseDirectory(String&& directory) { m_webSQLDatabaseDirectory = WTFMove(directory); }
    69 
     69#if USE(GLIB) // According to r245075 this will eventually move here.
    7070    const String& hstsStorageDirectory() const { return m_hstsStorageDirectory; }
    7171    void setHSTSStorageDirectory(String&& directory) { m_hstsStorageDirectory = WTFMove(directory); }
    72 
     72#endif
    7373    const String& localStorageDirectory() const { return m_localStorageDirectory; }
    7474    void setLocalStorageDirectory(String&& directory) { m_localStorageDirectory = WTFMove(directory); }
     
    175175    String m_serviceWorkerRegistrationDirectory;
    176176    String m_webSQLDatabaseDirectory;
     177#if USE(GLIB)
    177178    String m_hstsStorageDirectory;
    178 #if USE(GLIB)
    179179    bool m_networkCacheSpeculativeValidationEnabled { true };
    180180#else
Note: See TracChangeset for help on using the changeset viewer.