Skip to content

Commit 3896244

Browse files
committed
Remove self-hosted site cookies when removing site
1 parent d0c3843 commit 3896244

File tree

1 file changed

+11
-0
lines changed
  • WordPress/Classes/Models

1 file changed

+11
-0
lines changed

WordPress/Classes/Models/Blog.m

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ - (void)prepareForDeletion
112112

113113
[_xmlrpcApi invalidateAndCancelTasks];
114114
[_selfHostedSiteRestApi invalidateAndCancelTasks];
115+
116+
// Remove the self-hosted site cookies from the shared cookie storage.
117+
if (self.account == nil && self.url != nil) {
118+
NSURL *siteURL = [NSURL URLWithString:self.url];
119+
if (siteURL != nil) {
120+
NSHTTPCookieStorage *cookieJar = [NSHTTPCookieStorage sharedHTTPCookieStorage];
121+
for (NSHTTPCookie *cookie in [cookieJar cookiesForURL:siteURL]) {
122+
[cookieJar deleteCookie:cookie];
123+
}
124+
}
125+
}
115126
}
116127

117128
- (void)didTurnIntoFault

0 commit comments

Comments
 (0)