This repository was archived by the owner on Jun 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Expand file tree Collapse file tree 2 files changed +20
-9
lines changed Original file line number Diff line number Diff line change
1
+ 2020-03-16 Chris Dumez <
[email protected] >
2
+
3
+ Crash under WebCookieCache::clearForHost()
4
+ https://bugs.webkit.org/show_bug.cgi?id=209149
5
+ <rdar://problem/60453086>
6
+
7
+ Reviewed by Darin Adler.
8
+
9
+ Alternative fix for Bug 209149 based on comments from Darin.
10
+
11
+ * WebProcess/WebPage/WebCookieCache.cpp:
12
+ (WebKit::WebCookieCache::clearForHost):
13
+ (WebKit::WebCookieCache::pruneCacheIfNecessary):
14
+
1
15
2020-03-16 Tim Horton <
[email protected] >
2
16
3
17
Fix the macCatalyst build after r258525
Original file line number Diff line number Diff line change @@ -102,14 +102,13 @@ void WebCookieCache::clear()
102
102
103
103
void WebCookieCache::clearForHost (const String& host)
104
104
{
105
- auto it = m_hostsWithInMemoryStorage.find (host);
106
- if (it == m_hostsWithInMemoryStorage. end ())
105
+ String removedHost = m_hostsWithInMemoryStorage.take (host);
106
+ if (removedHost. isNull ())
107
107
return ;
108
108
109
- m_hostsWithInMemoryStorage.remove (it);
110
- inMemoryStorageSession ().deleteCookiesForHostnames (Vector<String> { host });
109
+ inMemoryStorageSession ().deleteCookiesForHostnames (Vector<String> { removedHost });
111
110
#if HAVE(COOKIE_CHANGE_LISTENER_API)
112
- WebProcess::singleton ().ensureNetworkProcessConnection ().connection ().send (Messages::NetworkConnectionToWebProcess::UnsubscribeFromCookieChangeNotifications (HashSet<String> { host }), 0 );
111
+ WebProcess::singleton ().ensureNetworkProcessConnection ().connection ().send (Messages::NetworkConnectionToWebProcess::UnsubscribeFromCookieChangeNotifications (HashSet<String> { removedHost }), 0 );
113
112
#endif
114
113
}
115
114
@@ -118,10 +117,8 @@ void WebCookieCache::pruneCacheIfNecessary()
118
117
// We may want to raise this limit if we start using the cache for third-party iframes.
119
118
static const unsigned maxCachedHosts = 5 ;
120
119
121
- while (m_hostsWithInMemoryStorage.size () >= maxCachedHosts) {
122
- String hostToRemove = *m_hostsWithInMemoryStorage.random ();
123
- clearForHost (hostToRemove);
124
- }
120
+ while (m_hostsWithInMemoryStorage.size () >= maxCachedHosts)
121
+ clearForHost (*m_hostsWithInMemoryStorage.random ());
125
122
}
126
123
127
124
#if !PLATFORM(COCOA)
You can’t perform that action at this time.
0 commit comments