Skip to content

Commit

Permalink
Prevent process form shutting down when calling WebFrameProxy::prepar…
Browse files Browse the repository at this point in the history
…eForProvisionalNavigationInProcess

https://bugs.webkit.org/show_bug.cgi?id=265550
rdar://118471432

Reviewed by Pascoe.

Similar to code in WebPageProxy::triggerBrowsingContextGroupSwitchForNavigation
and WebPageProxy::continueNavigationInNewProcess, if we do anything asynchronous between
the point where we decide to use a process and the point where we actually start using it,
we need to make a shutdown preventing scope.  Otherwise, we hit the release assertion
in WebPageProxy::continueNavigationInNewProcess, which happened occasionally when loading
to and from complicated web pages with site isolation enabled.

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::continueNavigationInNewProcess):

Canonical link: https://commits.webkit.org/271307@main
  • Loading branch information
achristensen07 committed Nov 29, 2023
1 parent f789f59 commit 3a2195d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/WebKit/UIProcess/WebPageProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4401,7 +4401,8 @@ void WebPageProxy::continueNavigationInNewProcess(API::Navigation& navigation, W
loadParameters.shouldTreatAsContinuingLoad = navigation.currentRequestIsRedirect() ? WebCore::ShouldTreatAsContinuingLoad::YesAfterProvisionalLoadStarted : WebCore::ShouldTreatAsContinuingLoad::YesAfterNavigationPolicyDecision;
loadParameters.frameIdentifier = frame.frameID();

frame.prepareForProvisionalNavigationInProcess(newProcess, navigation, [loadParameters = WTFMove(loadParameters), newProcess = newProcess.copyRef(), webPageID = webPageIDInProcessForDomain(RegistrableDomain(navigation.currentRequest().url()))] () mutable {
auto webPageID = webPageIDInProcessForDomain(RegistrableDomain(navigation.currentRequest().url()));
frame.prepareForProvisionalNavigationInProcess(newProcess, navigation, [loadParameters = WTFMove(loadParameters), newProcess = newProcess.copyRef(), webPageID, preventProcessShutdownScope = newProcess->shutdownPreventingScope()] () mutable {
newProcess->send(Messages::WebPage::LoadRequest(WTFMove(loadParameters)), webPageID);
});
return;
Expand Down

0 comments on commit 3a2195d

Please sign in to comment.