cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] android commit: Fix NPE when POLLING bridge mode is used.
Date Wed, 19 Feb 2014 03:11:52 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master 3a2117c5d -> 448071b02


Fix NPE when POLLING bridge mode is used.


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

Branch: refs/heads/master
Commit: 448071b02d40904de3264bab0dc69ca48ef318e5
Parents: 4dad9d0
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Feb 18 22:11:10 2014 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Feb 18 22:11:38 2014 -0500

----------------------------------------------------------------------
 framework/.settings/org.eclipse.jdt.core.prefs            |  4 ++++
 .../src/org/apache/cordova/NativeToJsMessageQueue.java    | 10 ++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/448071b0/framework/.settings/org.eclipse.jdt.core.prefs
----------------------------------------------------------------------
diff --git a/framework/.settings/org.eclipse.jdt.core.prefs b/framework/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..b080d2d
--- /dev/null
+++ b/framework/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/448071b0/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
index ce8e9b2..dddc022 100755
--- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
+++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
@@ -83,7 +83,7 @@ public class NativeToJsMessageQueue {
         this.cordova = cordova;
         this.webView = webView;
         registeredListeners = new BridgeMode[4];
-        registeredListeners[0] = null;  // Polling. Requires no logic.
+        registeredListeners[0] = new PollingBridgeMode();
         registeredListeners[1] = new LoadUrlBridgeMode();
         registeredListeners[2] = new OnlineEventsBridgeMode();
         registeredListeners[3] = new PrivateApiBridgeMode();
@@ -279,7 +279,13 @@ public class NativeToJsMessageQueue {
         abstract void onNativeToJsMessageAvailable();
         void notifyOfFlush(boolean fromOnlineEvent) {}
     }
-    
+
+    /** Uses JS polls for messages on a timer.. */
+    private class PollingBridgeMode extends BridgeMode {
+        @Override void onNativeToJsMessageAvailable() {
+        }
+    }
+
     /** Uses webView.loadUrl("javascript:") to execute messages. */
     private class LoadUrlBridgeMode extends BridgeMode {
         final Runnable runnable = new Runnable() {


Mime
View raw message