cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject [2/4] android commit: [CB-3384] Use the ExposedJsApi to detect webCore thread instead of IceCreamCordovaWebViewClient.
Date Tue, 16 Jul 2013 19:16:52 GMT
[CB-3384] Use the ExposedJsApi to detect webCore thread instead of IceCreamCordovaWebViewClient.

Also removes a debug log statement.


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

Branch: refs/heads/3.0.x
Commit: 88b289d8156b24d0d89e0bd1fd07d68958014dae
Parents: 71b19f5
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Jul 16 09:32:29 2013 -0400
Committer: Joe Bowser <bowserj@apache.org>
Committed: Tue Jul 16 11:24:41 2013 -0700

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


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/88b289d8/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/88b289d8/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 7434c2e..23defcb 100755
--- a/framework/src/org/apache/cordova/ExposedJsApi.java
+++ b/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -20,7 +20,6 @@ package org.apache.cordova;
 
 import android.webkit.JavascriptInterface;
 import org.apache.cordova.PluginManager;
-import org.apache.cordova.PluginResult;
 import org.json.JSONException;
 
 /**
@@ -48,6 +47,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/88b289d8/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 d1e632d..519a8ff 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.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))
{


Mime
View raw message