RESOLVED FIXED 207593
[WK2][Cocoa] Implement in-WebProcess cookie cache to avoid sync IPC for document.cookie in most cases
https://bugs.webkit.org/show_bug.cgi?id=207593
Summary [WK2][Cocoa] Implement in-WebProcess cookie cache to avoid sync IPC for docum...
Chris Dumez
Reported 2020-02-11 15:46:06 PST
Implement in-WebProcess cookie cache to avoid sync IPC for document.cookie in most cases.
Attachments
WIP Patch (55.13 KB, patch)
2020-02-11 15:48 PST, Chris Dumez
no flags
WIP Patch (56.26 KB, patch)
2020-02-11 16:37 PST, Chris Dumez
no flags
WIP Patch (58.43 KB, patch)
2020-02-12 10:24 PST, Chris Dumez
no flags
WIP Patch (59.51 KB, patch)
2020-02-12 10:46 PST, Chris Dumez
no flags
WIP Patch (59.60 KB, patch)
2020-02-12 10:58 PST, Chris Dumez
no flags
WIP Patch (66.28 KB, patch)
2020-02-12 13:02 PST, Chris Dumez
no flags
WIP Patch (69.04 KB, patch)
2020-02-12 14:30 PST, Chris Dumez
no flags
WIP Patch (72.19 KB, patch)
2020-02-12 15:02 PST, Chris Dumez
no flags
Patch (88.61 KB, patch)
2020-02-12 16:00 PST, Chris Dumez
no flags
Patch (89.51 KB, patch)
2020-02-13 14:33 PST, Chris Dumez
no flags
Patch (89.51 KB, patch)
2020-02-13 14:37 PST, Chris Dumez
no flags
Patch (89.54 KB, patch)
2020-02-13 15:00 PST, Chris Dumez
no flags
Patch (89.75 KB, patch)
2020-02-13 15:26 PST, Chris Dumez
no flags
Patch (93.24 KB, patch)
2020-02-17 09:57 PST, Chris Dumez
no flags
Patch (93.34 KB, patch)
2020-02-17 09:58 PST, Chris Dumez
no flags
Patch (90.88 KB, patch)
2020-02-17 14:53 PST, Chris Dumez
no flags
Patch (91.88 KB, patch)
2020-02-17 16:59 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2020-02-11 15:46:22 PST
Chris Dumez
Comment 2 2020-02-11 15:48:55 PST
Created attachment 390450 [details] WIP Patch
Chris Dumez
Comment 3 2020-02-11 16:37:04 PST
Created attachment 390462 [details] WIP Patch
Chris Dumez
Comment 4 2020-02-12 10:24:03 PST
Created attachment 390533 [details] WIP Patch
Chris Dumez
Comment 5 2020-02-12 10:46:34 PST
Created attachment 390536 [details] WIP Patch
Chris Dumez
Comment 6 2020-02-12 10:58:11 PST
Created attachment 390539 [details] WIP Patch
Chris Dumez
Comment 7 2020-02-12 13:02:08 PST
Created attachment 390549 [details] WIP Patch Now passing layout tests locally.
Chris Dumez
Comment 8 2020-02-12 14:30:50 PST
Created attachment 390561 [details] WIP Patch
Chris Dumez
Comment 9 2020-02-12 15:02:49 PST
Created attachment 390567 [details] WIP Patch With more layout tests.
Chris Dumez
Comment 10 2020-02-12 16:00:08 PST
Antti Koivisto
Comment 11 2020-02-13 12:44:36 PST
Comment on attachment 390575 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=390575&action=review > Source/WTF/wtf/PlatformEnable.h:802 > +#if !defined(ENABLE_COOKIE_CACHE) && PLATFORM(COCOA) && HAVE(CFNETWORK_COOKIE_CHANGE_LISTENER_API) > +#define ENABLE_COOKIE_CACHE 1 > +#endif Couldn't this just be a runtime no-op without CFNETWORK_COOKIE_CHANGE_LISTENER_API and avoid most #ifs? > Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:617 > + ASSERT(observers.add(&observer).isNewEntry); Why is observer only added in debug build? > Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.cpp:131 > + if (!m_hostsWithCookieListeners.isEmpty()) { > + auto hostsWithCookieListeners = copyToVector(m_hostsWithCookieListeners); > + unsubscribeFromCookieChangeNotifications(hostsWithCookieListeners); > + } I think it would be nicer to have a separate function or just loop over m_hostsWithCookieListeners here (avoiding the vector copy). It is just call to stopListeningForCookieChangeNotifications for each. > Source/WebKit/WebProcess/WebPage/WebCookieCache.h:44 > + bool isFunctional(); isEnabled/isSupported?
Chris Dumez
Comment 12 2020-02-13 12:47:58 PST
Comment on attachment 390575 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=390575&action=review >> Source/WebCore/platform/network/cocoa/NetworkStorageSessionCocoa.mm:617 >> + ASSERT(observers.add(&observer).isNewEntry); > > Why is observer only added in debug build? ouch, last minute clean up I made :/ Thanks for catching.
Antti Koivisto
Comment 13 2020-02-13 12:50:59 PST
> ouch, last minute clean up I made :/ Thanks for catching. Observers don't seem to have much test coverage.
Chris Dumez
Comment 14 2020-02-13 13:07:21 PST
(In reply to Antti Koivisto from comment #13) > > ouch, last minute clean up I made :/ Thanks for catching. > > Observers don't seem to have much test coverage. EWS does not have the CFNetwork SPI needed and thus does not cover my change. Actual layout test bots will run the tests with the cookie cache enabled (at least some of the bots will).
Chris Dumez
Comment 15 2020-02-13 14:33:35 PST
Chris Dumez
Comment 16 2020-02-13 14:37:32 PST
Chris Dumez
Comment 17 2020-02-13 15:00:29 PST
Chris Dumez
Comment 18 2020-02-13 15:26:52 PST
Chris Dumez
Comment 19 2020-02-17 09:57:04 PST
Chris Dumez
Comment 20 2020-02-17 09:58:13 PST
Chris Dumez
Comment 21 2020-02-17 14:53:38 PST
Chris Dumez
Comment 22 2020-02-17 16:59:00 PST
WebKit Commit Bot
Comment 23 2020-02-17 22:32:49 PST
Comment on attachment 391004 [details] Patch Clearing flags on attachment: 391004 Committed r256820: <https://trac.webkit.org/changeset/256820>
WebKit Commit Bot
Comment 24 2020-02-17 22:32:51 PST
All reviewed patches have been landed. Closing bug.
Truitt Savell
Comment 25 2020-02-24 16:23:01 PST
The new test http/tests/cookies/document-cookie-after-showModalDialog.html is a flaky failure. tracking in https://bugs.webkit.org/show_bug.cgi?id=208165
Note You need to log in before you can comment on or make changes to this bug.