Changeset 244243 in webkit
- Timestamp:
- Apr 13, 2019, 9:22:34 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/ProvisionalPageProxy.cpp (modified) (12 diffs)
-
UIProcess/ProvisionalPageProxy.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r244242 r244243 1 2019-04-13 Chris Dumez <cdumez@apple.com> 2 3 [ Mac Debug ] TestWebKitAPI.ProcessSwap.ReuseSuspendedProcessForRegularNavigationRetainBundlePage is a flaky crash 4 https://bugs.webkit.org/show_bug.cgi?id=196548 5 <rdar://problem/49567254> 6 7 Reviewed by Darin Adler. 8 9 Update ProvisionalPageProxy methods to more consistently ignore unexpected IPC from the process. Previously, 10 some of the methods were doing this, but some other like didFailProvisionalLoadForFrame() weren't and this 11 was leading to this flaky crash. The issue is that if we do the load in an existing process that was recently 12 doing, there may be leftover IPC for the same pageID and this IPC gets received by the ProvisionalPageProxy 13 even though it is from a previous navigation. For this reason, the ProvisionalPageProxy should ignore all 14 incoming IPC that is not for its associated navigation. 15 16 * UIProcess/ProvisionalPageProxy.cpp: 17 (WebKit::ProvisionalPageProxy::didPerformClientRedirect): 18 (WebKit::ProvisionalPageProxy::didStartProvisionalLoadForFrame): 19 (WebKit::ProvisionalPageProxy::didFailProvisionalLoadForFrame): 20 (WebKit::ProvisionalPageProxy::didCommitLoadForFrame): 21 (WebKit::ProvisionalPageProxy::didNavigateWithNavigationData): 22 (WebKit::ProvisionalPageProxy::didChangeProvisionalURLForFrame): 23 (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionAsync): 24 (WebKit::ProvisionalPageProxy::decidePolicyForResponse): 25 (WebKit::ProvisionalPageProxy::didPerformServerRedirect): 26 (WebKit::ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): 27 (WebKit::ProvisionalPageProxy::decidePolicyForNavigationActionSync): 28 1 29 2019-04-13 Wenson Hsieh <wenson_hsieh@apple.com> 2 30 -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
r244161 r244243 184 184 } 185 185 186 inline bool ProvisionalPageProxy::validateInput(uint64_t frameID, const Optional<uint64_t>& navigationID) 187 { 188 // If the previous provisional load used an existing process, we may receive leftover IPC for a previous navigation, which we need to ignore. 189 if (!m_mainFrame || m_mainFrame->frameID() != frameID) 190 return false; 191 192 return !navigationID || *navigationID == m_navigationID; 193 } 194 186 195 void ProvisionalPageProxy::didCreateMainFrame(uint64_t frameID) 187 196 { … … 213 222 void ProvisionalPageProxy::didPerformClientRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID) 214 223 { 224 if (!validateInput(frameID)) 225 return; 226 215 227 m_page.didPerformClientRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID); 216 228 } … … 218 230 void ProvisionalPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, URL&& url, URL&& unreachableURL, const UserData& userData) 219 231 { 220 // If the previous provisional load used the same process, we may receive IPC for this previous provisional's main frame that we need to ignore. 221 if (!m_mainFrame || m_mainFrame->frameID() != frameID) 232 if (!validateInput(frameID, navigationID)) 222 233 return; 223 234 … … 239 250 void ProvisionalPageProxy::didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError& error, const UserData& userData) 240 251 { 252 if (!validateInput(frameID, navigationID)) 253 return; 254 241 255 RELEASE_LOG_ERROR_IF_ALLOWED(ProcessSwapping, "didFailProvisionalLoadForFrame: pageID = %" PRIu64 ", frameID = %" PRIu64 ", navigationID = %" PRIu64, m_page.pageID(), frameID, navigationID); 256 ASSERT(!m_provisionalLoadURL.isNull()); 242 257 m_provisionalLoadURL = { }; 243 258 … … 251 266 void ProvisionalPageProxy::didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo& certificateInfo, bool containsPluginDocument, Optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData& userData) 252 267 { 253 // If the previous provisional load used the same process, we may receive IPC for this previous provisional's main frame that we need to ignore. 254 if (!m_mainFrame || m_mainFrame->frameID() != frameID) 268 if (!validateInput(frameID, navigationID)) 255 269 return; 256 270 … … 265 279 void ProvisionalPageProxy::didNavigateWithNavigationData(const WebNavigationDataStore& store, uint64_t frameID) 266 280 { 281 if (!validateInput(frameID)) 282 return; 283 267 284 m_page.didNavigateWithNavigationDataShared(m_process.copyRef(), store, frameID); 268 285 } … … 270 287 void ProvisionalPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, URL&& url) 271 288 { 289 if (!validateInput(frameID, navigationID)) 290 return; 291 272 292 m_page.didChangeProvisionalURLForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(url)); 273 293 } … … 277 297 WebCore::ResourceRequest&& request, IPC::FormDataReference&& requestBody, WebCore::ResourceResponse&& redirectResponse, const UserData& userData, uint64_t listenerID) 278 298 { 279 ASSERT(m_mainFrame); 280 ASSERT(m_mainFrame->frameID() == frameID); 299 if (!validateInput(frameID, navigationID)) 300 return; 301 281 302 m_page.decidePolicyForNavigationActionAsyncShared(m_process.copyRef(), frameID, WTFMove(frameSecurityOrigin), identifier, navigationID, WTFMove(navigationActionData), 282 303 WTFMove(frameInfoData), originatingPageID, originalRequest, WTFMove(request), WTFMove(requestBody), WTFMove(redirectResponse), userData, listenerID); … … 286 307 uint64_t navigationID, const WebCore::ResourceResponse& response, const WebCore::ResourceRequest& request, bool canShowMIMEType, const String& downloadAttribute, uint64_t listenerID, const UserData& userData) 287 308 { 309 if (!validateInput(frameID, navigationID)) 310 return; 311 288 312 m_page.decidePolicyForResponseShared(m_process.copyRef(), frameID, frameSecurityOrigin, identifier, navigationID, response, request, canShowMIMEType, downloadAttribute, listenerID, userData); 289 313 } … … 291 315 void ProvisionalPageProxy::didPerformServerRedirect(const String& sourceURLString, const String& destinationURLString, uint64_t frameID) 292 316 { 317 if (!validateInput(frameID)) 318 return; 319 293 320 m_page.didPerformServerRedirectShared(m_process.copyRef(), sourceURLString, destinationURLString, frameID); 294 321 } … … 296 323 void ProvisionalPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceRequest&& request, const UserData& userData) 297 324 { 325 if (!validateInput(frameID, navigationID)) 326 return; 327 298 328 m_page.didReceiveServerRedirectForProvisionalLoadForFrameShared(m_process.copyRef(), frameID, navigationID, WTFMove(request), userData); 299 329 } … … 314 344 const UserData& userData, Messages::WebPageProxy::DecidePolicyForNavigationActionSync::DelayedReply&& reply) 315 345 { 316 ASSERT(isMainFrame); 317 ASSERT(!m_mainFrame || m_mainFrame->frameID() == frameID); 318 319 if (!isMainFrame || (m_mainFrame && m_mainFrame->frameID() != frameID)) { 346 if (!isMainFrame || (m_mainFrame && m_mainFrame->frameID() != frameID) || navigationID != m_navigationID) { 320 347 reply(identifier, WebCore::PolicyAction::Ignore, navigationID, DownloadID(), WTF::nullopt); 321 348 return; -
trunk/Source/WebKit/UIProcess/ProvisionalPageProxy.h
r244225 r244243 119 119 120 120 void initializeWebPage(); 121 bool validateInput(uint64_t frameID, const Optional<uint64_t>& navigationID = WTF::nullopt); 121 122 122 123 WebPageProxy& m_page;
Note:
See TracChangeset
for help on using the changeset viewer.