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 2014/07/04 04:27:19 UTC

android commit: Delete Location-change JS->Native bridge mode

Repository: cordova-android
Updated Branches:
  refs/heads/master aab47bd45 -> f577af088


Delete Location-change JS->Native bridge mode

It was always disabled, and there's really no reason to keep it around.


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

Branch: refs/heads/master
Commit: f577af08864c4503fad5afc7d9ca7b9611ba27ce
Parents: aab47bd
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jul 3 22:18:18 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jul 3 22:18:18 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaUriHelper.java    | 34 +-------------------
 .../apache/cordova/NativeToJsMessageQueue.java  |  4 ---
 2 files changed, 1 insertion(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f577af08/framework/src/org/apache/cordova/CordovaUriHelper.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaUriHelper.java b/framework/src/org/apache/cordova/CordovaUriHelper.java
index 1a113de..1502a1f 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;
     }
-
-    
-
 }

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/f577af08/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
index 063fc7e..b822800 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;