|
@@ -194,6 +194,8 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
194
|
194
|
|
195
|
195
|
webView.setDownloadListener(new DownloadListener() {
|
196
|
196
|
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
|
|
197
|
+ webView.setIgnoreErrFailedForThisURL(url);
|
|
198
|
+
|
197
|
199
|
RNCWebViewModule module = getModule(reactContext);
|
198
|
200
|
|
199
|
201
|
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
|
@@ -713,6 +715,11 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
713
|
715
|
protected boolean mLastLoadFailed = false;
|
714
|
716
|
protected @Nullable
|
715
|
717
|
ReadableArray mUrlPrefixesForDefaultIntent;
|
|
718
|
+ protected @Nullable String ignoreErrFailedForThisURL = null;
|
|
719
|
+
|
|
720
|
+ public void setIgnoreErrFailedForThisURL(@Nullable String url) {
|
|
721
|
+ ignoreErrFailedForThisURL = url;
|
|
722
|
+ }
|
716
|
723
|
|
717
|
724
|
@Override
|
718
|
725
|
public void onPageFinished(WebView webView, String url) {
|
|
@@ -764,6 +771,21 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
764
|
771
|
int errorCode,
|
765
|
772
|
String description,
|
766
|
773
|
String failingUrl) {
|
|
774
|
+
|
|
775
|
+ if (ignoreErrFailedForThisURL != null
|
|
776
|
+ && failingUrl.equals(ignoreErrFailedForThisURL)
|
|
777
|
+ && errorCode == -1
|
|
778
|
+ && description.equals("net::ERR_FAILED")) {
|
|
779
|
+
|
|
780
|
+ // This is a workaround for a bug in the WebView.
|
|
781
|
+ // See these chromium issues for more context:
|
|
782
|
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1023678
|
|
783
|
+ // https://bugs.chromium.org/p/chromium/issues/detail?id=1050635
|
|
784
|
+ // This entire commit should be reverted once this bug is resolved in chromium.
|
|
785
|
+ setIgnoreErrFailedForThisURL(null);
|
|
786
|
+ return;
|
|
787
|
+ }
|
|
788
|
+
|
767
|
789
|
super.onReceivedError(webView, errorCode, description, failingUrl);
|
768
|
790
|
mLastLoadFailed = true;
|
769
|
791
|
|
|
@@ -987,6 +1009,10 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
987
|
1009
|
super(reactContext);
|
988
|
1010
|
}
|
989
|
1011
|
|
|
1012
|
+ public void setIgnoreErrFailedForThisURL(String url) {
|
|
1013
|
+ mRNCWebViewClient.setIgnoreErrFailedForThisURL(url);
|
|
1014
|
+ }
|
|
1015
|
+
|
990
|
1016
|
public void setSendContentSizeChangeEvents(boolean sendContentSizeChangeEvents) {
|
991
|
1017
|
this.sendContentSizeChangeEvents = sendContentSizeChangeEvents;
|
992
|
1018
|
}
|