fix: crash when navigating with render process reuse disabled (#30852)

This commit is contained in:
Robo
2021-09-07 18:50:39 -07:00
committed by GitHub
parent 681d02a77d
commit 1ac4d27e22
3 changed files with 61 additions and 1 deletions

View File

@@ -1387,8 +1387,19 @@ void WebContents::HandleNewRenderFrame(
rwh_impl->disable_hidden_ = !background_throttling_;
auto* web_frame = WebFrameMain::FromRenderFrameHost(render_frame_host);
if (web_frame)
if (web_frame) {
// When render process reuse is disabled a new siteinstance will always be
// forced for every navigation, if a WebFrameMain instance was created
// for a FrameTreeNodeId before navigation started, the corresponding
// RenderFrameHost will not be the same when the navigation completes.
// Compare GlobalFrameRoutingId to avoid incorrect behavior.
if (!ElectronBrowserClient::Get()->CanUseCustomSiteInstance() &&
web_frame->render_frame_host()->GetGlobalFrameRoutingId() !=
render_frame_host->GetGlobalFrameRoutingId()) {
return;
}
web_frame->Connect();
}
}
void WebContents::RenderFrameCreated(