From f577af08864c4503fad5afc7d9ca7b9611ba27ce Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 3 Jul 2014 22:18:18 -0400 Subject: [PATCH] Delete Location-change JS->Native bridge mode It was always disabled, and there's really no reason to keep it around. --- .../org/apache/cordova/CordovaUriHelper.java | 34 +------------------ .../cordova/NativeToJsMessageQueue.java | 4 --- 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/framework/src/org/apache/cordova/CordovaUriHelper.java b/framework/src/org/apache/cordova/CordovaUriHelper.java index 1a113ded..1502a1fa 100644 --- a/framework/src/org/apache/cordova/CordovaUriHelper.java +++ b/framework/src/org/apache/cordova/CordovaUriHelper.java @@ -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; } - - - } diff --git a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java index 063fc7e8..b822800e 100755 --- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java +++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java @@ -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;