fix: crash when renderer process crashes while webview is reloading (#46769)

WebView uses WebContentsViewChildFrame, which doesn't have a Focus impl
and triggers a fatal NOTREACHED.

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Jinli Wu <wujinli@bytedance.com>
This commit is contained in:
trop[bot] 2025-04-25 13:12:54 +02:00 committed by GitHub
parent 0f73bba452
commit d2134f84e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 31 additions and 0 deletions

View file

@ -4101,6 +4101,14 @@ void WebContents::ExitPictureInPicture() {
PictureInPictureWindowManager::GetInstance()->ExitPictureInPicture();
}
bool WebContents::ShouldFocusPageAfterCrash(content::WebContents* source) {
// WebView uses WebContentsViewChildFrame, which doesn't have a Focus impl
// and triggers a fatal NOTREACHED.
if (is_guest())
return false;
return true;
}
void WebContents::DevToolsSaveToFile(const std::string& url,
const std::string& content,
bool save_as,