Changeset 236973 in webkit
- Timestamp:
- Oct 9, 2018, 12:04:44 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/UIProcess/API/APIPageConfiguration.cpp (modified) (1 diff)
-
Source/WebKit/UIProcess/API/APIPageConfiguration.h (modified) (1 diff)
-
Source/WebKit/UIProcess/WebProcessPool.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r236968 r236973 1 2018-10-09 Chris Dumez <cdumez@apple.com> 2 3 PSON: Doing a cross-site navigation via the URL bar does not swap process on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=190378 5 <rdar://problem/45059466> 6 7 Reviewed by Geoffrey Garen. 8 9 Process swapping was sometimes not happening via URL bar navigation on iOS due to top-hit preloading, 10 which would use a new WKWebView for the speculative load and rely on the _relatedWebView SPI to use 11 the same WebContent process as the view currently on screen. 12 13 To address the issue, if the source URL is empty and the page has a related page, use the related 14 page's URL as source URL when doing the process-swap decision. 15 16 * UIProcess/API/APIPageConfiguration.cpp: 17 (API::PageConfiguration::relatedPage const): 18 (API::PageConfiguration::relatedPage): Deleted. 19 * UIProcess/API/APIPageConfiguration.h: 20 * UIProcess/WebProcessPool.cpp: 21 (WebKit::WebProcessPool::processForNavigationInternal): 22 1 23 2018-10-09 Andy Estes <aestes@apple.com> 2 24 -
trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.cpp
r234946 r236973 130 130 } 131 131 132 WebPageProxy* PageConfiguration::relatedPage() 132 WebPageProxy* PageConfiguration::relatedPage() const 133 133 { 134 134 return m_relatedPage.get(); -
trunk/Source/WebKit/UIProcess/API/APIPageConfiguration.h
r234946 r236973 73 73 WebKit::WebPreferencesStore::ValueMap& preferenceValues() { return m_preferenceValues; } 74 74 75 WebKit::WebPageProxy* relatedPage() ;75 WebKit::WebPageProxy* relatedPage() const; 76 76 void setRelatedPage(WebKit::WebPageProxy*); 77 77 -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r236959 r236973 2139 2139 2140 2140 bool isInitialLoadInNewWindowOpenedByDOM = page.openedByDOM() && !page.hasCommittedAnyProvisionalLoads(); 2141 URL url;2141 URL sourceURL; 2142 2142 if (isInitialLoadInNewWindowOpenedByDOM && !navigation.requesterOrigin().isEmpty()) 2143 url= URL { URL(), navigation.requesterOrigin().toString() };2143 sourceURL = URL { URL(), navigation.requesterOrigin().toString() }; 2144 2144 else 2145 url = URL { { }, page.pageLoadState().url() }; 2146 if (!url.isValid() || !targetURL.isValid() || url.isEmpty() || url.isBlankURL() || registrableDomainsAreEqual(url, targetURL)) { 2145 sourceURL = URL { { }, page.pageLoadState().url() }; 2146 2147 if (sourceURL.isEmpty() && page.configuration().relatedPage()) { 2148 sourceURL = URL { { }, page.configuration().relatedPage()->pageLoadState().url() }; 2149 RELEASE_LOG(ProcessSwapping, "Using related page %p's URL as source URL for process swap decision", page.configuration().relatedPage()); 2150 } 2151 2152 if (!sourceURL.isValid() || !targetURL.isValid() || sourceURL.isEmpty() || sourceURL.isBlankURL() || registrableDomainsAreEqual(sourceURL, targetURL)) { 2147 2153 reason = "Navigation is same-site"_s; 2148 2154 return page.process(); -
trunk/Tools/ChangeLog
r236964 r236973 1 2018-10-09 Chris Dumez <cdumez@apple.com> 2 3 PSON: Doing a cross-site navigation via the URL bar does not swap process on iOS 4 https://bugs.webkit.org/show_bug.cgi?id=190378 5 <rdar://problem/45059466> 6 7 Reviewed by Geoffrey Garen. 8 9 Add API test coverage. 10 11 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 12 1 13 2018-10-09 Jer Noble <jer.noble@apple.com> 2 14 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r236226 r236973 1804 1804 } 1805 1805 1806 enum class ExpectSwap { No, Yes }; 1807 static void runProcessSwapDueToRelatedWebViewTest(NSURL* relatedViewURL, NSURL* targetURL, ExpectSwap expectSwap) 1808 { 1809 auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); 1810 processPoolConfiguration.get().processSwapsOnNavigation = YES; 1811 processPoolConfiguration.get().prewarmsProcessesAutomatically = YES; 1812 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); 1813 1814 auto webView1Configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 1815 [webView1Configuration setProcessPool:processPool.get()]; 1816 auto handler = adoptNS([[PSONScheme alloc] init]); 1817 [webView1Configuration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 1818 1819 auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView1Configuration.get()]); 1820 auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]); 1821 [webView1 setNavigationDelegate:delegate.get()]; 1822 1823 numberOfDecidePolicyCalls = 0; 1824 NSURLRequest *request = [NSURLRequest requestWithURL:relatedViewURL]; 1825 [webView1 loadRequest:request]; 1826 1827 TestWebKitAPI::Util::run(&done); 1828 done = false; 1829 1830 auto pid1 = [webView1 _webProcessIdentifier]; 1831 1832 auto webView2Configuration = adoptNS([[WKWebViewConfiguration alloc] init]); 1833 [webView2Configuration setProcessPool:processPool.get()]; 1834 [webView2Configuration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 1835 webView2Configuration.get()._relatedWebView = webView1.get(); // webView2 will be related to webView1 and webView1's URL will be used for process swap decision. 1836 auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webView2Configuration.get()]); 1837 [webView2 setNavigationDelegate:delegate.get()]; 1838 1839 request = [NSURLRequest requestWithURL:targetURL]; 1840 [webView2 loadRequest:request]; 1841 1842 TestWebKitAPI::Util::run(&done); 1843 done = false; 1844 1845 auto pid2 = [webView2 _webProcessIdentifier]; 1846 1847 if (expectSwap == ExpectSwap::No) 1848 EXPECT_TRUE(pid1 == pid2); 1849 else 1850 EXPECT_FALSE(pid1 == pid2); 1851 1852 EXPECT_EQ(2, numberOfDecidePolicyCalls); 1853 } 1854 1855 TEST(ProcessSwap, ProcessSwapDueToRelatedView) 1856 { 1857 runProcessSwapDueToRelatedWebViewTest([NSURL URLWithString:@"pson://www.webkit.org/main1.html"], [NSURL URLWithString:@"pson://www.apple.com/main2.html"], ExpectSwap::Yes); 1858 } 1859 1860 TEST(ProcessSwap, NoProcessSwapDueToRelatedView) 1861 { 1862 runProcessSwapDueToRelatedWebViewTest([NSURL URLWithString:@"pson://www.webkit.org/main1.html"], [NSURL URLWithString:@"pson://www.webkit.org/main2.html"], ExpectSwap::No); 1863 } 1864 1806 1865 TEST(ProcessSwap, TerminatedSuspendedPageProcess) 1807 1866 {
Note:
See TracChangeset
for help on using the changeset viewer.