cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From macdo...@apache.org
Subject [4/11] android commit: Add @JavascriptInterface annotations to ExposedJsApi.
Date Fri, 23 Nov 2012 03:28:59 GMT
Add @JavascriptInterface annotations to ExposedJsApi.

And re-enable the JS bridge on 4.2.
https://issues.apache.org/jira/browse/CB-1879


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

Branch: refs/heads/master
Commit: 11e0ffa90abe3c818887706cc22286cbb4b54742
Parents: 2ee4326
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Nov 22 12:39:18 2012 -0500
Committer: Simon MacDonald <simon.macdonald@gmail.com>
Committed: Thu Nov 22 22:23:51 2012 -0500

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


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/11e0ffa9/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 efd3cf8..4777f25 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -302,10 +302,6 @@ public class CordovaWebView extends WebView {
             Log.i(TAG, "Disabled addJavascriptInterface() bridge callback due to a bug on
the 2.3 emulator");
             return;
         }
-        else if (SDK_INT == Build.VERSION_CODES.JELLY_BEAN_MR1) {            
-            Log.i(TAG, "Disabled addJavascriptInterface() bridge callback for 4.2.  Symbols
are broken, and we can't compile the annotation needed to expose the exec.");
-            return;
-        }
         this.addJavascriptInterface(exposedJsApi, "_cordovaNative");
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/11e0ffa9/framework/src/org/apache/cordova/ExposedJsApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/ExposedJsApi.java b/framework/src/org/apache/cordova/ExposedJsApi.java
index b386a40..a36bb62 100755
--- a/framework/src/org/apache/cordova/ExposedJsApi.java
+++ b/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -18,6 +18,7 @@
 */
 package org.apache.cordova;
 
+import android.webkit.JavascriptInterface;
 import org.apache.cordova.api.PluginManager;
 import org.apache.cordova.api.PluginResult;
 import org.json.JSONException;
@@ -37,6 +38,7 @@ import org.json.JSONException;
         this.jsMessageQueue = jsMessageQueue;
     }
 
+    @JavascriptInterface
     public String exec(String service, String action, String callbackId, String arguments)
throws JSONException {
         jsMessageQueue.setPaused(true);
         try {
@@ -51,10 +53,12 @@ import org.json.JSONException;
         }
     }
     
+    @JavascriptInterface
     public void setNativeToJsBridgeMode(int value) {
         jsMessageQueue.setBridgeMode(value);
     }
     
+    @JavascriptInterface
     public String retrieveJsMessages() {
         return jsMessageQueue.popAndEncode();
     }


Mime
View raw message