-
Notifications
You must be signed in to change notification settings - Fork 46
Add onRenderProcessGone override to webview logic, Fixes AB#3405900 #2788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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; | ||||||
|
@@ -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 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the plan to leave TODO here in comment? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Corrected spelling of 'crahsd' to 'crashed'.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe 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, | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.