Skip to content
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

override onRenderProcessGone #9

Merged
merged 4 commits into from
Nov 23, 2023
Merged

override onRenderProcessGone #9

merged 4 commits into from
Nov 23, 2023

Conversation

kiftio
Copy link
Contributor

@kiftio kiftio commented Nov 21, 2023

What are you trying to accomplish?

Implement onRenderProcessGone, to handle cases where the renderer process for a WebView object goes away because the system has killed it to reclaim memory.

Left unhandled, the app would crash in this case. But by using this API, we can let it continue executing.

To handle it, we need to remove the WebView from the view hierarchy, and destroy the instance. We could also try to create a new instance of the WebView, but that is not covered in this PR.

The behaviour after this PR is that the app wouldn't crash, but users would see a blank WebView that can be closed.

Docs

Before you deploy

@kiftio kiftio changed the title override on render process gone override onRenderProcessGone Nov 22, 2023
@@ -107,7 +107,9 @@ internal class CheckoutDialog(

setOnCancelListener {
checkoutEventProcessor.onCheckoutCanceled()
(checkoutWebView.parent as ViewGroup).removeView(checkoutWebView)
checkoutWebView.parent?.let {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

parent may now be removed in onRenderProcessGone, so we should do a null check here

@kiftio kiftio marked this pull request as ready for review November 22, 2023 11:46
@kiftio kiftio requested a review from a team as a code owner November 22, 2023 11:46
Copy link
Contributor

@Bruno125 Bruno125 left a comment

Choose a reason for hiding this comment

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

nicely done 👍

@kiftio kiftio merged commit de18099 into main Nov 23, 2023
4 checks passed
@kiftio kiftio deleted the dk/on-render-process-gone branch November 23, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants