Bug 147635

Summary: WKWebsiteDataStore does not always clear cookies
Product: WebKit Reporter: Shreyas VA <shreyasv>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=147333

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.