|
@@ -17,6 +17,7 @@ import android.os.Environment;
|
17
|
17
|
import androidx.annotation.RequiresApi;
|
18
|
18
|
import androidx.core.content.ContextCompat;
|
19
|
19
|
import android.text.TextUtils;
|
|
20
|
+import android.util.Log;
|
20
|
21
|
import android.view.Gravity;
|
21
|
22
|
import android.view.View;
|
22
|
23
|
import android.view.ViewGroup;
|
|
@@ -801,8 +802,9 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
801
|
802
|
|
802
|
803
|
@Override
|
803
|
804
|
public void onReceivedSslError(final WebView webView, final SslErrorHandler handler, final SslError error) {
|
|
805
|
+ // onReceivedSslError is called for most requests, per Android docs: https://developer.android.com/reference/android/webkit/WebViewClient#onReceivedSslError(android.webkit.WebView,%2520android.webkit.SslErrorHandler,%2520android.net.http.SslError)
|
804
|
806
|
// WebView.getUrl() will return the top-level window URL.
|
805
|
|
- // If a top-level navigation triggers this error handler, the top-level URL will be the failing URL (not the current URL).
|
|
807
|
+ // If a top-level navigation triggers this error handler, the top-level URL will be the failing URL (not the URL of the currently-rendered page).
|
806
|
808
|
// This is desired behavior. We later use these values to determine whether the request is a top-level navigation or a subresource request.
|
807
|
809
|
String topWindowUrl = webView.getUrl();
|
808
|
810
|
String failingUrl = error.getUrl();
|
|
@@ -814,6 +816,7 @@ public class RNCWebViewManager extends SimpleViewManager<WebView> {
|
814
|
816
|
|
815
|
817
|
if (!topWindowUrl.equalsIgnoreCase(failingUrl)) {
|
816
|
818
|
// If error is not due to top-level navigation, then do not call onReceivedError()
|
|
819
|
+ Log.w("RNCWebViewManager", "Resource blocked from loading due to SSL error. Blocked URL: "+failingUrl);
|
817
|
820
|
return;
|
818
|
821
|
}
|
819
|
822
|
|