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 2013/06/21 04:22:12 UTC

[1/2] android commit: Experimental support for X-domain XHRs from non-file URLs

Updated Branches:
  refs/heads/dataresource aefb12951 -> 21246ab73
  refs/heads/master b032dcca1 -> 9946d15f2


Experimental support for X-domain XHRs from non-file URLs


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

Branch: refs/heads/dataresource
Commit: 21246ab73fcf509b4ef872dfc25a3db4bfc7fba4
Parents: aefb129
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jun 18 12:31:55 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Jun 18 12:32:42 2013 -0400

----------------------------------------------------------------------
 .../org/apache/cordova/CordovaChromeClient.java | 25 ++++++++++++++++++++
 .../src/org/apache/cordova/CordovaWebView.java  |  2 +-
 2 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/21246ab7/framework/src/org/apache/cordova/CordovaChromeClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaChromeClient.java b/framework/src/org/apache/cordova/CordovaChromeClient.java
index 4d338a5..bff93b6 100755
--- a/framework/src/org/apache/cordova/CordovaChromeClient.java
+++ b/framework/src/org/apache/cordova/CordovaChromeClient.java
@@ -23,11 +23,13 @@ import org.apache.cordova.api.LOG;
 import org.json.JSONArray;
 import org.json.JSONException;
 
+import android.annotation.SuppressLint;
 import android.annotation.TargetApi;
 import android.app.AlertDialog;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.net.Uri;
+import android.os.Message;
 import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.View;
@@ -37,6 +39,7 @@ import android.webkit.JsPromptResult;
 import android.webkit.JsResult;
 import android.webkit.ValueCallback;
 import android.webkit.WebChromeClient;
+import android.webkit.WebSettings;
 import android.webkit.WebStorage;
 import android.webkit.WebView;
 import android.webkit.GeolocationPermissions.Callback;
@@ -91,7 +94,29 @@ public class CordovaChromeClient extends WebChromeClient {
     public void setWebView(CordovaWebView view) {
         this.appView = view;
     }
+    
+    @SuppressLint("NewApi")
+    public boolean onCreateWindow (WebView view, boolean isDialog, boolean isUserGesture, Message resultMsg) {
+        CordovaActivity act = (CordovaActivity)this.cordova.getActivity();
+        WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
+
+        WebView newWebView = new WebView(act);
+        WebSettings settings = newWebView.getSettings();
+        settings.setJavaScriptEnabled(true);
+        settings.setAllowFileAccess(true);
+        if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.JELLY_BEAN) {
+            settings.setAllowUniversalAccessFromFileURLs(true);
+        }
 
+        //act.root.addView(newWebView, 0);
+        
+        String payload = "<html><script>opener.XMLHttpRequest=XMLHttpRequest</script></html>";
+        newWebView.loadDataWithBaseURL("file:///hi.html", payload, "text/html", "UTF-8", "file:///hi.html");
+        transport.setWebView(newWebView);
+        resultMsg.sendToTarget();
+        return true;
+    }
+    
     /**
      * Tell the client to display a javascript alert dialog.
      *

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/21246ab7/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index e1d1bf1..cae837f 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -234,7 +234,7 @@ public class CordovaWebView extends WebView {
         settings.setJavaScriptEnabled(true);
         settings.setJavaScriptCanOpenWindowsAutomatically(true);
         settings.setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
-        
+        settings.setSupportMultipleWindows(true);
         // Set the nav dump for HTC 2.x devices (disabling for ICS, deprecated entirely for Jellybean 4.2)
         try {
             Method gingerbread_getMethod =  WebSettings.class.getMethod("setNavDump", new Class[] { boolean.class });


[2/2] android commit: Remove PluginManager.exec's return value (unused).

Posted by ag...@apache.org.
Remove PluginManager.exec's return value (unused).

It's not only not used, but when it was used was messing up the
DISABLE_EXEC_CHAINING flag.


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

Branch: refs/heads/master
Commit: 9946d15f2348b8f6a23e589c8916a9410aa4b3da
Parents: b032dcc
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jun 20 22:20:58 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Jun 20 22:20:58 2013 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/ExposedJsApi.java      |  4 ++--
 framework/src/org/apache/cordova/api/PluginManager.java | 12 ++++--------
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9946d15f/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 7702d35..40ab1e3 100755
--- a/framework/src/org/apache/cordova/ExposedJsApi.java
+++ b/framework/src/org/apache/cordova/ExposedJsApi.java
@@ -48,9 +48,9 @@ import org.json.JSONException;
 
         jsMessageQueue.setPaused(true);
         try {
-            boolean wasSync = pluginManager.exec(service, action, callbackId, arguments);
+            pluginManager.exec(service, action, callbackId, arguments);
             String ret = "";
-            if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING || wasSync) {
+            if (!NativeToJsMessageQueue.DISABLE_EXEC_CHAINING) {
                 ret = jsMessageQueue.popAndEncode();
             }
             return ret;

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/9946d15f/framework/src/org/apache/cordova/api/PluginManager.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/PluginManager.java b/framework/src/org/apache/cordova/api/PluginManager.java
index a819107..adaec90 100755
--- a/framework/src/org/apache/cordova/api/PluginManager.java
+++ b/framework/src/org/apache/cordova/api/PluginManager.java
@@ -200,15 +200,14 @@ public class PluginManager {
      *                      this is an async plugin call.
      * @param rawArgs       An Array literal string containing any arguments needed in the
      *                      plugin execute method.
-     * @return Whether the task completed synchronously.
      */
-    public boolean exec(String service, String action, String callbackId, String rawArgs) {
+    public void exec(String service, String action, String callbackId, String rawArgs) {
         CordovaPlugin plugin = this.getPlugin(service);
         if (plugin == null) {
             Log.d(TAG, "exec() call to unknown plugin: " + service);
             PluginResult cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
             app.sendPluginResult(cr, callbackId);
-            return true;
+            return;
         }
         try {
             CallbackContext callbackContext = new CallbackContext(callbackId, app);
@@ -216,19 +215,16 @@ public class PluginManager {
             if (!wasValidAction) {
                 PluginResult cr = new PluginResult(PluginResult.Status.INVALID_ACTION);
                 app.sendPluginResult(cr, callbackId);
-                return true;
             }
-            return callbackContext.isFinished();
         } catch (JSONException e) {
             PluginResult cr = new PluginResult(PluginResult.Status.JSON_EXCEPTION);
             app.sendPluginResult(cr, callbackId);
-            return true;
         }
     }
 
     @Deprecated
-    public boolean exec(String service, String action, String callbackId, String jsonArgs, boolean async) {
-        return exec(service, action, callbackId, jsonArgs);
+    public void exec(String service, String action, String callbackId, String jsonArgs, boolean async) {
+        exec(service, action, callbackId, jsonArgs);
     }
 
     /**