Changeset 266798 in webkit
- Timestamp:
- Sep 9, 2020, 12:56:58 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp (modified) (2 diffs)
-
Source/WebKit/UIProcess/Network/NetworkProcessProxy.h (modified) (2 diffs)
-
Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r266797 r266798 1 2020-09-09 Brady Eidson <beidson@apple.com> 2 3 Make sure WKWebsiteDataStore operations reuse existing process pools even when all WKWebViews have closed. 4 <rdar://problem/62978295> and https://bugs.webkit.org/show_bug.cgi?id=216317 5 6 Reviewed by Geoffrey Garen. 7 8 Covered by new API test. 9 10 When WebsiteDataStores are gathering all the NetworkProcesses they might need to message, they miss some 11 obvious candidates if there are no longer any related WKWebViews. 12 13 Fix that by tracking which sessions a NetworkProcess knows about. 14 15 * UIProcess/Network/NetworkProcessProxy.cpp: 16 (WebKit::NetworkProcessProxy::addSession): 17 (WebKit::NetworkProcessProxy::hasSession const): 18 (WebKit::NetworkProcessProxy::removeSession): 19 * UIProcess/Network/NetworkProcessProxy.h: 20 21 * UIProcess/WebsiteData/WebsiteDataStore.cpp: 22 (WebKit::WebsiteDataStore::isAssociatedProcessPool const): 23 1 24 2020-09-09 Chris Dumez <cdumez@apple.com> 2 25 -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
r265389 r266798 1274 1274 void NetworkProcessProxy::addSession(Ref<WebsiteDataStore>&& store) 1275 1275 { 1276 m_sessionIDs.add(store->sessionID()); 1277 1276 1278 if (canSendMessage()) 1277 1279 send(Messages::NetworkProcess::AddWebsiteDataStore { store->parameters() }, 0); … … 1284 1286 } 1285 1287 1288 bool NetworkProcessProxy::hasSession(PAL::SessionID sessionID) const 1289 { 1290 return m_sessionIDs.contains(sessionID); 1291 } 1292 1286 1293 void NetworkProcessProxy::removeSession(PAL::SessionID sessionID) 1287 1294 { 1295 m_sessionIDs.remove(sessionID); 1296 1288 1297 if (canSendMessage()) 1289 1298 send(Messages::NetworkProcess::DestroySession { sessionID }, 0); -
trunk/Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
r265389 r266798 213 213 214 214 void addSession(Ref<WebsiteDataStore>&&); 215 bool hasSession(PAL::SessionID) const; 215 216 void removeSession(PAL::SessionID); 216 217 … … 348 349 }; 349 350 #endif 351 352 HashSet<PAL::SessionID> m_sessionIDs; 350 353 }; 351 354 -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp
r266268 r266798 2000 2000 if (auto* processPoolDataStore = processPool.websiteDataStore()) 2001 2001 return processPoolDataStore == this; 2002 if (auto* networkProcessProxy = processPool.networkProcess()) 2003 return networkProcessProxy->hasSession(m_sessionID); 2002 2004 return false; 2003 2005 } -
trunk/Tools/ChangeLog
r266796 r266798 1 2020-09-09 Brady Eidson <beidson@apple.com> 2 3 Make sure WKWebsiteDataStore operations reuse existing process pools even when all WKWebViews have closed. 4 <rdar://problem/62978295> and https://bugs.webkit.org/show_bug.cgi?id=216317 5 6 Reviewed by Geoffrey Garen. 7 8 * TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm: 9 (TestWebKitAPI::TEST): 10 1 11 2020-09-09 Angelos Oikonomopoulos <angelos@igalia.com> 2 12 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKWebsiteDatastore.mm
r262656 r266798 26 26 #import "config.h" 27 27 28 #import "HTTPServer.h" 28 29 #import "PlatformUtilities.h" 29 30 #import "TCPServer.h" … … 31 32 #import "TestWKWebView.h" 32 33 #import <WebKit/WKProcessPoolPrivate.h> 34 #import <WebKit/WKWebViewPrivate.h> 33 35 #import <WebKit/WKWebsiteDataRecordPrivate.h> 34 36 #import <WebKit/WKWebsiteDataStorePrivate.h> … … 310 312 } 311 313 312 } 314 TEST(WebKit, ClearCustomDataStoreNoWebViews) 315 { 316 HTTPServer server([connectionCount = 0] (Connection connection) mutable { 317 ++connectionCount; 318 connection.receiveHTTPRequest([connection, connectionCount] (Vector<char>&& request) { 319 switch (connectionCount) { 320 case 1: 321 connection.send( 322 "HTTP/1.1 200 OK\r\n" 323 "Content-Length: 5\r\n" 324 "Set-Cookie: a=b\r\n" 325 "Connection: close\r\n" 326 "\r\n" 327 "Hello"); 328 break; 329 case 2: 330 EXPECT_FALSE(strstr(request.data(), "Cookie: a=b\r\n")); 331 connection.send( 332 "HTTP/1.1 200 OK\r\n" 333 "Content-Length: 5\r\n" 334 "Connection: close\r\n" 335 "\r\n" 336 "Hello"); 337 break; 338 default: 339 ASSERT_NOT_REACHED(); 340 } 341 }); 342 }); 343 344 345 NSURL *fileURL = [NSURL fileURLWithPath:@"/tmp/testcookiefile.cookie"]; 346 auto configuration = adoptNS([[_WKWebsiteDataStoreConfiguration alloc] init]); 347 [configuration _setCookieStorageFile:fileURL]; 348 349 auto dataStore = adoptNS([[WKWebsiteDataStore alloc] _initWithConfiguration:configuration.get()]); 350 auto viewConfiguration = adoptNS([WKWebViewConfiguration new]); 351 [viewConfiguration setWebsiteDataStore:dataStore.get()]; 352 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:viewConfiguration.get() addToWindow:YES]); 353 354 auto *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://127.0.0.1:%d/index.html", server.port()]]; 355 356 [webView synchronouslyLoadRequest:[NSURLRequest requestWithURL:url]]; 357 [webView _close]; 358 webView = nil; 359 360 // Now that the WebView is closed, remove all website data. 361 // Then recreate a WebView with the same configuration to confirm the website data was removed. 362 static bool done; 363 [dataStore removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^{ 364 done = true; 365 }]; 366 Util::run(&done); 367 done = false; 368 369 webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 100, 100) configuration:viewConfiguration.get() addToWindow:YES]); 370 [webView synchronouslyLoadRequest:[NSURLRequest requestWithURL:url]]; 371 } 372 373 } // namespace TestWebKitAPI
Note:
See TracChangeset
for help on using the changeset viewer.