Delete Location-change JS->Native bridge mode

It was always disabled, and there's really no reason to keep it around.
This commit is contained in:
Andrew Grieve 2014-07-03 22:18:18 -04:00
parent aab47bd453
commit f577af0886
2 changed files with 1 additions and 37 deletions

View File

@ -19,17 +19,13 @@
package org.apache.cordova;
import org.json.JSONException;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import android.webkit.WebView;
public class CordovaUriHelper {
private static final String TAG = "CordovaUriHelper";
private static final String CORDOVA_EXEC_URL_PREFIX = "http://cdv_exec/";
private CordovaWebView appView;
private CordovaInterface cordova;
@ -40,27 +36,6 @@ public class CordovaUriHelper {
cordova = cdv;
}
// Parses commands sent by setting the webView's URL to:
// cdvbrg:service/action/callbackId#jsonArgs
void handleExecUrl(String url) {
int idx1 = CORDOVA_EXEC_URL_PREFIX.length();
int idx2 = url.indexOf('#', idx1 + 1);
int idx3 = url.indexOf('#', idx2 + 1);
int idx4 = url.indexOf('#', idx3 + 1);
if (idx1 == -1 || idx2 == -1 || idx3 == -1 || idx4 == -1) {
Log.e(TAG, "Could not decode URL command: " + url);
return;
}
String service = url.substring(idx1, idx2);
String action = url.substring(idx2 + 1, idx3);
String callbackId = url.substring(idx3 + 1, idx4);
String jsonArgs = url.substring(idx4 + 1);
appView.pluginManager.exec(service, action, callbackId, jsonArgs);
//There is no reason to not send this directly to the pluginManager
}
/**
* Give the host application a chance to take over the control when a new url
* is about to be loaded in the current WebView.
@ -73,12 +48,8 @@ public class CordovaUriHelper {
// The WebView should support http and https when going on the Internet
if(url.startsWith("http:") || url.startsWith("https:"))
{
// Check if it's an exec() bridge command message.
if (NativeToJsMessageQueue.ENABLE_LOCATION_CHANGE_EXEC_MODE && url.startsWith(CORDOVA_EXEC_URL_PREFIX)) {
handleExecUrl(url);
}
// We only need to whitelist sites on the Internet!
else if(Config.isUrlWhiteListed(url))
if(Config.isUrlWhiteListed(url))
{
return false;
}
@ -106,7 +77,4 @@ public class CordovaUriHelper {
//Default behaviour should be to load the default intent, let's see what happens!
return true;
}
}

View File

@ -39,10 +39,6 @@ public class NativeToJsMessageQueue {
// JS instead of the custom format (useful for benchmarking).
private static final boolean FORCE_ENCODE_USING_EVAL = false;
// Disable URL-based exec() bridge by default since it's a bit of a
// security concern.
static final boolean ENABLE_LOCATION_CHANGE_EXEC_MODE = false;
// Disable sending back native->JS messages during an exec() when the active
// exec() is asynchronous. Set this to true when running bridge benchmarks.
static final boolean DISABLE_EXEC_CHAINING = false;