Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: handle webview provider missing exception (#34456)
Summary: The [existing fix](https://github.com/facebook/react-native/blob/fb936dfffb3ca2d9bc0969dfe36a70bdf66783e0/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java#L151) to handle missing WebView provider uses string comparison based checks to handle the exception gracefully, or otherwise simply throw the exception. This ends up crashing the app for the end user. <img width="1319" alt="Screenshot 2022-08-19 at 4 33 31 PM" src="https://user-images.githubusercontent.com/933314/185605137-24757dad-806e-4cca-b000-7d6ce2d191e1.png"> Fatal exceptions are bad in any case and not good user experience, we can gracefully handle this by [returning](main...rachitmishra:react-native-1:patch-2#diff-f7ca1976002c4612051e4949395e64511b6f769e347c488e9a0d15cb5331fe76R141) `null` for all cases when WebView provider is not found. ## 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] - Gracefully handle crash if no WebView provider is found on the device Pull Request resolved: #34456 Test Plan: IMO no testing is required as we were already returning null in certain cases after handling the exception message, also `ForwardingCookieManager::getCookieManager` is already marked `Nullable` so we are safe there. Reviewed By: lunaleaps Differential Revision: D39809020 Pulled By: cortinico fbshipit-source-id: 54b290ad7740859bdc84401904236c32761a4631
- Loading branch information