Diff
Modified: trunk/Source/WebCore/ChangeLog (238062 => 238063)
--- trunk/Source/WebCore/ChangeLog 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebCore/ChangeLog 2018-11-10 04:50:03 UTC (rev 238063)
@@ -1,3 +1,25 @@
+2018-11-09 John Wilander <[email protected]>
+
+ Add ability to configure document.cookie lifetime cap through user defaults
+ https://bugs.webkit.org/show_bug.cgi?id=191480
+ <rdar://problem/45240871>
+
+ Reviewed by Chris Dumez.
+
+ No new tests. Existing test makes sure we don't regress.
+
+ This change makes the capped lifetime in seconds configurable through
+ user defaults.
+
+ * platform/network/NetworkStorageSession.h:
+ * platform/network/cf/NetworkStorageSessionCFNet.cpp:
+ (WebCore::NetworkStorageSession::setAgeCapForClientSideCookies):
+ (WebCore::NetworkStorageSession::setShouldCapLifetimeForClientSideCookies): Deleted.
+ Renamed setAgeCapForClientSideCookies().
+ * platform/network/cocoa/NetworkStorageSessionCocoa.mm:
+ (WebCore::filterCookies):
+ (WebCore::NetworkStorageSession::setCookiesFromDOM const):
+
2018-11-09 Ryan Haddad <[email protected]>
Unreviewed, rolling out r238047.
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (238062 => 238063)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2018-11-10 04:50:03 UTC (rev 238063)
@@ -104,7 +104,7 @@
WEBCORE_EXPORT bool shouldBlockCookies(const ResourceRequest&, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const;
WEBCORE_EXPORT bool shouldBlockCookies(const URL& firstPartyForCookies, const URL& resource, std::optional<uint64_t> frameID, std::optional<uint64_t> pageID) const;
WEBCORE_EXPORT void setPrevalentDomainsToBlockCookiesFor(const Vector<String>&);
- WEBCORE_EXPORT void setShouldCapLifetimeForClientSideCookies(bool value);
+ WEBCORE_EXPORT void setAgeCapForClientSideCookies(std::optional<Seconds>);
WEBCORE_EXPORT void removePrevalentDomains(const Vector<String>& domains);
WEBCORE_EXPORT bool hasStorageAccess(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID) const;
WEBCORE_EXPORT Vector<String> getAllStorageAccessEntries() const;
@@ -195,7 +195,7 @@
HashMap<uint64_t, HashMap<uint64_t, String, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_framesGrantedStorageAccess;
HashMap<uint64_t, HashMap<String, String>, DefaultHash<uint64_t>::Hash, WTF::UnsignedWithZeroKeyHashTraits<uint64_t>> m_pagesGrantedStorageAccess;
std::optional<Seconds> m_cacheMaxAgeCapForPrevalentResources { };
- bool m_shouldCapLifetimeForClientSideCookies { false };
+ std::optional<Seconds> m_ageCapForClientSideCookies { };
#endif
#if PLATFORM(COCOA)
Modified: trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp (238062 => 238063)
--- trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebCore/platform/network/cf/NetworkStorageSessionCFNet.cpp 2018-11-10 04:50:03 UTC (rev 238063)
@@ -273,9 +273,9 @@
return std::nullopt;
}
-void NetworkStorageSession::setShouldCapLifetimeForClientSideCookies(bool value)
+void NetworkStorageSession::setAgeCapForClientSideCookies(std::optional<Seconds> seconds)
{
- m_shouldCapLifetimeForClientSideCookies = value;
+ m_ageCapForClientSideCookies = seconds;
}
void NetworkStorageSession::setPrevalentDomainsToBlockCookiesFor(const Vector<String>& domains)
Modified: trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm (238062 => 238063)
--- trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm 2018-11-10 04:50:03 UTC (rev 238063)
@@ -260,13 +260,12 @@
return cookiesForURL(nsCookieStorage.get(), url, firstParty, sameSiteInfo);
}
-static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies, bool shouldCapLifetime)
+static RetainPtr<NSArray> filterCookies(NSArray *unfilteredCookies, std::optional<Seconds> cappedLifetime)
{
ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies));
NSUInteger count = [unfilteredCookies count];
RetainPtr<NSMutableArray> filteredCookies = adoptNS([[NSMutableArray alloc] initWithCapacity:count]);
- const NSTimeInterval secondsPerWeek = 7 * 24 * 60 * 60;
for (NSUInteger i = 0; i < count; ++i) {
NSHTTPCookie *cookie = (NSHTTPCookie *)[unfilteredCookies objectAtIndex:i];
@@ -281,10 +280,10 @@
continue;
// Cap lifetime of persistent, client-side cookies to a week.
- if (shouldCapLifetime && ![cookie isSessionOnly]) {
- if (!cookie.expiresDate || cookie.expiresDate.timeIntervalSinceNow > secondsPerWeek) {
+ if (cappedLifetime && ![cookie isSessionOnly]) {
+ if (!cookie.expiresDate || cookie.expiresDate.timeIntervalSinceNow > cappedLifetime->seconds()) {
RetainPtr<NSMutableDictionary<NSHTTPCookiePropertyKey, id>> properties = adoptNS([[cookie properties] mutableCopy]);
- RetainPtr<NSDate> dateInAWeek = adoptNS([[NSDate alloc] initWithTimeIntervalSinceNow:secondsPerWeek]);
+ RetainPtr<NSDate> dateInAWeek = adoptNS([[NSDate alloc] initWithTimeIntervalSinceNow:cappedLifetime->seconds()]);
[properties setObject:dateInAWeek.get() forKey:NSHTTPCookieExpires];
cookie = [NSHTTPCookie cookieWithProperties:properties.get()];
}
@@ -405,7 +404,7 @@
#endif
#if ENABLE(RESOURCE_LOAD_STATISTICS)
- RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, m_shouldCapLifetimeForClientSideCookies);
+ RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, m_ageCapForClientSideCookies);
#else
RetainPtr<NSArray> filteredCookies = filterCookies(unfilteredCookies, false);
#endif
Modified: trunk/Source/WebKit/ChangeLog (238062 => 238063)
--- trunk/Source/WebKit/ChangeLog 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/ChangeLog 2018-11-10 04:50:03 UTC (rev 238063)
@@ -1,3 +1,49 @@
+2018-11-09 John Wilander <[email protected]>
+
+ Add ability to configure document.cookie lifetime cap through user defaults
+ https://bugs.webkit.org/show_bug.cgi?id=191480
+ <rdar://problem/45240871>
+
+ Reviewed by Chris Dumez.
+
+ This change makes the capped lifetime in seconds configurable through
+ user defaults.
+
+ * NetworkProcess/NetworkProcess.cpp:
+ (WebKit::NetworkProcess::setAgeCapForClientSideCookies):
+ (WebKit::NetworkProcess::setShouldCapLifetimeForClientSideCookies): Deleted.
+ Renamed setAgeCapForClientSideCookies().
+ * NetworkProcess/NetworkProcess.h:
+ * NetworkProcess/NetworkProcess.messages.in:
+ * UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm:
+ (WebKit::ResourceLoadStatisticsMemoryStore::registerUserDefaultsIfNeeded):
+ * UIProcess/Network/NetworkProcessProxy.cpp:
+ (WebKit::NetworkProcessProxy::setAgeCapForClientSideCookies):
+ (WebKit::NetworkProcessProxy::didSetAgeCapForClientSideCookies):
+ (WebKit::NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies): Deleted.
+ Renamed setAgeCapForClientSideCookies().
+ (WebKit::NetworkProcessProxy::didSetShouldCapLifetimeForClientSideCookies): Deleted.
+ Renamed didSetAgeCapForClientSideCookies().
+ * UIProcess/Network/NetworkProcessProxy.h:
+ * UIProcess/Network/NetworkProcessProxy.messages.in:
+ * UIProcess/ResourceLoadStatisticsMemoryStore.cpp:
+ (WebKit::ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies):
+ (WebKit::ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap):
+ (WebKit::ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess):
+ New function that handles all the things that need to be done when a network
+ process has been created.
+ * UIProcess/ResourceLoadStatisticsMemoryStore.h:
+ * UIProcess/WebResourceLoadStatisticsStore.cpp:
+ (WebKit::WebResourceLoadStatisticsStore::didCreateNetworkProcess):
+ Now just calls the corresponding function on its memory store where all the
+ configuration parameters are available.
+ * UIProcess/WebResourceLoadStatisticsStore.h:
+ * UIProcess/WebsiteData/WebsiteDataStore.cpp:
+ (WebKit::WebsiteDataStore::setAgeCapForClientSideCookies):
+ (WebKit::WebsiteDataStore::setShouldCapLifetimeForClientSideCookies): Deleted.
+ Renamed setAgeCapForClientSideCookies().
+ * UIProcess/WebsiteData/WebsiteDataStore.h:
+
2018-11-09 Ryan Haddad <[email protected]>
Unreviewed, rolling out r238047.
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp (238062 => 238063)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.cpp 2018-11-10 04:50:03 UTC (rev 238063)
@@ -510,11 +510,11 @@
parentProcessConnection()->send(Messages::NetworkProcessProxy::DidUpdateBlockCookies(contextId), 0);
}
-void NetworkProcess::setShouldCapLifetimeForClientSideCookies(PAL::SessionID sessionID, bool value, uint64_t contextId)
+void NetworkProcess::setAgeCapForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, uint64_t contextId)
{
if (auto* networkStorageSession = NetworkStorageSession::storageSession(sessionID))
- networkStorageSession->setShouldCapLifetimeForClientSideCookies(value);
- parentProcessConnection()->send(Messages::NetworkProcessProxy::DidSetShouldCapLifetimeForClientSideCookies(contextId), 0);
+ networkStorageSession->setAgeCapForClientSideCookies(seconds);
+ parentProcessConnection()->send(Messages::NetworkProcessProxy::DidSetAgeCapForClientSideCookies(contextId), 0);
}
void NetworkProcess::hasStorageAccessForFrame(PAL::SessionID sessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.h (238062 => 238063)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.h 2018-11-10 04:50:03 UTC (rev 238063)
@@ -159,7 +159,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, uint64_t contextId);
- void setShouldCapLifetimeForClientSideCookies(PAL::SessionID, bool value, uint64_t contextId);
+ void setAgeCapForClientSideCookies(PAL::SessionID, std::optional<Seconds>, uint64_t contextId);
void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId);
void getAllStorageAccessEntries(PAL::SessionID, uint64_t contextId);
void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId);
Modified: trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in (238062 => 238063)
--- trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/NetworkProcess/NetworkProcess.messages.in 2018-11-10 04:50:03 UTC (rev 238063)
@@ -83,7 +83,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
UpdatePrevalentDomainsToBlockCookiesFor(PAL::SessionID sessionID, Vector<String> domainsToBlock, uint64_t contextId)
- SetShouldCapLifetimeForClientSideCookies(PAL::SessionID sessionID, bool value, uint64_t contextId)
+ SetAgeCapForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, uint64_t contextId)
HasStorageAccessForFrame(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, uint64_t frameID, uint64_t pageID, uint64_t contextId)
GetAllStorageAccessEntries(PAL::SessionID sessionID, uint64_t contextId)
GrantStorageAccess(PAL::SessionID sessionID, String resourceDomain, String firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, uint64_t contextId)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/Cocoa/ResourceLoadStatisticsMemoryStoreCocoa.mm 2018-11-10 04:50:03 UTC (rev 238063)
@@ -56,6 +56,10 @@
Seconds cacheMaxAgeCapForPrevalentResources([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsCacheMaxAgeCap"]);
if (cacheMaxAgeCapForPrevalentResources > 0_s && cacheMaxAgeCapForPrevalentResources <= 24_h * 365)
setCacheMaxAgeCap(cacheMaxAgeCapForPrevalentResources);
+
+ Seconds clientSideCookiesAgeCap([[NSUserDefaults standardUserDefaults] doubleForKey:@"ResourceLoadStatisticsClientSideCookiesAgeCap"]);
+ if (clientSideCookiesAgeCap > 0_s && clientSideCookiesAgeCap <= 24_h * 365)
+ setAgeCapForClientSideCookies(clientSideCookiesAgeCap);
});
}
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp 2018-11-10 04:50:03 UTC (rev 238063)
@@ -415,7 +415,7 @@
m_updateBlockCookiesCallbackMap.take(callbackId)();
}
-void NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies(PAL::SessionID sessionID, ShouldCapLifetimeForClientSideCookies shouldCapLifetime, CompletionHandler<void()>&& completionHandler)
+void NetworkProcessProxy::setAgeCapForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler)
{
if (!canSendMessage()) {
completionHandler();
@@ -427,10 +427,10 @@
completionHandler();
});
ASSERT_UNUSED(addResult, addResult.isNewEntry);
- send(Messages::NetworkProcess::SetShouldCapLifetimeForClientSideCookies(sessionID, shouldCapLifetime == ShouldCapLifetimeForClientSideCookies::Yes, callbackId), 0);
+ send(Messages::NetworkProcess::SetAgeCapForClientSideCookies(sessionID, seconds, callbackId), 0);
}
-void NetworkProcessProxy::didSetShouldCapLifetimeForClientSideCookies(uint64_t callbackId)
+void NetworkProcessProxy::didSetAgeCapForClientSideCookies(uint64_t callbackId)
{
m_updateBlockCookiesCallbackMap.take(callbackId)();
}
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h 2018-11-10 04:50:03 UTC (rev 238063)
@@ -79,7 +79,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
void updatePrevalentDomainsToBlockCookiesFor(PAL::SessionID, const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);
- void setShouldCapLifetimeForClientSideCookies(PAL::SessionID, ShouldCapLifetimeForClientSideCookies, CompletionHandler<void()>&&);
+ void setAgeCapForClientSideCookies(PAL::SessionID, std::optional<Seconds>, CompletionHandler<void()>&&);
void hasStorageAccessForFrame(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
void getAllStorageAccessEntries(PAL::SessionID, CompletionHandler<void(Vector<String>&& domains)>&&);
void grantStorageAccess(PAL::SessionID, const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool)>&& callback);
@@ -145,7 +145,7 @@
void logDiagnosticMessageWithValue(uint64_t pageID, const String& message, const String& description, double value, unsigned significantFigures, WebCore::ShouldSample);
#if ENABLE(RESOURCE_LOAD_STATISTICS)
void didUpdateBlockCookies(uint64_t contextId);
- void didSetShouldCapLifetimeForClientSideCookies(uint64_t contextId);
+ void didSetAgeCapForClientSideCookies(uint64_t contextId);
void storageAccessRequestResult(bool wasGranted, uint64_t contextId);
void allStorageAccessEntriesResult(Vector<String>&& domains, uint64_t contextId);
void didRemoveAllStorageAccess(uint64_t contextId);
Modified: trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in 2018-11-10 04:50:03 UTC (rev 238063)
@@ -43,7 +43,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
DidUpdateBlockCookies(uint64_t callbackId)
- DidSetShouldCapLifetimeForClientSideCookies(uint64_t callbackId)
+ DidSetAgeCapForClientSideCookies(uint64_t callbackId)
StorageAccessRequestResult(bool wasGranted, uint64_t contextId)
AllStorageAccessEntriesResult(Vector<String> domains, uint64_t contextId)
DidRemoveAllStorageAccess(uint64_t contextId)
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.cpp 2018-11-10 04:50:03 UTC (rev 238063)
@@ -848,6 +848,27 @@
});
}
+void ResourceLoadStatisticsMemoryStore::setAgeCapForClientSideCookies(Seconds seconds)
+{
+ ASSERT(!RunLoop::isMain());
+ ASSERT(seconds >= 0_s);
+
+ m_parameters.clientSideCookiesAgeCapTime = seconds;
+ updateClientSideCookiesAgeCap();
+}
+
+void ResourceLoadStatisticsMemoryStore::updateClientSideCookiesAgeCap()
+{
+ ASSERT(!RunLoop::isMain());
+
+#if ENABLE(RESOURCE_LOAD_STATISTICS)
+ RunLoop::main().dispatch([store = makeRef(m_store), seconds = m_parameters.clientSideCookiesAgeCapTime] () {
+ if (auto* websiteDataStore = store->websiteDataStore())
+ websiteDataStore->setAgeCapForClientSideCookies(seconds, [] { });
+ });
+#endif
+}
+
bool ResourceLoadStatisticsMemoryStore::shouldRemoveDataRecords() const
{
ASSERT(!RunLoop::isMain());
@@ -1264,4 +1285,13 @@
});
}
+void ResourceLoadStatisticsMemoryStore::didCreateNetworkProcess()
+{
+ ASSERT(!RunLoop::isMain());
+
+ updateCookieBlocking([]() { });
+ updateCacheMaxAgeCap();
+ updateClientSideCookiesAgeCap();
+}
+
} // namespace WebKit
Modified: trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h 2018-11-10 04:50:03 UTC (rev 238063)
@@ -112,8 +112,6 @@
void setTimeToLiveUserInteraction(Seconds);
void setMinimumTimeBetweenDataRecordsRemoval(Seconds);
void setGrandfatheringTime(Seconds);
- void setCacheMaxAgeCap(Seconds);
- void updateCacheMaxAgeCap();
void setResourceLoadStatisticsDebugMode(bool);
bool isDebugModeEnabled() const { return m_debugModeEnabled; };
void setPrevalentResourceForDebugMode(const String& domain);
@@ -130,6 +128,8 @@
void setLastSeen(const String& primaryDomain, Seconds);
+ void didCreateNetworkProcess();
+
private:
static bool shouldBlockAndKeepCookies(const WebCore::ResourceLoadStatistics&);
static bool shouldBlockAndPurgeCookies(const WebCore::ResourceLoadStatistics&);
@@ -152,6 +152,10 @@
void pruneStatisticsIfNeeded();
WebCore::ResourceLoadStatistics& ensureResourceStatisticsForPrimaryDomain(const String&);
Vector<String> topPrivatelyControlledDomainsToRemoveWebsiteDataFor();
+ void setCacheMaxAgeCap(Seconds);
+ void updateCacheMaxAgeCap();
+ void setAgeCapForClientSideCookies(Seconds);
+ void updateClientSideCookiesAgeCap();
#if PLATFORM(COCOA)
void registerUserDefaultsIfNeeded();
@@ -164,6 +168,7 @@
Seconds minimumTimeBetweenDataRecordsRemoval { 1_h };
Seconds grandfatheringTime { 24_h * 7 };
Seconds cacheMaxAgeCapTime { 24_h * 7 };
+ Seconds clientSideCookiesAgeCapTime { 24_h * 7 };
bool shouldNotifyPagesWhenDataRecordsWereScanned { false };
bool shouldClassifyResourcesBeforeDataRecordsRemoval { true };
bool shouldSubmitTelemetry { true };
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp 2018-11-10 04:50:03 UTC (rev 238063)
@@ -329,14 +329,8 @@
postTask([this] {
if (!m_memoryStore)
return;
- m_memoryStore->updateCookieBlocking([]() { });
- m_memoryStore->updateCacheMaxAgeCap();
+ m_memoryStore->didCreateNetworkProcess();
});
-
-#if ENABLE(RESOURCE_LOAD_STATISTICS)
- if (m_websiteDataStore)
- m_websiteDataStore->setShouldCapLifetimeForClientSideCookies(ShouldCapLifetimeForClientSideCookies::Yes, []() { });
-#endif
}
void WebResourceLoadStatisticsStore::removeAllStorageAccess(CompletionHandler<void()>&& completionHandler)
Modified: trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h 2018-11-10 04:50:03 UTC (rev 238063)
@@ -140,6 +140,8 @@
void didCreateNetworkProcess();
+ WebsiteDataStore* websiteDataStore() { return m_websiteDataStore.get(); }
+
private:
explicit WebResourceLoadStatisticsStore(WebsiteDataStore&);
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp 2018-11-10 04:50:03 UTC (rev 238063)
@@ -1266,13 +1266,13 @@
}
}
-void WebsiteDataStore::setShouldCapLifetimeForClientSideCookies(ShouldCapLifetimeForClientSideCookies shouldCapLifetime, CompletionHandler<void()>&& completionHandler)
+void WebsiteDataStore::setAgeCapForClientSideCookies(std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler)
{
auto callbackAggregator = CallbackAggregator::create(WTFMove(completionHandler));
for (auto& processPool : processPools()) {
if (auto* process = processPool->networkProcess())
- process->setShouldCapLifetimeForClientSideCookies(m_sessionID, shouldCapLifetime, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
+ process->setAgeCapForClientSideCookies(m_sessionID, seconds, [processPool, callbackAggregator = callbackAggregator.copyRef()] { });
}
}
Modified: trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h (238062 => 238063)
--- trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-11-10 01:40:18 UTC (rev 238062)
+++ trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h 2018-11-10 04:50:03 UTC (rev 238063)
@@ -78,8 +78,6 @@
struct PluginModuleInfo;
#endif
-enum class ShouldCapLifetimeForClientSideCookies { No, Yes };
-
class WebsiteDataStore : public RefCounted<WebsiteDataStore>, public WebProcessLifetimeObserver, public Identified<WebsiteDataStore>, public CanMakeWeakPtr<WebsiteDataStore> {
public:
constexpr static uint64_t defaultCacheStoragePerOriginQuota = 50 * 1024 * 1024;
@@ -142,7 +140,7 @@
#if ENABLE(RESOURCE_LOAD_STATISTICS)
void updatePrevalentDomainsToBlockCookiesFor(const Vector<String>& domainsToBlock, CompletionHandler<void()>&&);
- void setShouldCapLifetimeForClientSideCookies(ShouldCapLifetimeForClientSideCookies, CompletionHandler<void()>&&);
+ void setAgeCapForClientSideCookies(std::optional<Seconds>, CompletionHandler<void()>&&);
void hasStorageAccessForFrameHandler(const String& resourceDomain, const String& firstPartyDomain, uint64_t frameID, uint64_t pageID, CompletionHandler<void(bool hasAccess)>&&);
void getAllStorageAccessEntries(uint64_t pageID, CompletionHandler<void(Vector<String>&& domains)>&&);
void grantStorageAccessHandler(const String& resourceDomain, const String& firstPartyDomain, std::optional<uint64_t> frameID, uint64_t pageID, CompletionHandler<void(bool wasGranted)>&&);