WebViewClient.onRenderProcessGone() 未在首先崩溃的 WebView 上调用

WebViewClient.onRenderProcessGone() not called on crashing WebView first

我有一个可以同时拥有多个 WebView 的应用程序。每隔一段时间,应用程序就会因本机错误而崩溃

SIGTRAP: Trace/breakpoint trap
        at 0x7a587dd494(/data/app/com.android.chrome-7kzKsZs3wawWfQ1TQ0h58w==/base.apk!/lib/arm64-v8a/libmonochrome.so:25011348)

我能够将其追踪到 WebView 渲染器问题,我可以通过加载错误的 javascript 来模拟该问题,例如 webView.evaluateJavascript("javascript:(function() { txt = \"a\"; while(1){ txt += \"a\"; } })();", null);。 我现在正试图找出导致生产应用程序问题的页面。为此,我正在覆盖 WebViewClient.onRenderProcessGone() 并希望在此时记录加载的 URL。我遇到的问题是,因为我有多个 WebView,所以我不能确定 onRenderProcessGone() 在实际导致崩溃的那个上首先被调用。

来自 WebViewClient 文档:Multiple WebView instances may be associated with a single render process. onRenderProcessGone will be called for each WebView that was affected.

我的问题是,在 WebViewClient.onRenderProcessGone() 中,我如何知道哪个 WebView/WebViewClient 导致了崩溃?

此问题已在 android-webview-dev google 组中得到回答。不幸的是,目前无法知道哪个 webview 崩溃了。