mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
CB-6971 Fix infinite recursion for onReceiveError
This commit is contained in:
parent
693ec14df5
commit
3a9898a6a6
@ -480,7 +480,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
|
|||||||
me.stopLoading();
|
me.stopLoading();
|
||||||
LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!");
|
LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!");
|
||||||
if (viewClient != null) {
|
if (viewClient != null) {
|
||||||
viewClient.onReceivedError(me, -6, "The connection to the server was unsuccessful.", url);
|
viewClient.onReceivedError(-6, "The connection to the server was unsuccessful.", url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -59,7 +59,7 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
|
|||||||
private static final String TAG = "CordovaWebViewClient";
|
private static final String TAG = "CordovaWebViewClient";
|
||||||
private static final String CORDOVA_EXEC_URL_PREFIX = "http://cdv_exec/";
|
private static final String CORDOVA_EXEC_URL_PREFIX = "http://cdv_exec/";
|
||||||
CordovaInterface cordova;
|
CordovaInterface cordova;
|
||||||
CordovaWebView appView;
|
AndroidWebView appView;
|
||||||
private boolean doClearHistory = false;
|
private boolean doClearHistory = false;
|
||||||
boolean isCurrentlyLoading;
|
boolean isCurrentlyLoading;
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
|
|||||||
* @param cordova
|
* @param cordova
|
||||||
* @param view
|
* @param view
|
||||||
*/
|
*/
|
||||||
public AndroidWebViewClient(CordovaInterface cordova, CordovaWebView view) {
|
public AndroidWebViewClient(CordovaInterface cordova, AndroidWebView view) {
|
||||||
this.cordova = cordova;
|
this.cordova = cordova;
|
||||||
this.appView = view;
|
this.appView = view;
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
|
|||||||
*
|
*
|
||||||
* @param view
|
* @param view
|
||||||
*/
|
*/
|
||||||
public void setWebView(CordovaWebView view) {
|
public void setWebView(AndroidWebView view) {
|
||||||
this.appView = view;
|
this.appView = view;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,14 +483,8 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceivedError(CordovaWebView me, int i, String string,
|
public void onReceivedError(int errorCode, String description, String url) {
|
||||||
String url) {
|
this.onReceivedError(appView, errorCode, description, url);
|
||||||
// Only deal with this if we're dealing with a proper classic webview.
|
|
||||||
if(WebView.class.isInstance(me))
|
|
||||||
{
|
|
||||||
this.onReceivedError(me, i, string, url);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -299,8 +299,6 @@ public class CordovaActivity extends Activity implements CordovaInterface {
|
|||||||
|
|
||||||
this.appView.setWebViewClient(webViewClient);
|
this.appView.setWebViewClient(webViewClient);
|
||||||
this.appView.setWebChromeClient(webChromeClient);
|
this.appView.setWebChromeClient(webChromeClient);
|
||||||
webViewClient.setWebView(this.appView);
|
|
||||||
webChromeClient.setWebView(this.appView);
|
|
||||||
|
|
||||||
this.appView.setLayoutParams(new LinearLayout.LayoutParams(
|
this.appView.setLayoutParams(new LinearLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package org.apache.cordova;
|
package org.apache.cordova;
|
||||||
|
|
||||||
public interface CordovaWebViewClient {
|
public interface CordovaWebViewClient {
|
||||||
|
void onReceivedError(int errorCode, String description, String url);
|
||||||
void setWebView(CordovaWebView appView);
|
|
||||||
|
|
||||||
void onReceivedError(CordovaWebView me, int i, String string, String url);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,7 @@ public class IceCreamCordovaWebViewClient extends AndroidWebViewClient implement
|
|||||||
super(cordova);
|
super(cordova);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IceCreamCordovaWebViewClient(CordovaInterface cordova, CordovaWebView view) {
|
public IceCreamCordovaWebViewClient(CordovaInterface cordova, AndroidWebView view) {
|
||||||
super(cordova, view);
|
super(cordova, view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,10 +97,4 @@ public class IceCreamCordovaWebViewClient extends AndroidWebViewClient implement
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceivedError(CordovaWebView me, int i, String string,
|
|
||||||
String url) {
|
|
||||||
super.onReceivedError(me, i, string, url);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user