-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Prevents TransactionTooLargeException error in WebViewActivity #20139
Conversation
📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
|
📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
|
Generated by 🚫 dangerJS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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!
Fixes #9685
Description
This PR targets the third common
TransactionTooLargeException
crash occurring when theWebView
state 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
, theWPWebViewActivity
which is used across the app and also extended by:DomainRegistrationCheckoutWebViewActivity
,DomainManagementDetailsActivity
,ThemeWebActivity
,SupportWebViewActivity
andJetpackConnectionWebViewActivity
a 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_STATE
from 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
saveState
method 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.txt
if necessary.Testing Checklist: