Changeset 244502 in webkit
- Timestamp:
- Apr 22, 2019 11:03:47 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r244500 r244502 1 2019-04-22 Chris Dumez <cdumez@apple.com> 2 3 Delayed WebProcessLaunch may break the _relatedWebView SPI 4 https://bugs.webkit.org/show_bug.cgi?id=197160 5 6 Reviewed by Alex Christensen. 7 8 Delayed WebProcessLaunch may break the _relatedWebView SPI. The breakage would happen if the client 9 would relate a WebView to another which has not launched its initial process yet. 10 11 To address the issue, when we need a running process for a WebView which has a related view, we need 12 to make sure the related view has a running process and use that process. Previously, we would share 13 the "dummy" process instead. 14 15 * UIProcess/WebPageProxy.cpp: 16 (WebKit::WebPageProxy::launchProcess): 17 (WebKit::WebPageProxy::ensureRunningProcess): 18 * UIProcess/WebPageProxy.h: 19 * UIProcess/WebProcessPool.cpp: 20 (WebKit::WebProcessPool::createWebPage): 21 1 22 2019-04-22 Ludovico de Nittis <ludovico.denittis@collabora.com> 2 23 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r244493 r244502 728 728 729 729 auto& processPool = m_process->processPool(); 730 m_process = processPool.processForRegistrableDomain(m_websiteDataStore.get(), this, registrableDomain); 730 731 if (auto* relatedPage = m_configuration->relatedPage()) 732 m_process = relatedPage->ensureRunningProcess(); 733 else 734 m_process = processPool.processForRegistrableDomain(m_websiteDataStore.get(), this, registrableDomain); 731 735 m_hasRunningProcess = true; 732 736 … … 1072 1076 } 1073 1077 #endif 1078 1079 WebProcessProxy& WebPageProxy::ensureRunningProcess() 1080 { 1081 if (!hasRunningProcess()) 1082 launchProcess({ }); 1083 1084 return m_process; 1085 } 1074 1086 1075 1087 RefPtr<API::Navigation> WebPageProxy::loadRequest(ResourceRequest&& request, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, API::Object* userData) -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r244446 r244502 1084 1084 #endif 1085 1085 1086 WebProcessProxy& ensureRunningProcess(); 1086 1087 WebProcessProxy& process() { return m_process; } 1087 1088 ProcessID processIdentifier() const; -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r244288 r244502 1211 1211 1212 1212 RefPtr<WebProcessProxy> process; 1213 if (pageConfiguration->relatedPage()) { 1214 // Sharing processes, e.g. when creating the page via window.open(). 1215 process = &pageConfiguration->relatedPage()->process(); 1216 // We do not support several WebsiteDataStores sharing a single process. 1217 ASSERT(process.get() == m_dummyProcessProxy || &pageConfiguration->websiteDataStore()->websiteDataStore() == &process->websiteDataStore()); 1218 ASSERT(&pageConfiguration->relatedPage()->websiteDataStore() == &pageConfiguration->websiteDataStore()->websiteDataStore()); 1219 } else if (!m_isDelayedWebProcessLaunchDisabled) { 1213 1214 if (m_isDelayedWebProcessLaunchDisabled) { 1215 if (pageConfiguration->relatedPage()) { 1216 // Sharing processes, e.g. when creating the page via window.open(). 1217 // Make sure the related page's process is not the dummy one. 1218 process = &pageConfiguration->relatedPage()->ensureRunningProcess(); 1219 // We do not support several WebsiteDataStores sharing a single process. 1220 ASSERT(process.get() == m_dummyProcessProxy || &pageConfiguration->websiteDataStore()->websiteDataStore() == &process->websiteDataStore()); 1221 ASSERT(&pageConfiguration->relatedPage()->websiteDataStore() == &pageConfiguration->websiteDataStore()->websiteDataStore()); 1222 } else 1223 process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { }); 1224 } else { 1220 1225 // In the common case, we delay process launch until something is actually loaded in the page. 1221 1226 if (!m_dummyProcessProxy) { … … 1225 1230 } 1226 1231 process = m_dummyProcessProxy; 1227 } else 1228 process = &processForRegistrableDomain(pageConfiguration->websiteDataStore()->websiteDataStore(), nullptr, { }); 1232 } 1229 1233 1230 1234 ASSERT(process); -
trunk/Tools/ChangeLog
r244498 r244502 1 2019-04-22 Chris Dumez <cdumez@apple.com> 2 3 Delayed WebProcessLaunch may break the _relatedWebView SPI 4 https://bugs.webkit.org/show_bug.cgi?id=197160 5 6 Reviewed by Alex Christensen. 7 8 Add API test coverage. 9 10 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 11 1 12 2019-04-22 Carlos Garcia Campos <cgarcia@igalia.com> 2 13 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r244075 r244502 4599 4599 } 4600 4600 4601 TEST(ProcessSwap, RelatedWebViewBeforeWebProcessLaunch) 4602 { 4603 auto processPoolConfiguration = psonProcessPoolConfiguration(); 4604 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); 4605 4606 auto webView1Configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 4607 [webView1Configuration setProcessPool:processPool.get()]; 4608 auto handler = adoptNS([[PSONScheme alloc] init]); 4609 [webView1Configuration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 4610 4611 auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView1Configuration.get()]); 4612 auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]); 4613 [webView1 setNavigationDelegate:delegate.get()]; 4614 4615 auto webView2Configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 4616 [webView2Configuration setProcessPool:processPool.get()]; 4617 [webView2Configuration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 4618 webView2Configuration.get()._relatedWebView = webView1.get(); // webView2 will be related to webView1 and webView1's URL will be used for process swap decision. 4619 auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView2Configuration.get()]); 4620 [webView2 setNavigationDelegate:delegate.get()]; 4621 4622 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]]; 4623 [webView1 loadRequest:request]; 4624 4625 TestWebKitAPI::Util::run(&done); 4626 done = false; 4627 4628 auto pid1 = [webView1 _webProcessIdentifier]; 4629 4630 request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]]; 4631 [webView2 loadRequest:request]; 4632 4633 TestWebKitAPI::Util::run(&done); 4634 done = false; 4635 4636 auto pid2 = [webView2 _webProcessIdentifier]; 4637 4638 EXPECT_EQ(pid1, pid2); // WebViews are related so they should share the same process. 4639 } 4640 4601 4641 TEST(ProcessSwap, TerminatedSuspendedPageProcess) 4602 4642 {
Note: See TracChangeset
for help on using the changeset viewer.