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

Also removes a debug log statement.
This commit is contained in:
Andrew Grieve 2013-07-16 09:32:29 -04:00
parent 5c4fa213d1
commit 6fe18ae0ab
3 changed files with 5 additions and 8 deletions

View File

@ -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.");
}
}

View File

@ -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) {

View File

@ -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)) {