RESOLVED FIXED 191480
Add ability to configure document.cookie lifetime cap through user defaults
https://bugs.webkit.org/show_bug.cgi?id=191480
Summary Add ability to configure document.cookie lifetime cap through user defaults
John Wilander
Reported 2018-11-09 12:25:57 PST
We should have a way to configure the lifetime cap introduced in https://bugs.webkit.org/show_bug.cgi?id=189933.
Attachments
Patch (23.01 KB, patch)
2018-11-09 12:29 PST, John Wilander
no flags
Patch (25.02 KB, patch)
2018-11-09 15:02 PST, John Wilander
no flags
Patch (26.70 KB, patch)
2018-11-09 16:36 PST, John Wilander
no flags
Patch (26.74 KB, patch)
2018-11-09 16:44 PST, John Wilander
no flags
Patch for landing (26.73 KB, patch)
2018-11-09 20:13 PST, John Wilander
no flags
John Wilander
Comment 1 2018-11-09 12:26:22 PST
John Wilander
Comment 2 2018-11-09 12:29:47 PST
John Wilander
Comment 3 2018-11-09 13:31:58 PST
I hit the same build error locally that the ios-sim bot is seeing. There seems to be a problem with our derived code. The message has been updated to transfer an optional Seconds parameter instead of a boolean but for some reason it's not picked up. I had to wipe my WebKit Build directory to make it work. :(
Chris Dumez
Comment 4 2018-11-09 13:34:57 PST
Comment on attachment 354373 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354373&action=review > Source/WebCore/platform/network/NetworkStorageSession.h:195 > + std::optional<Seconds> m_shouldCapLifetimeForClientSideCookies { }; a m_shouldCapLifetimeForClientSideCookies named variable that is no a boolean seems super weird. This variable and getter / setter probably need better names now?
John Wilander
Comment 5 2018-11-09 13:41:54 PST
(In reply to Chris Dumez from comment #4) > Comment on attachment 354373 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=354373&action=review > > > Source/WebCore/platform/network/NetworkStorageSession.h:195 > > + std::optional<Seconds> m_shouldCapLifetimeForClientSideCookies { }; > > a m_shouldCapLifetimeForClientSideCookies named variable that is no a > boolean seems super weird. This variable and getter / setter probably need > better names now? True. Will fix.
Chris Dumez
Comment 6 2018-11-09 14:42:45 PST
Comment on attachment 354373 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354373&action=review > Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h:118 > + void updateClientSideCookiesAgeCap(); Why is this public? > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:334 > + m_memoryStore->updateClientSideCookiesAgeCap(); Which we should call something like: m_memoryStore->didCreateNetworkProcess(); And let its implementation decide what it needs to do. This would likely allow these update*() methods to be private. > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:842 > +void WebResourceLoadStatisticsStore::setClientSideCookiesAgeCap(std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) Do we really need this setter? Can't the memory store call setShouldCapLifetimeForClientSideCookies() on the websiteDataStore by itself?
John Wilander
Comment 7 2018-11-09 14:51:03 PST
(In reply to Chris Dumez from comment #6) > Comment on attachment 354373 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=354373&action=review > > > Source/WebKit/UIProcess/ResourceLoadStatisticsMemoryStore.h:118 > > + void updateClientSideCookiesAgeCap(); > > Why is this public? It's called in WebResourceLoadStatisticsStore::didCreateNetworkProcess(). > > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:334 > > + m_memoryStore->updateClientSideCookiesAgeCap(); > > Which we should call something like: > m_memoryStore->didCreateNetworkProcess(); > > And let its implementation decide what it needs to do. This would likely > allow these update*() methods to be private. True. I can change that. > > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:842 > > +void WebResourceLoadStatisticsStore::setClientSideCookiesAgeCap(std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) > > Do we really need this setter? Can't the memory store call > setShouldCapLifetimeForClientSideCookies() on the websiteDataStore by itself? The memory store doesn't have a pointer to the WebsiteDataStore.
John Wilander
Comment 8 2018-11-09 15:02:03 PST
Chris Dumez
Comment 9 2018-11-09 15:57:37 PST
Comment on attachment 354392 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354392&action=review > Source/WebCore/platform/network/NetworkStorageSession.h:106 > + WEBCORE_EXPORT void setShouldCapLifetimeForClientSideCookies(std::optional<Seconds>); Bad name for setter. > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:284 > + if (!cookie.expiresDate || cookie.expiresDate.timeIntervalSinceNow > cappedLifetime.value().seconds()) { cappedLifetime->seconds() is shorter. > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:286 > + RetainPtr<NSDate> dateInAWeek = adoptNS([[NSDate alloc] initWithTimeIntervalSinceNow:cappedLifetime.value().seconds()]); ditto. > Source/WebKit/NetworkProcess/NetworkProcess.h:161 > + void setShouldCapLifetimeForClientSideCookies(PAL::SessionID, std::optional<Seconds>, uint64_t contextId); Bad name. > Source/WebKit/NetworkProcess/NetworkProcess.messages.in:82 > + SetShouldCapLifetimeForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, uint64_t contextId) Bad name. > Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:418 > +void NetworkProcessProxy::setShouldCapLifetimeForClientSideCookies(PAL::SessionID sessionID, std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) Bad name > Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:430 > + send(Messages::NetworkProcess::SetShouldCapLifetimeForClientSideCookies(sessionID, seconds, callbackId), 0); Bad name > Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:82 > + void setShouldCapLifetimeForClientSideCookies(PAL::SessionID, std::optional<Seconds>, CompletionHandler<void()>&&); Bad name > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.cpp:840 > +void WebResourceLoadStatisticsStore::setClientSideCookiesAgeCap(std::optional<Seconds> seconds, CompletionHandler<void()>&& completionHandler) Why do we have this method? Cannot the memory store call setShouldCapLifetimeForClientSideCookies() on the WebsiteDataStore directly? (getting the WebSiteDataStore from the WebResourceLoadStatisticsStore). This method confuses me as setters on the WebResourceLoadStatisticsStore() usually forward the call to the memory store. > Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:139 > + void setShouldCapLifetimeForClientSideCookies(std::optional<Seconds>, CompletionHandler<void()>&&); Bad name.
John Wilander
Comment 10 2018-11-09 16:36:16 PST
John Wilander
Comment 11 2018-11-09 16:44:45 PST
John Wilander
Comment 12 2018-11-09 16:45:05 PST
Non-Cocoa build fix.
Chris Dumez
Comment 13 2018-11-09 18:24:34 PST
Comment on attachment 354415 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=354415&action=review r=me with comment. > Source/WebKit/UIProcess/WebResourceLoadStatisticsStore.h:143 > + WebsiteDataStore* getWebsiteDataStore() { return m_websiteDataStore.get(); } We NEVER use 'get' prefix for getters in WebKit. This should be named websiteDataStore().
John Wilander
Comment 14 2018-11-09 20:13:00 PST
Created attachment 354433 [details] Patch for landing
John Wilander
Comment 15 2018-11-09 20:13:37 PST
Thanks, Chris! Have a nice weekend.
WebKit Commit Bot
Comment 16 2018-11-09 20:50:10 PST
Comment on attachment 354433 [details] Patch for landing Clearing flags on attachment: 354433 Committed r238063: <https://trac.webkit.org/changeset/238063>
WebKit Commit Bot
Comment 17 2018-11-09 20:50:12 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.