Conversation
dalexsoto
left a comment
There was a problem hiding this comment.
These look right to me but not my area of expertise @mandel-macaque could you also have a look? Thanks!
mandel-macaque
left a comment
There was a problem hiding this comment.
Looks good in the surface, I fear that server side set cookies are going to be a problem,
| if (prefersEphemeralWebBrowserSession) | ||
| { | ||
| NSUrlCache.SharedCache.RemoveAllCachedResponses(); | ||
| WKWebsiteDataStore.DefaultDataStore.HttpCookieStore.GetAllCookies((cookies) => | ||
| { | ||
| foreach (var cookie in cookies) | ||
| { | ||
| WKWebsiteDataStore.DefaultDataStore.HttpCookieStore.DeleteCookie(cookie, null); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
I do not believe that the fix is that easy. AFAIK the WKWebsiteDataStore.DefaultDataStore.HttpCookieStore returns a WKHttpCookieStore that will have a shred cookies for the process pool, this object does not allow to remove the cookies that have been set server side, at least the last time I checked, this means that all those cookies will be present as long as you are still using the same WKProcess.
Have you tested this via a cookie set from the server side? I think that you will need to remove the cookies AND create a new WKProcess.
Another way to do this is to use the ephemeral setting in the NSUrlSessionHanlder, which will not save the cookies and won't make you do this dance. Do you have a pointer in the code where you are making the call. The Ephemeral setting by the OS might be a cleaner way.
PS: Sorry, I don't know the code base enough, but I do know that if you do not change the WKProcess the cookies are there.
| @@ -1,3 +1,7 @@ | |||
| using Foundation; | |||
|
|
|||
| [assembly: System.Reflection.AssemblyMetadata("IsTrimmable", "True")] | |||
There was a problem hiding this comment.
Let's introduce this in a different PR in the future.
| [assembly: System.Reflection.AssemblyMetadata("IsTrimmable", "True")] |
Fixes #1712