You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/11/13 18:50:55 UTC

android commit: Disable JS Interface on Honeycomb

Updated Branches:
  refs/heads/master e95bde62a -> 5212cd4dc


Disable JS Interface on Honeycomb

Fixes https://issues.apache.org/jira/browse/CB-1818


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/5212cd4d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/5212cd4d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/5212cd4d

Branch: refs/heads/master
Commit: 5212cd4dcdc195e96e3b376bd44e162e2b0b1b57
Parents: e95bde6
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Nov 13 12:50:15 2012 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Nov 13 12:50:15 2012 -0500

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaWebView.java     |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/5212cd4d/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 4740610..95890b1 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -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;