Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import android.os.Build;
import android.view.View;
import android.webkit.HttpAuthHandler;
import android.webkit.RenderProcessGoneDetail;
import android.webkit.SslErrorHandler;
import android.webkit.WebResourceError;
import android.webkit.WebResourceRequest;
Expand Down Expand Up @@ -218,6 +219,28 @@ public void onPageFinished(final WebView view,
view.setVisibility(View.VISIBLE);
}

/**
* We received an ANR bug report from LTW, where webview crashing would cause the calling application to crash as well,
* because Broker was not handling the crash and packaging it into an exception
*
* Overriding this method allows us to do that and send an error gracefully to the callback object when the render process is gone.
* @param view webview in question
* @param detail minor details about the render process being lost
* @return whether or not we handled the crash
*/
@Override
public boolean onRenderProcessGone(WebView view, RenderProcessGoneDetail detail) {
// Handle render process crash
// TODO: is there an errorCode that makes more sense in this spot? We aren't actually getting anything back from webView, we have to come up with it ourselves

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the plan to leave TODO here in comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, i usually add it to prompt discussion in PR stage, then remove it once we decide. Sometimes it stays if the discussion is not finalized but code can go in for the time.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe one could be created in ClientException for Webview crashes (WEBVIEW_CRASH?) which we can let oneauth know about.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
sendErrorToCallback(view, 0, "WebView render process gone, crahsd? : " + detail.didCrash());
Copy link

Copilot AI Oct 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'crahsd' to 'crashed'.

Suggested change
sendErrorToCallback(view, 0, "WebView render process gone, crahsd? : " + detail.didCrash());
sendErrorToCallback(view, 0, "WebView render process gone, crashed? : " + detail.didCrash());

Copilot uses AI. Check for mistakes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed with CP her on spelling error to be updated.

} else {
sendErrorToCallback(view, 0, "WebView render process gone.");
}

return true; // Indicate we handled the crash
}

@Override
public void onPageStarted(final WebView view,
final String url,
Expand Down
Loading