Bug 147635 - WKWebsiteDataStore does not always clear cookies
Summary: WKWebsiteDataStore does not always clear cookies
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-08-04 11:08 PDT by Shreyas VA
Modified: 2015-08-10 17:55 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shreyas VA 2015-08-04 11:08:59 PDT
WKWebsiteDataStore does not clear cookies in the following scenarios:
1) WKWebView has been just created
2) There is no WKWebView attached to the WKWebViewConfiguration

(there maybe more scenarios, these are the known ones)


Sample code to run:

WKWebViewConfiguration* config = [[WKWebViewConfiguration alloc] init];
  self.webView =
      [[WKWebView alloc] initWithFrame:CGRectZero configuration:config];

  [self.view addSubview:self.webView];

  NSString* url = @"http://google.com";
  [self.webView loadRequest:
      [NSURLRequest requestWithURL:[NSURL URLWithString:url]]];

// Trigger clearing of cookies.
 [self.webView.configuration.websiteDataStore removeDataOfTypes:[NSSet setWithObject:WKWebsiteDataTypeCookies]
                                                     modifiedSince:[NSDate distantPast] completionHandler:^{
                                                       // Notice that this is not called.
                                                       NSLog(@"Cleared cookies");
                                                     }];

Expected Results:
The completion handler is called and cookies are cleared.

Actual Results:
The completion handler is not called and cookies are not cleared.
Comment 1 Shreyas VA 2015-08-04 11:09:16 PDT
rdar://22120241
Comment 2 Anders Carlsson 2015-08-05 10:18:32 PDT
I can't reproduce this, can you please attach a test app that shows the problem?
Comment 3 Shreyas VA 2015-08-05 10:37:24 PDT
Reproducibility on simulator
0/5

Reproducibility on device
5/5

Or in other words this bug only affects device builds.
Comment 4 Shreyas VA 2015-08-10 17:55:31 PDT
I can't repro this bug anymore.

Please note that this is different from bug 147333. This bug also states that the completionHandler is not called.