cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject [1/4] git commit: CB-6388: Handle binary data correctly in LOAD_URL bridge
Date Thu, 03 Apr 2014 06:07:44 GMT
Repository: cordova-amazon-fireos
Updated Branches:
  refs/heads/master 5e9cb8fbb -> 9375b4103


CB-6388: Handle binary data correctly in LOAD_URL bridge


Project: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/commit/736f44bb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/tree/736f44bb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/diff/736f44bb

Branch: refs/heads/master
Commit: 736f44bbc2c663d1211bba59cfa6479ecd52205d
Parents: c303a63
Author: Ian Clelland <iclelland@chromium.org>
Authored: Wed Apr 2 12:08:27 2014 -0400
Committer: Archana Naik <naika@lab126.com>
Committed: Wed Apr 2 13:31:04 2014 -0700

----------------------------------------------------------------------
 .../apache/cordova/NativeToJsMessageQueue.java   | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-amazon-fireos/blob/736f44bb/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 9b61f98..56c9a55 100755
--- a/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
+++ b/framework/src/org/apache/cordova/NativeToJsMessageQueue.java
@@ -494,9 +494,22 @@ public class NativeToJsMessageQueue {
                   .append(success)
                   .append(",")
                   .append(status)
-                  .append(",[")
-                  .append(pluginResult.getMessage())
-                  .append("],")
+                  .append(",[");
+                switch (pluginResult.getMessageType()) {
+                    case PluginResult.MESSAGE_TYPE_BINARYSTRING:
+                        sb.append("atob('")
+                          .append(pluginResult.getMessage())
+                          .append("')");
+                        break;
+                    case PluginResult.MESSAGE_TYPE_ARRAYBUFFER:
+                        sb.append("cordova.require('cordova/base64').toArrayBuffer('")
+                          .append(pluginResult.getMessage())
+                          .append("')");
+                        break;
+                    default:
+                    sb.append(pluginResult.getMessage());
+                }
+                sb.append("],")
                   .append(pluginResult.getKeepCallback())
                   .append(");");
             }


Mime
View raw message