Skip to content

Conversation

@fadidurah
Copy link
Contributor

@fadidurah fadidurah commented Oct 18, 2025

We do not gracefully handle webview process crashes, which can cause ANRs for calling activitties (LTW bug: https://dev.azure.com/microsoft/OS/_workitems/edit/59756442). In this PR we override the webview method onRenderProcessGone to handle what to do if webview no longer is able to render content, where we send the error to the callback rather than having an uncaught exception.

AB#3405900

@fadidurah fadidurah requested a review from a team as a code owner October 18, 2025 01:04
@Copilot Copilot AI review requested due to automatic review settings October 18, 2025 01:04
@github-actions
Copy link

✅ Work item link check complete. Description contains link AB#3405900 to an Azure Boards work item.

@github-actions
Copy link

❌ Work item link check failed. Description contains AB#3405900 but the Bot could not link it to an Azure Boards work item.

Click here to learn more.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds error handling for WebView render process crashes to prevent ANRs in calling applications. When the WebView render process fails, the new onRenderProcessGone override catches the crash and sends an error to the callback instead of letting the exception propagate uncaught.

  • Overrides onRenderProcessGone method to handle WebView process crashes gracefully
  • Implements version-specific error messages based on Android SDK level
  • Returns true to indicate the crash was handled successfully

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@github-actions github-actions bot changed the title Add onRenderProcessGone override to webview logic Add onRenderProcessGone override to webview logic, Fixes AB#3405900 Oct 18, 2025
@fadidurah fadidurah added the No-Changelog This Pull-Request has no associated changelog entry. label Oct 19, 2025
@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
Copy link
Contributor

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.

@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
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.

…/webview/OAuth2WebViewClient.java

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No-Changelog This Pull-Request has no associated changelog entry.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants