Bug 149078 - WKWebsiteDataStore does not clear cookies when there is no WKWebView present
Summary: WKWebsiteDataStore does not clear cookies when there is no WKWebView present
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: Other
Hardware: iPhone / iPad iOS 9.0
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-09-11 16:05 PDT by Shreyas VA
Modified: 2015-09-11 21:34 PDT (History)
2 users (show)

See Also:


Attachments
Sample app that repros this bug (44.47 KB, application/zip)
2015-09-11 16:05 PDT, Shreyas VA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shreyas VA 2015-09-11 16:05:12 PDT
Created attachment 261022 [details]
Sample app that repros this bug

The -[WKWebsiteDataStore removeDataOfTypes:] API only clear cookies when there is a WKWebView alive.

This is problematic because WKWebViews can be deallocated at any time during the app's lifecycle and this API should not be dependent on that.

Steps to Reproduce:
1) Run the attached code
2) Click on wv1 that create a WKWebView and loads a page
3) Click on sc1 that sets a persistent cookie with name, value someCookie1=someValue1
4) Click on rc that prints all the cookies, to make sure that this cookie has been set
5) Deallocate this WKWebView by clicking on "deallocate web view"
6) Clear cookies by clicking on "clear cookies"
7) Click on wv1 that recreates the WKWebView and loads a page
6) Wait for the page to load
7) Click on rc to print out all the cookies from the site

Expected Results:
The cookie set earlier (someCookie1) has been removed.

Actual Results:
The cookie set earlier (someCookie1) has not been removed.

Version:
iOS9.0

Configuration:
Any iOS devices.
Comment 1 Shreyas VA 2015-09-11 16:06:47 PDT
rdar://22669952