You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ia...@apache.org on 2013/07/03 22:39:23 UTC
[3/3] js commit: Use new base64 method for iOS and OSX as well
Use new base64 method for iOS and OSX as well
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0e89b601
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0e89b601
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0e89b601
Branch: refs/heads/master
Commit: 0e89b601a586877a7ff3308f75e41b6360d9ec12
Parents: 5ba835c
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Jul 3 16:34:22 2013 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Jul 3 16:37:40 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/0e89b601/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/0e89b601/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);