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 2013/10/22 21:20:04 UTC

[06/16] android commit: [CB-3384] Use the ExposedJsApi to detect webCore thread instead of IceCreamCordovaWebViewClient.

[CB-3384] Use the ExposedJsApi to detect webCore thread instead of IceCreamCordovaWebViewClient.

Also removes a debug log statement.
(cherry picked from commit 6fe18ae0abe137702da2072caa749c83cf326cf5)


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

Branch: refs/heads/2.9.x
Commit: 53e3a124410e8355ba063ab0c4a8c7c0610c1e04
Parents: dd770ef
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jul 16 09:32:29 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 15:11:15 2013 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaResourceApi.java        | 5 ++---
 framework/src/org/apache/cordova/ExposedJsApi.java              | 3 +++
 .../src/org/apache/cordova/IceCreamCordovaWebViewClient.java    | 4 ----
 3 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/53e3a124/framework/src/org/apache/cordova/CordovaResourceApi.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaResourceApi.java b/framework/src/org/apache/cordova/CordovaResourceApi.java
index b891b51..ebf8801 100644
--- a/framework/src/org/apache/cordova/CordovaResourceApi.java
+++ b/framework/src/org/apache/cordova/CordovaResourceApi.java
@@ -26,7 +26,6 @@ import android.database.Cursor;
 import android.net.Uri;
 import android.os.Looper;
 import android.util.Base64;
-import android.util.Base64InputStream;
 
 import com.squareup.okhttp.OkHttpClient;
 
@@ -62,7 +61,7 @@ public class CordovaResourceApi {
     // Creating this is light-weight.
     private static OkHttpClient httpClient = new OkHttpClient();
     
-    static Thread webCoreThread;
+    static Thread jsThread;
 
     private final AssetManager assetManager;
     private final ContentResolver contentResolver;
@@ -294,7 +293,7 @@ public class CordovaResourceApi {
             if (curThread == Looper.getMainLooper().getThread()) {
                 throw new IllegalStateException("Do not perform IO operations on the UI thread. Use CordovaInterface.getThreadPool() instead.");
             }
-            if (curThread == webCoreThread) {
+            if (curThread == jsThread) {
                 throw new IllegalStateException("Tried to perform an IO operation on the WebCore thread. Use CordovaInterface.getThreadPool() instead.");
             }
         }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/53e3a124/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 221dd3d..c3887cf 100755
--- a/framework/src/org/apache/cordova/ExposedJsApi.java
+++ b/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -48,6 +48,9 @@ import org.json.JSONException;
 
         jsMessageQueue.setPaused(true);
         try {
+            // Tell the resourceApi what thread the JS is running on.
+            CordovaResourceApi.jsThread = Thread.currentThread();
+            
             pluginManager.exec(service, action, callbackId, arguments);
             String ret = "";
             if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING) {

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/53e3a124/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
index 317acc2..f0f372c 100644
--- a/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/IceCreamCordovaWebViewClient.java
@@ -27,7 +27,6 @@ import org.apache.cordova.api.LOG;
 import android.annotation.TargetApi;
 import android.net.Uri;
 import android.os.Build;
-import android.util.Log;
 import android.webkit.WebResourceResponse;
 import android.webkit.WebView;
 
@@ -46,9 +45,6 @@ public class IceCreamCordovaWebViewClient extends CordovaWebViewClient {
 
     @Override
     public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
-        // Tell the Thread-Checking resolve what thread the WebCore thread is.
-        CordovaResourceApi.webCoreThread = Thread.currentThread();
-        Log.e("WHAAAA", "FOOD " + CordovaResourceApi.webCoreThread);
         try {
             // Check the against the white-list.
             if ((url.startsWith("http:") || url.startsWith("https:")) && !Config.isUrlWhiteListed(url)) {