-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
fix: Crash if WebView is disabled #34483
Conversation
Base commit: 2452c5f |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Hi @Pajn, thanks for the PR. Could you please rebase on main? We should have fixed the CI issues. |
Sorry to ask that, but could you rebase again? The CI is still red but for some other commits that landed in between.. :( |
Base commit: 2452c5f |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
cf47331
to
a68ab50
Compare
Sorry, my additions skipped the earlier nullcheck. It should be correct now. |
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This pull request was successfully merged by @Pajn in 5451cd4. When will my fix make it into a release? | Upcoming Releases |
Summary: When the webview is updated by play store, all apps that has loaded webview gets killed. For background see https://issuetracker.google.com/issues/228611949?pli=1 We have a long-running app and don't want this to happen and while we are not using webview anywhere, we are using websockets that loads it for reading cookies, however we are not using cookies to authenticate the websocket and thus want to disable the webview to avoid loading it unnecessarily and then getting killed unnecessarily. The webview has support for beeing disabled https://developer.android.com/reference/android/webkit/WebView#disableWebView() however as-is this crashes React Native. It seems to me like this case is very similar to not having web view installed and should be handled in the same way. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Android] [Fixed] - Avoid crash in ForwardingCookieHandler if webview is disabled Pull Request resolved: #34483 Test Plan: Add `WebView.disableWebView();` as the first line in `MainActivity.onCreate`. Reviewed By: christophpurrer Differential Revision: D38981827 Pulled By: cipolleschi fbshipit-source-id: 335a8420568ad0c80b834ae8a3b164e55ebe26f3
Summary: When the webview is updated by play store, all apps that has loaded webview gets killed. For background see https://issuetracker.google.com/issues/228611949?pli=1 We have a long-running app and don't want this to happen and while we are not using webview anywhere, we are using websockets that loads it for reading cookies, however we are not using cookies to authenticate the websocket and thus want to disable the webview to avoid loading it unnecessarily and then getting killed unnecessarily. The webview has support for beeing disabled https://developer.android.com/reference/android/webkit/WebView#disableWebView() however as-is this crashes React Native. It seems to me like this case is very similar to not having web view installed and should be handled in the same way. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://reactnative.dev/contributing/changelogs-in-pull-requests --> [Android] [Fixed] - Avoid crash in ForwardingCookieHandler if webview is disabled Pull Request resolved: facebook#34483 Test Plan: Add `WebView.disableWebView();` as the first line in `MainActivity.onCreate`. Reviewed By: christophpurrer Differential Revision: D38981827 Pulled By: cipolleschi fbshipit-source-id: 335a8420568ad0c80b834ae8a3b164e55ebe26f3 # Conflicts: # ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java
Summary
When the webview is updated by play store, all apps that has loaded webview gets killed. For background see https://issuetracker.google.com/issues/228611949?pli=1
We have a long-running app and don't want this to happen and while we are not using webview anywhere, we are using websockets that loads it for reading cookies, however we are not using cookies to authenticate the websocket and thus want to disable the webview to avoid loading it unnecessarily and then getting killed unnecessarily.
The webview has support for beeing disabled https://developer.android.com/reference/android/webkit/WebView#disableWebView() however as-is this crashes React Native. It seems to me like this case is very similar to not having web view installed and should be handled in the same way.
Changelog
[Android] [Fixed] - Avoid crash in ForwardingCookieHandler if webview is disabled
Test Plan
Add
WebView.disableWebView();
as the first line inMainActivity.onCreate
.