CB-6971 Fix infinite recursion for onReceiveError

This commit is contained in:
Andrew Grieve 2014-06-18 13:20:47 -04:00
parent 693ec14df5
commit 3a9898a6a6
5 changed files with 8 additions and 26 deletions

View File

@ -480,7 +480,7 @@ public class AndroidWebView extends WebView implements CordovaWebView {
me.stopLoading();
LOG.e(TAG, "CordovaWebView: TIMEOUT ERROR!");
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);
}
}
};

View File

@ -59,7 +59,7 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
private static final String TAG = "CordovaWebViewClient";
private static final String CORDOVA_EXEC_URL_PREFIX = "http://cdv_exec/";
CordovaInterface cordova;
CordovaWebView appView;
AndroidWebView appView;
private boolean doClearHistory = false;
boolean isCurrentlyLoading;
@ -81,7 +81,7 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
* @param cordova
* @param view
*/
public AndroidWebViewClient(CordovaInterface cordova, CordovaWebView view) {
public AndroidWebViewClient(CordovaInterface cordova, AndroidWebView view) {
this.cordova = cordova;
this.appView = view;
}
@ -91,7 +91,7 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
*
* @param view
*/
public void setWebView(CordovaWebView view) {
public void setWebView(AndroidWebView view) {
this.appView = view;
}
@ -483,14 +483,8 @@ public class AndroidWebViewClient extends WebViewClient implements CordovaWebVie
}
@Override
public void onReceivedError(CordovaWebView me, int i, String string,
String 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);
}
public void onReceivedError(int errorCode, String description, String url) {
this.onReceivedError(appView, errorCode, description, url);
}
}

View File

@ -299,8 +299,6 @@ public class CordovaActivity extends Activity implements CordovaInterface {
this.appView.setWebViewClient(webViewClient);
this.appView.setWebChromeClient(webChromeClient);
webViewClient.setWebView(this.appView);
webChromeClient.setWebView(this.appView);
this.appView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,

View File

@ -1,9 +1,5 @@
package org.apache.cordova;
public interface CordovaWebViewClient {
void setWebView(CordovaWebView appView);
void onReceivedError(CordovaWebView me, int i, String string, String url);
void onReceivedError(int errorCode, String description, String url);
}

View File

@ -40,7 +40,7 @@ public class IceCreamCordovaWebViewClient extends AndroidWebViewClient implement
super(cordova);
}
public IceCreamCordovaWebViewClient(CordovaInterface cordova, CordovaWebView view) {
public IceCreamCordovaWebViewClient(CordovaInterface cordova, AndroidWebView view) {
super(cordova, view);
}
@ -97,10 +97,4 @@ public class IceCreamCordovaWebViewClient extends AndroidWebViewClient implement
}
return false;
}
@Override
public void onReceivedError(CordovaWebView me, int i, String string,
String url) {
super.onReceivedError(me, i, string, url);
}
}