Disable JS Interface on Honeycomb

Fixes https://issues.apache.org/jira/browse/CB-1818
This commit is contained in:
Andrew Grieve 2012-11-13 12:50:15 -05:00
parent e95bde62a2
commit 5212cd4dcd

View File

@ -274,13 +274,15 @@ public class CordovaWebView extends WebView {
}
private void exposeJsInterface() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.GINGERBREAD) {
int SDK_INT = Build.VERSION.SDK_INT;
boolean isHoneycomb = (SDK_INT >= Build.VERSION_CODES.HONEYCOMB && SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR2);
if (isHoneycomb || (SDK_INT < Build.VERSION_CODES.GINGERBREAD)) {
Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
// Bug being that Java Strings do not get converted to JS strings automatically.
// This isn't hard to work-around on the JS side, but it's easier to just
// use the prompt bridge instead.
return;
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && Build.MANUFACTURER.equals("unknown")) {
} else if (SDK_INT < Build.VERSION_CODES.HONEYCOMB && Build.MANUFACTURER.equals("unknown")) {
// addJavascriptInterface crashes on the 2.3 emulator.
Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on the 2.3 emulator");
return;