Prevents TransactionTooLargeException error in WebViewActivity#20139
Merged
mkevins merged 4 commits intorelease/24.2from Feb 7, 2024
Merged
Prevents TransactionTooLargeException error in WebViewActivity#20139mkevins merged 4 commits intorelease/24.2from
mkevins merged 4 commits intorelease/24.2from
Conversation
Contributor
|
| App Name | WordPress |
|
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr20139-3a947fd | |
| Commit | 3a947fd | |
| Direct Download | wordpress-prototype-build-pr20139-3a947fd.apk |
Contributor
|
| App Name | Jetpack |
|
| Flavor | Jalapeno | |
| Build Type | Debug | |
| Version | pr20139-3a947fd | |
| Commit | 3a947fd | |
| Direct Download | jetpack-prototype-build-pr20139-3a947fd.apk |
Collaborator
Generated by 🚫 dangerJS |
mkevins
approved these changes
Feb 7, 2024
Contributor
mkevins
left a comment
There was a problem hiding this comment.
Thank you for this fix. I was not able to reproduce the original crash, but I was able to confirm the fix is tracked by applying your suggested patch. Tested on a Pixel 3a (physical device). The code changes are reasonable, especially considering the same technique is used in the Chromium source.
Nice work Antonis!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Fixes #9685
Description
This PR targets the third common
TransactionTooLargeExceptioncrash occurring when theWebViewstate is too big (the other two were cover by #19747 and #20046).In this case the crash stack trace is like the following indicating a huge
WEBVIEW_CHROMIUM_STATE:Two approaches have been tested (see #9685 (comment)) and the hacky alternative was considered safer since it is applied only when the app is about to crash. Due to the wide usage of this part of the code affecting the
SSLCertsViewActivity, theWPWebViewActivitywhich is used across the app and also extended by:DomainRegistrationCheckoutWebViewActivity,DomainManagementDetailsActivity,ThemeWebActivity,SupportWebViewActivityandJetpackConnectionWebViewActivitya more radical change might have unpredicted impact.A new track event was also added to analyse the cases when the crash occurs, so that we can iterate with a more targeted fix if this is feasible.
The fix involves removing the
WEBVIEW_CHROMIUM_STATEfrom the saved Bundle when it exceeds a certain threshold (300KB). When the state is removed the url is reloaded on restore.Note that the behaviour of the
saveStatemethod has changed since this part of the code was introduced 9 years ago and the method no longer stores the display data for the WebView but just the browsing history. The same approach is also used in Chromium.To Test:
webview_too_large_payload_error, Properties: {"url":...}is trackedRegression Notes
Potential unintended areas of impact
What I did to test those areas of impact (or what existing automated tests I relied on)
What automated tests I added (or what prevented me from doing so)
PR Submission Checklist:
RELEASE-NOTES.txtif necessary.Testing Checklist: