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/10/22 17:45:13 UTC
[03/25] js commit: Use new base64 method for iOS and OSX as well
(cherry picked from commit 0e89b601a586877a7ff3308f75e41b6360d9ec12)
Use new base64 method for iOS and OSX as well
(cherry picked from commit 0e89b601a586877a7ff3308f75e41b6360d9ec12)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/cf14dda9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/cf14dda9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/cf14dda9
Branch: refs/heads/2.9.x
Commit: cf14dda915b44e1ab4e3e687a77d7ab602c49aa9
Parents: 082a725
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Jul 3 16:34:22 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:34:00 2013 -0400
----------------------------------------------------------------------
lib/ios/exec.js | 9 ++-------
lib/osx/exec.js | 11 +++--------
2 files changed, 5 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/cf14dda9/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index 93269c5..be05e94 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -28,6 +28,7 @@
var cordova = require('cordova'),
channel = require('cordova/channel'),
utils = require('cordova/utils'),
+ base64 = require('cordova/base64'),
jsToNativeModes = {
IFRAME_NAV: 0,
XHR_NO_PAYLOAD: 1,
@@ -69,17 +70,11 @@ function massageArgsJsToNative(args) {
return args;
}
var ret = [];
- var encodeArrayBufferAs8bitString = function(ab) {
- return String.fromCharCode.apply(null, new Uint8Array(ab));
- };
- var encodeArrayBufferAsBase64 = function(ab) {
- return window.btoa(encodeArrayBufferAs8bitString(ab));
- };
args.forEach(function(arg, i) {
if (utils.typeName(arg) == 'ArrayBuffer') {
ret.push({
'CDVType': 'ArrayBuffer',
- 'data': encodeArrayBufferAsBase64(arg)
+ 'data': base64.fromArrayBuffer(arg)
});
} else {
ret.push(arg);
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/cf14dda9/lib/osx/exec.js
----------------------------------------------------------------------
diff --git a/lib/osx/exec.js b/lib/osx/exec.js
index 6eebb7b..811848e 100644
--- a/lib/osx/exec.js
+++ b/lib/osx/exec.js
@@ -26,7 +26,8 @@
*/
var cordova = require('cordova'),
channel = require('cordova/channel'),
- utils = require('cordova/utils');
+ utils = require('cordova/utils'),
+ base64 = require('cordova/base64');
function massageMessageNativeToJs(message) {
@@ -65,17 +66,11 @@ function massageArgsJsToNative(args) {
return args;
}
var ret = [];
- var encodeArrayBufferAs8bitString = function(ab) {
- return String.fromCharCode.apply(null, new Uint8Array(ab));
- };
- var encodeArrayBufferAsBase64 = function(ab) {
- return window.btoa(encodeArrayBufferAs8bitString(ab));
- };
args.forEach(function(arg, i) {
if (utils.typeName(arg) == 'ArrayBuffer') {
ret.push({
'CDVType': 'ArrayBuffer',
- 'data': encodeArrayBufferAsBase64(arg)
+ 'data': base64.fromArrayBuffer(arg)
});
} else {
ret.push(arg);