Changeset 240477 in webkit
- Timestamp:
- Jan 25, 2019 9:32:53 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r240476 r240477 1 2019-01-25 Chris Dumez <cdumez@apple.com> 2 3 Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction() 4 https://bugs.webkit.org/show_bug.cgi?id=193779 5 <rdar://problem/46170903> 6 7 Reviewed by Antti Koivisto. 8 9 * UIProcess/Cocoa/NavigationState.mm: 10 (WebKit::tryAppLink): 11 (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): 12 We were crashing when trying to get the URL of the main frame, which was sad because we never 13 ended up using the main frame URL. Therefore, this patch drops the code in question. 14 15 * UIProcess/ProvisionalPageProxy.cpp: 16 (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): 17 Add assertion to make sure that the DecidePolicyForNavigationActionAsync IPC it is getting 18 from the process is related to its main frame. 19 1 20 2019-01-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 21 -
trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm
r239535 r240477 465 465 #endif 466 466 467 static void tryAppLink(Ref<API::NavigationAction>&& navigationAction, const String& currentMainFrameURL,WTF::Function<void(bool)>&& completionHandler)467 static void tryAppLink(Ref<API::NavigationAction>&& navigationAction, WTF::Function<void(bool)>&& completionHandler) 468 468 { 469 469 #if HAVE(APP_LINKS) … … 487 487 void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageProxy& webPageProxy, Ref<API::NavigationAction>&& navigationAction, Ref<WebFramePolicyListenerProxy>&& listener, API::Object* userInfo) 488 488 { 489 ASSERT(webPageProxy.mainFrame());490 String mainFrameURLString = webPageProxy.mainFrame()->url();491 489 bool subframeNavigation = navigationAction->targetFrame() && !navigationAction->targetFrame()->isMainFrame(); 492 490 … … 522 520 listener->ignore(); 523 521 }; 524 tryAppLink(WTFMove(navigationAction), mainFrameURLString,WTFMove(completionHandler));522 tryAppLink(WTFMove(navigationAction), WTFMove(completionHandler)); 525 523 return; 526 524 } … … 534 532 auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), delegateHasWebsitePolicies ? @selector(_webView:decidePolicyForNavigationAction:decisionHandler:) : @selector(webView:decidePolicyForNavigationAction:decisionHandler:)); 535 533 536 auto decisionHandlerWithPolicies = [localListener = WTFMove(listener), navigationAction = navigationAction.copyRef(), checker = WTFMove(checker), mainFrameURLString,webPageProxy = makeRef(webPageProxy), subframeNavigation](WKNavigationActionPolicy actionPolicy, _WKWebsitePolicies *websitePolicies) mutable {534 auto decisionHandlerWithPolicies = [localListener = WTFMove(listener), navigationAction = navigationAction.copyRef(), checker = WTFMove(checker), webPageProxy = makeRef(webPageProxy), subframeNavigation](WKNavigationActionPolicy actionPolicy, _WKWebsitePolicies *websitePolicies) mutable { 537 535 if (checker->completionHandlerHasBeenCalled()) 538 536 return; … … 557 555 case WKNavigationActionPolicyAllow: 558 556 case _WKNavigationActionPolicyAllowInNewProcess: 559 tryAppLink(WTFMove(navigationAction), mainFrameURLString,[actionPolicy, localListener = WTFMove(localListener), websitePolicies = WTFMove(apiWebsitePolicies)](bool followedLinkToApp) mutable {557 tryAppLink(WTFMove(navigationAction), [actionPolicy, localListener = WTFMove(localListener), websitePolicies = WTFMove(apiWebsitePolicies)](bool followedLinkToApp) mutable { 560 558 if (followedLinkToApp) { 561 559 localListener->ignore(); -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
r240055 r240477 265 265 void ProvisionalPageProxy::decidePolicyForNavigationActionAsync(uint64_t frameID, WebCore::SecurityOriginData&& frameSecurityOrigin, uint64_t navigationID, NavigationActionData&& navigationActionData, FrameInfoData&& frameInfoData, uint64_t originatingPageID, const WebCore::ResourceRequest& originalRequest, WebCore::ResourceRequest&& request, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, uint64_t listenerID) 266 266 { 267 ASSERT(m_mainFrame); 268 ASSERT(m_mainFrame->frameID() == frameID); 267 269 m_page.decidePolicyForNavigationActionAsyncShared(m_process.copyRef(), frameID, WTFMove(frameSecurityOrigin), navigationID, WTFMove(navigationActionData), WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, listenerID); 268 270 } -
trunk/Tools/ChangeLog
r240476 r240477 1 2019-01-25 Chris Dumez <cdumez@apple.com> 2 3 Regression(PSON?) Crash under NavigationState::NavigationClient::decidePolicyForNavigationAction() 4 https://bugs.webkit.org/show_bug.cgi?id=193779 5 <rdar://problem/46170903> 6 7 Reviewed by Antti Koivisto. 8 9 Add API test that quickly navigates forward to a previous process without waiting for it to 10 suspend. I suspect the crash could have been happening due to receiving leftover IPC from 11 the process' previous page when reconnecting the it for the forward navigation. 12 13 * TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm: 14 1 15 2019-01-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 16 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
r240443 r240477 2137 2137 } 2138 2138 2139 static const char* keepNavigatingFrameBytes = R"PSONRESOURCE( 2140 <body> 2141 <iframe id="testFrame1" src="about:blank"></iframe> 2142 <iframe id="testFrame2" src="about:blank"></iframe> 2143 <iframe id="testFrame3" src="about:blank"></iframe> 2144 <script> 2145 window.addEventListener('pagehide', function(event) { 2146 for (var j = 0; j < 10000; j++); 2147 }); 2148 2149 var i = 0; 2150 function navigateFrames() 2151 { 2152 testFrame1.src = "pson://www.google.com/main" + i + ".html"; 2153 testFrame2.src = "pson://www.google.com/main" + i + ".html"; 2154 testFrame3.src = "pson://www.google.com/main" + i + ".html"; 2155 i++; 2156 } 2157 2158 navigateFrames(); 2159 setInterval(() => { 2160 navigateFrames(); 2161 }, 0); 2162 </script> 2163 </body> 2164 )PSONRESOURCE"; 2165 2166 TEST(ProcessSwap, ReuseSuspendedProcessForRegularNavigation) 2167 { 2168 auto processPoolConfiguration = adoptNS([[_WKProcessPoolConfiguration alloc] init]); 2169 [processPoolConfiguration setProcessSwapsOnNavigation:YES]; 2170 auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]); 2171 2172 auto webViewConfiguration = adoptNS([[WKWebViewConfiguration alloc] init]); 2173 [webViewConfiguration setProcessPool:processPool.get()]; 2174 auto handler = adoptNS([[PSONScheme alloc] init]); 2175 [handler addMappingFromURLString:@"pson://www.webkit.org/main1.html" toData:keepNavigatingFrameBytes]; 2176 [webViewConfiguration setURLSchemeHandler:handler.get() forURLScheme:@"PSON"]; 2177 2178 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:webViewConfiguration.get()]); 2179 auto delegate = adoptNS([[PSONNavigationDelegate alloc] init]); 2180 [webView setNavigationDelegate:delegate.get()]; 2181 2182 NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main1.html"]]; 2183 [webView loadRequest:request]; 2184 2185 TestWebKitAPI::Util::run(&done); 2186 done = false; 2187 2188 auto webkitPID = [webView _webProcessIdentifier]; 2189 2190 request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.apple.com/main.html"]]; 2191 [webView loadRequest:request]; 2192 2193 TestWebKitAPI::Util::run(&done); 2194 done = false; 2195 2196 auto applePID = [webView _webProcessIdentifier]; 2197 EXPECT_NE(webkitPID, applePID); 2198 2199 request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"pson://www.webkit.org/main2.html"]]; 2200 [webView loadRequest:request]; 2201 2202 TestWebKitAPI::Util::run(&done); 2203 done = false; 2204 2205 EXPECT_EQ(webkitPID, [webView _webProcessIdentifier]); 2206 } 2207 2139 2208 static const char* mainFramesOnlyMainFrame = R"PSONRESOURCE( 2140 2209 <script>
Note: See TracChangeset
for help on using the changeset viewer.