Skip to content

Commit

Permalink
[ForwardingCookieHandler] Adds Logic To Catch MissingWebViewPackageEx…
Browse files Browse the repository at this point in the history
…ception

Summary:
We are seeing crash reports that the webview is missing. In this case
it should fail gracefully so that a missing webview does not block
from using an app built with React Native.

The contains could also be changed to check for "webview" in general
to catch all webview related exception. It's currenlty checking on
for the specific string that I'm seeing in our app's crashreporting tool.
  • Loading branch information
thorbenprimke committed Apr 23, 2019
1 parent 54af7fc commit 030b1c2
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ protected void doInBackgroundGuarded(Void... params) {
} catch (IllegalArgumentException ex) {
// https://bugs.chromium.org/p/chromium/issues/detail?id=559720
return null;
} catch (Exception exception) {
String message = exception.getMessage();
// We cannot catch MissingWebViewPackageException as it is in a private / system API
// class. This validates the exception's message to ensure we are only handling this
// specific exception.
// https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/
// webkit/WebViewFactory.java#98
if (message != null && message.contains("No WebView installed")) {
return null;
} else {
throw exception;
}
}

if (USES_LEGACY_STORE) {
Expand Down

0 comments on commit 030b1c2

Please sign in to comment.