WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
240671
Introduce WKHTTPCookieStore.deleteAllCookies
https://bugs.webkit.org/show_bug.cgi?id=240671
Summary
Introduce WKHTTPCookieStore.deleteAllCookies
Yury Semikhatsky
Reported
2022-05-19 11:08:53 PDT
There is currently no easy and efficient way to delete all cookie without iterating them one by one.
Attachments
Add attachment
proposed patch, testcase, etc.
Yury Semikhatsky
Comment 1
2022-05-19 12:28:48 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/798
Radar WebKit Bug Importer
Comment 2
2022-05-20 08:24:38 PDT
<
rdar://problem/93655655
>
Alex Christensen
Comment 3
2022-05-20 09:08:30 PDT
What about this? [WKWebsiteDataStore.defaultDataStore removeDataOfTypes:[NSSet setWithObject:WKWebsiteDataTypeCookies] modifiedSince:[NSDate distantPast] completionHandler:^{ }];
Yury Semikhatsky
Comment 4
2022-05-20 09:30:03 PDT
(In reply to Alex Christensen from
comment #3
)
> What about this? > > [WKWebsiteDataStore.defaultDataStore removeDataOfTypes:[NSSet > setWithObject:WKWebsiteDataTypeCookies] modifiedSince:[NSDate distantPast] > completionHandler:^{ }];
I may well be missing something but the only place where I see Cookie data type handled is
https://github.com/WebKit/WebKit/blob/452ee7982845475da6114437f62e77ef79e8cf64/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp#L661
and it seems to me that the code doesn't go to the network process and does something different. I can move the logic over there. It'd be quite non-intuitive place to look for deleteAllCookie functionality given that there is already dedicated class for cookie handling but would work for us.
Darin Adler
Comment 5
2022-05-20 09:33:49 PDT
Alex isn’t asking you to move logic. He’s asking you to ensure there isn’t already API that works before adding anything new.
Alex Christensen
Comment 6
2022-05-20 09:35:04 PDT
Replacing "[cookieStore deleteAllCookies:^{" in your API test WKHTTPCookieStore.DeleteAllCookies with this: [webView.get().configuration.websiteDataStore removeDataOfTypes:[NSSet setWithObject:WKWebsiteDataTypeCookies] modifiedSince:[NSDate distantPast] completionHandler:^{ Makes the test still work, which indicates to me that this functionality already does exist.
Darin Adler
Comment 7
2022-05-20 09:47:39 PDT
So if "us" is, say, the Chrome app on iOS, then please don’t add more API; use what’s already there!
Yury Semikhatsky
Comment 8
2022-05-20 12:18:53 PDT
> So if "us" is, say, the Chrome app on iOS,
I guess the chromium email that I use for WebKit contributions makes people think that I work on Chrome, but I'm currently not affiliated with Google/Chrome. To clarify, by "us" I mean Playwright[1] team. Some more context on what prompted this work: I'm upstreaming parts of our fork that other clients of WebKit would benefit from (like better insepctor instrumentation) and also trying to switch more of our code to the public WebKit APIs. The latter sometimes requires improving existing APIs and sometimes adding new ones (e.g. time zone override). The ultimate goal is to minimize our fork and ideally get rid of the downstream changes to WebKit by moving more of the functionality to our embedder layer. Currently, many automation features that we have are implemented inside WebKit by adding new instrumentation and new inspector agents in UIProcess. One option to improve this would be to just upstream that logic and expose it via the Web Inspector protocol. This was proposed in
https://bugs.webkit.org/show_bug.cgi?id=203870
and was not welcomed. The new approach we have in mind is to move all of the instrumenting agents from the UI process layer to the embedder and implement it there using piblic WebKit APIs. I don't think this bug is the best place for an in-depth discussion of that, but if you are interested in more details I could do a write-up of what we currenly have and the ways that we see it could be cotributed to WebKit. That way we could discuss the details of the approach in general. [1]
https://playwright.dev/
> then please don’t add more API; use what’s already there!
My bad, I was not aware of the alternative API. Thanks for pointing that out, we'll use it instead (we'll need to f. In my defense, I started with WebCookieManagerProxy::deleteAllCookies (that we currently call in the fork) which was already exposed in public C API (WKHTTPCookieStoreDeleteAllCookies) but not in Cocoa and also lacked proper handling of the completion handler (that we had to fix in our fork). Moreover, existing code in WKHTTPCookieStore test simply deletes cookies one by one when it needs to clear the store. So it seemed natural to fix the completion hadler problem and add WKHTTPCookieStore.deleteAllCookies. I believe fixing WebCookieManagerProxy::deleteAllCookies completion handler logic would be still useful for those who call WKHTTPCookieStoreDeleteAllCookies. Will do that in a separate PR as we'll need that in our Windows port (there is no counterpart of removeDataOfTypes on WKWebsiteDataStoreRef).
Alex Christensen
Comment 9
2022-05-20 14:36:15 PDT
Fixing WebCookieManagerProxy::deleteAllCookies is definitely something we should do. If you put that in its own PR I'm pretty sure I'd approve that. This is definitely the kind of contribution I want to encourage. As for
https://bugs.webkit.org/show_bug.cgi?id=203870
I wouldn't say it wasn't welcomed since I don't see any negative commentary. I just think it didn't get the attention of the proper reviewers, which is a slightly different problem.
Yury Semikhatsky
Comment 10
2022-05-20 15:09:25 PDT
(In reply to Alex Christensen from
comment #9
)
> Fixing WebCookieManagerProxy::deleteAllCookies is definitely something we > should do. If you put that in its own PR I'm pretty sure I'd approve that. > This is definitely the kind of contribution I want to encourage.
> OK, will send it shortly.
> As for
https://bugs.webkit.org/show_bug.cgi?id=203870
I wouldn't say it > wasn't welcomed since I don't see any negative commentary. I just think it > didn't get the attention of the proper reviewers, which is a slightly > different problem.
The discussion happened primarily on #web-inspector-dev channel in slack with Devin Rousso so it's unfortunately not reflected in the bug (and I can't seem to dig that far into slack history). I also talked in person with him and Joseph Pecoraro about the direction in general during the WebKit summit in 2019. In any case, at this point it's easier to just start the design discussion over as we now have a WebKit-based browser that provides all the automation features that we need and we have better understanding of the alternative ways our fork could be up-streamed.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug