Changeset 258521 in webkit
- Timestamp:
- Mar 16, 2020 3:04:02 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r258518 r258521 1 2020-03-16 Chris Dumez <cdumez@apple.com> 2 3 Crash under WebCookieCache::clearForHost() 4 https://bugs.webkit.org/show_bug.cgi?id=209149 5 <rdar://problem/60453086> 6 7 Reviewed by Alex Christensen. 8 9 Make sure WebCookieCache::pruneCacheIfNecessary() keeps alive the host String it is passing 10 to WebCookieCache::clearForHost(). Previously, it was merely deferencing a HashSet iterator 11 and passing that to clearForHost(). However, clearForHost() would then drop the String from 12 the HashSet and the host would no longer be valid. 13 14 Change covered by new API test. 15 16 * WebProcess/WebPage/WebCookieCache.cpp: 17 (WebKit::WebCookieCache::pruneCacheIfNecessary): 18 1 19 2020-03-16 Per Arne Vollan <pvollan@apple.com> 2 20 -
trunk/Source/WebKit/WebProcess/WebPage/WebCookieCache.cpp
r257888 r258521 119 119 static const unsigned maxCachedHosts = 5; 120 120 121 while (m_hostsWithInMemoryStorage.size() >= maxCachedHosts) 122 clearForHost(*m_hostsWithInMemoryStorage.random()); 121 while (m_hostsWithInMemoryStorage.size() >= maxCachedHosts) { 122 String hostToRemove = *m_hostsWithInMemoryStorage.random(); 123 clearForHost(hostToRemove); 124 } 123 125 } 124 126 -
trunk/Tools/ChangeLog
r258520 r258521 1 2020-03-16 Chris Dumez <cdumez@apple.com> 2 3 Crash under WebCookieCache::clearForHost() 4 https://bugs.webkit.org/show_bug.cgi?id=209149 5 <rdar://problem/60453086> 6 7 Reviewed by Alex Christensen. 8 9 Add API test coverage. 10 11 * TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm: 12 (TEST): 13 1 14 2020-03-16 Keith Rollin <krollin@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/CookiePrivateBrowsing.mm
r256820 r258521 34 34 #import <WebKit/WKWebViewConfiguration.h> 35 35 #import <wtf/RetainPtr.h> 36 #import <wtf/text/StringConcatenateNumbers.h> 36 37 #import <wtf/text/WTFString.h> 37 38 … … 129 130 EXPECT_WK_STREQ("foo=bar", cookieString); 130 131 } 132 133 TEST(WebKit, CookieCachePruning) 134 { 135 auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 136 auto view = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); 137 138 for (unsigned i = 0; i < 100; ++i) { 139 [view synchronouslyLoadHTMLString:@"foo" baseURL:[NSURL URLWithString:makeString("http://foo", i, ".example.com/")]]; 140 141 __block bool doneEvaluatingJavaScript = false; 142 [view evaluateJavaScript:@"document.cookie;" completionHandler:^(id _Nullable cookie, NSError * _Nullable error) { 143 EXPECT_NULL(error); 144 EXPECT_TRUE([cookie isKindOfClass:[NSString class]]); 145 EXPECT_WK_STREQ("", (NSString *)cookie); 146 doneEvaluatingJavaScript = true; 147 }]; 148 TestWebKitAPI::Util::run(&doneEvaluatingJavaScript); 149 } 150 }
Note: See TracChangeset
for help on using the changeset viewer.