是否有可能使 chromium 在选项卡崩溃时立即重新加载?
我们在嵌入式系统上运行 chromium 83,并遇到了一些随机选项卡崩溃的情况。
如果崩溃的话,是否可以直接重新加载 chromium 中的选项卡(不显示“噢,快照!”页面)?
我们目前正在尝试修补源代码以使其正常工作,这些是迄今为止我们的方法。
(均在 Sad_tab_helper.cc -> SadTabHelper::RenderProcessGone() 中 方法一:
if (SadTab::ShouldShow(status)) {
web_contents()->GetController().Reload(content::ReloadType::NORMAL, true);
}
方法二:
if (SadTab::ShouldShow(status)) {
content::RunOrPostTaskOnThread(
FROM_HERE,
content::BrowserThread::ID::UI,
base::BindOnce(
[](content::WebContents* contents) {
contents->GetController().Reload(content::ReloadType::NORMAL, true);
},
std::move(web_contents())));
}
这两种改变最终都会导致整个浏览器崩溃。
铬似乎尝试重新加载页面,但正如所说,然后它崩溃了。我们得到的日志是:
[1663:1671:0321/090914.211931:VERBOSE1:network_delegate.cc(32)] NetworkDelegate::NotifyBeforeURLRequest: http://127.0.0.1/login
[1663:1671:0321/090919.082378:ERROR:broker_posix.cc(40)] Recvmsg error: Connection reset by peer (104)
之后整个浏览器崩溃了。有没有办法做我们想做的事,或者我们陷入了死胡同?
We are running chromium 83 on an embedded system and experience some random tab crashes.
Is it possible to directly reload a tab in chromium, if it crashes (without showing the "Aw snap!" page)?
We're currently trying to patch the source code to get it working and those were our approaches so far.
(both in sad_tab_helper.cc -> SadTabHelper::RenderProcessGone()
Approach 1:
if (SadTab::ShouldShow(status)) {
web_contents()->GetController().Reload(content::ReloadType::NORMAL, true);
}
Approach 2:
if (SadTab::ShouldShow(status)) {
content::RunOrPostTaskOnThread(
FROM_HERE,
content::BrowserThread::ID::UI,
base::BindOnce(
[](content::WebContents* contents) {
contents->GetController().Reload(content::ReloadType::NORMAL, true);
},
std::move(web_contents())));
}
Both changes finally lead to crash of the entire browser.
It seems that chromium tries to reload the page but as said, it then crashes. The log we get are:
[1663:1671:0321/090914.211931:VERBOSE1:network_delegate.cc(32)] NetworkDelegate::NotifyBeforeURLRequest: http://127.0.0.1/login
[1663:1671:0321/090919.082378:ERROR:broker_posix.cc(40)] Recvmsg error: Connection reset by peer (104)
After that the entire browser crashes. Is there a way to do what we want or are we on a dead end here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
第二种方法不是最理想的,
SadTabHelper::RenderProcessGone
仅在 UI 上运行。必须避免在处理来自任何
WebContentsObserver
(SadTabHelper
是WebContentsObserver
)的通知时启动导航。它会导致问题。这两种方法都试图做到这一点。我想使用base::PostTask
而不是content::RunOrPostTaskOnThread
应该有所帮助。The second approach is suboptimal,
SadTabHelper::RenderProcessGone
only runs on UI.Initiating navigation while handling notifications from any
WebContentsObserver
(SadTabHelper
is aWebContentsObserver
) must be avoided. It leads to problems. The both approaches attempt to do this. I suppose usingbase::PostTask
instead ofcontent::RunOrPostTaskOnThread
should help.我的声誉不足以发表评论,因此我无法将此评论保留在应有的位置。
如果您遇到此特定解决方案,则所需的内容包括:
My reputation is not good enough to comment so I can't leave this comment where it should be.
If you come across this particular solution, the required includes are: