NEW 282079
WKWebsiteDataStore and WKHTTPCookieStore asynchronous functions do not include error information
https://bugs.webkit.org/show_bug.cgi?id=282079
Summary WKWebsiteDataStore and WKHTTPCookieStore asynchronous functions do not includ...
Sam S
Reported 2024-10-24 20:31:35 PDT
Background: WKWebsiteDataStore[1] has a `removeData(ofTypes:for:completionHandler:)` function which is used for removing data from the data store. This function uses an asynchronous callback to tell the caller when it has completed, which has no arguments. We have an app which uses this API to clear the user's web browsing data. We have found that in rare situations (not consistently reproducible) the removeData call fails to remove some types of data, leaving the user signed into some of their websites. In this case it appears that removeData is failing to remove data, but the API doesn't report an error - it would be ideal if it were to provide the caller with some error information, so that some recovery logic can be implemented. The same problem applies to the `delete(_:completionHandler:)` and `setCookie(_:completionHandler:)` functions of WKHTTPCookieStore[2]. Objective: Add error information to the completion handlers of WKWebsiteDataStore and WKHTTPCookieStore. The relevant APIs are: WKWebsiteDataStore's `removeData(ofTypes:for:completionHandler:)` function WKHTTPCookieStore's `delete(_:completionHandler:)` function WKHTTPCookieStore's `setCookie(_:completionHandler:)` function [1]: https://developer.apple.com/documentation/webkit/wkwebsitedatastore/1532936-removedata [2]: https://developer.apple.com/documentation/webkit/wkhttpcookiestore/2882009-delete
Attachments
Alexey Proskuryakov
Comment 1 2024-10-28 09:52:25 PDT
Thank you for the report. It does seem like this function indeed cannot guarantee being successful in very rare cases (e.g. when it needs to launch a WebContent process, and launching fails). Do you have any additional insight into the situations where it fails though? It would seem unlikely for such cases to even be "rare", I'd expect "exceptionally rare". Perhaps we have a more straightforward bug to fix.
Radar WebKit Bug Importer
Comment 2 2024-10-31 20:32:13 PDT
Note You need to log in before you can comment on or make changes to this bug.