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 2014/08/07 22:20:19 UTC

android commit: CB-7261 Fix setNativeToJsBridgeMode sometimes crashing when switching to ONLINE_EVENT

Repository: cordova-android
Updated Branches:
  refs/heads/master 73219bf2d -> 41125ea1e


CB-7261 Fix setNativeToJsBridgeMode sometimes crashing when switching to ONLINE_EVENT


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

Branch: refs/heads/master
Commit: 41125ea1e2ce9bff3191f57d88c10c277cbb3e94
Parents: 73219bf
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Aug 7 16:18:56 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Aug 7 16:18:56 2014 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/NativeToJsMessageQueue.java | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/41125ea1/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 d05eed8..497366f 100755
--- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
+++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
@@ -321,11 +321,16 @@ public class NativeToJsMessageQueue {
                 }
             }
         };
+        final Runnable resetNetworkRunnable = new Runnable() {
+            public void run() {
+                online = false;
+                // If the following call triggers a notifyOfFlush, then ignore it.
+                ignoreNextFlush = true;
+                webView.setNetworkAvailable(true);
+            }
+        };
         @Override void reset() {
-            online = false;
-            // If the following call triggers a notifyOfFlush, then ignore it.
-            ignoreNextFlush = true;
-            webView.setNetworkAvailable(true);
+            cordova.getActivity().runOnUiThread(resetNetworkRunnable);
         }
         @Override void onNativeToJsMessageAvailable() {
             cordova.getActivity().runOnUiThread(toggleNetworkRunnable);