You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2014/04/24 23:36:11 UTC
[1/6] js commit: Fixed "WARNING: file name src\ubuntu\platform.js is
missing the license header" during compile
Repository: cordova-js
Updated Branches:
refs/heads/browserify bcd2ae819 -> 58812ae8f
Fixed "WARNING: file name src\ubuntu\platform.js is missing the license header" during compile
github: close #67
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/a64a94cf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/a64a94cf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/a64a94cf
Branch: refs/heads/browserify
Commit: a64a94cf4217dbf7ec588fb6674a55ca2aa321fd
Parents: 607ca9d
Author: Edward Grech <ed...@uniblue.com>
Authored: Fri Mar 28 15:11:01 2014 +0100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Mar 28 14:24:56 2014 -0400
----------------------------------------------------------------------
src/ubuntu/platform.js | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a64a94cf/src/ubuntu/platform.js
----------------------------------------------------------------------
diff --git a/src/ubuntu/platform.js b/src/ubuntu/platform.js
index 3871545..cf792a2 100644
--- a/src/ubuntu/platform.js
+++ b/src/ubuntu/platform.js
@@ -1,4 +1,5 @@
/*
+ *
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
@@ -17,6 +18,7 @@
* under the License.
*
*/
+
module.exports = {
id: "ubuntu",
bootstrap: function() {
[6/6] js commit: Merge branch 'master' into browserify
Posted by an...@apache.org.
Merge branch 'master' into browserify
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/58812ae8
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/58812ae8
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/58812ae8
Branch: refs/heads/browserify
Commit: 58812ae8f105c98392c687d0e51efd050bebd59c
Parents: bcd2ae8 5a38908
Author: Anis Kadri <an...@apache.org>
Authored: Thu Apr 24 11:27:35 2014 -0700
Committer: Anis Kadri <an...@apache.org>
Committed: Thu Apr 24 11:27:35 2014 -0700
----------------------------------------------------------------------
src/common/base64.js | 10 +++++
src/ios/exec.js | 99 ++++++++++++++++++++++++-------------------
src/ubuntu/platform.js | 2 +
src/windows8/platform.js | 6 +--
src/windowsphone/exec.js | 2 +-
test/test.base64.js | 14 ++++++
6 files changed, 85 insertions(+), 48 deletions(-)
----------------------------------------------------------------------
[3/6] js commit: CB-6388: Add base64.toArrayBuffer() method to
support binary data from the LOAD_URL bridge
Posted by an...@apache.org.
CB-6388: Add base64.toArrayBuffer() method to support binary data from the LOAD_URL bridge
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/53eae163
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/53eae163
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/53eae163
Branch: refs/heads/browserify
Commit: 53eae16307d5d94eb9654f95893e9f4f1816254d
Parents: 81f9a00
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Apr 2 12:09:21 2014 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Wed Apr 2 12:11:31 2014 -0400
----------------------------------------------------------------------
src/common/base64.js | 10 ++++++++++
test/test.base64.js | 14 ++++++++++++++
2 files changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/53eae163/src/common/base64.js
----------------------------------------------------------------------
diff --git a/src/common/base64.js b/src/common/base64.js
index be58f38..5181390 100644
--- a/src/common/base64.js
+++ b/src/common/base64.js
@@ -26,6 +26,16 @@ base64.fromArrayBuffer = function(arrayBuffer) {
return uint8ToBase64(array);
};
+base64.toArrayBuffer = function(str) {
+ var decodedStr = typeof atob != 'undefined' ? atob(str) : new Buffer(str,'base64').toString('binary');
+ var arrayBuffer = new ArrayBuffer(decodedStr.length);
+ var array = new Uint8Array(arrayBuffer);
+ for (var i=0, len=decodedStr.length; i < len; i++) {
+ array[i] = decodedStr.charCodeAt(i);
+ }
+ return arrayBuffer;
+};
+
//------------------------------------------------------------------------------
/* This code is based on the performance tests at http://jsperf.com/b64tests
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/53eae163/test/test.base64.js
----------------------------------------------------------------------
diff --git a/test/test.base64.js b/test/test.base64.js
index 563cff3..6248a36 100644
--- a/test/test.base64.js
+++ b/test/test.base64.js
@@ -60,4 +60,18 @@ describe("base64", function () {
expect(base64.fromArrayBuffer(arrayBuffer)).toBe(base64string);
});
+
+ it("can decode a base64-encoded text string into an ArrayBuffer", function () {
+ var orig = 'Some Awesome Test This Is!',
+ base64string = typeof btoa != 'undefined' ? btoa(orig) : new Buffer(orig, 'binary').toString('base64');
+
+ var arrayBuffer = base64.toArrayBuffer(base64string);
+
+ var testString = "";
+ var view = new Uint8Array(arrayBuffer);
+ for (var i = 0; i < view.byteLength; i++) {
+ testString += String.fromCharCode(view[i]);
+ }
+ expect(testString).toEqual(orig);
+ });
});
[5/6] js commit: CB-5488 ios: Don't attempt iframe bridge until
document.body exists
Posted by an...@apache.org.
CB-5488 ios: Don't attempt iframe bridge until document.body exists
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5a38908f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5a38908f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5a38908f
Branch: refs/heads/browserify
Commit: 5a38908fb54f2ad7dff837810e89e9f6a614cdbf
Parents: b0a18f8
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Apr 22 15:28:34 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Apr 22 15:28:34 2014 -0400
----------------------------------------------------------------------
src/ios/exec.js | 99 +++++++++++++++++++++++++++++-----------------------
1 file changed, 56 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5a38908f/src/ios/exec.js
----------------------------------------------------------------------
diff --git a/src/ios/exec.js b/src/ios/exec.js
index 68b4b03..4855d5c 100644
--- a/src/ios/exec.js
+++ b/src/ios/exec.js
@@ -166,7 +166,7 @@ function iOSExec() {
return;
} catch (e) {}
}
-
+
// If actionArgs is not provided, default to an empty array
actionArgs = actionArgs || [];
@@ -196,50 +196,63 @@ function iOSExec() {
case jsToNativeModes.XHR_NO_PAYLOAD:
case jsToNativeModes.XHR_WITH_PAYLOAD:
case jsToNativeModes.XHR_OPTIONAL_PAYLOAD:
- // This prevents sending an XHR when there is already one being sent.
- // This should happen only in rare circumstances (refer to unit tests).
- if (execXhr && execXhr.readyState != 4) {
- execXhr = null;
- }
- // Re-using the XHR improves exec() performance by about 10%.
- execXhr = execXhr || new XMLHttpRequest();
- // Changing this to a GET will make the XHR reach the URIProtocol on 4.2.
- // For some reason it still doesn't work though...
- // Add a timestamp to the query param to prevent caching.
- execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true);
- if (!vcHeaderValue) {
- vcHeaderValue = /.*\((.*)\)/.exec(navigator.userAgent)[1];
- }
- execXhr.setRequestHeader('vc', vcHeaderValue);
- execXhr.setRequestHeader('rc', ++requestCount);
- if (shouldBundleCommandJson()) {
- execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages());
- }
- execXhr.send(null);
+ pokeNativeViaXhr();
break;
- case jsToNativeModes.IFRAME_HASH_NO_PAYLOAD:
- case jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD:
- execHashIframe = execHashIframe || createHashIframe();
- // Check if they've removed it from the DOM, and put it back if so.
- if (!execHashIframe.contentWindow) {
- execHashIframe = createHashIframe();
- }
- // The delegate method is called only when the hash changes, so toggle it back and forth.
- hashToggle = hashToggle ^ 3;
- var hashValue = '%0' + hashToggle;
- if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) {
- hashValue += iOSExec.nativeFetchMessages();
- }
- execHashIframe.contentWindow.location.hash = hashValue;
- break;
- default:
- execIframe = execIframe || createExecIframe();
- // Check if they've removed it from the DOM, and put it back if so.
- if (!execIframe.contentWindow) {
- execIframe = createExecIframe();
- }
- execIframe.src = "gap://ready";
+ default: // iframe-based.
+ pokeNativeViaIframe();
+ }
+ }
+}
+
+function pokeNativeViaXhr() {
+ // This prevents sending an XHR when there is already one being sent.
+ // This should happen only in rare circumstances (refer to unit tests).
+ if (execXhr && execXhr.readyState != 4) {
+ execXhr = null;
+ }
+ // Re-using the XHR improves exec() performance by about 10%.
+ execXhr = execXhr || new XMLHttpRequest();
+ // Changing this to a GET will make the XHR reach the URIProtocol on 4.2.
+ // For some reason it still doesn't work though...
+ // Add a timestamp to the query param to prevent caching.
+ execXhr.open('HEAD', "/!gap_exec?" + (+new Date()), true);
+ if (!vcHeaderValue) {
+ vcHeaderValue = /.*\((.*)\)/.exec(navigator.userAgent)[1];
+ }
+ execXhr.setRequestHeader('vc', vcHeaderValue);
+ execXhr.setRequestHeader('rc', ++requestCount);
+ if (shouldBundleCommandJson()) {
+ execXhr.setRequestHeader('cmds', iOSExec.nativeFetchMessages());
+ }
+ execXhr.send(null);
+}
+
+function pokeNativeViaIframe() {
+ // CB-5488 - Don't attempt to create iframe before document.body is available.
+ if (!document.body) {
+ setTimeout(pokeNativeViaIframe);
+ return;
+ }
+ if (bridgeMode === jsToNativeModes.IFRAME_HASH_NO_PAYLOAD || bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) {
+ execHashIframe = execHashIframe || createHashIframe();
+ // Check if they've removed it from the DOM, and put it back if so.
+ if (!execHashIframe.contentWindow) {
+ execHashIframe = createHashIframe();
+ }
+ // The delegate method is called only when the hash changes, so toggle it back and forth.
+ hashToggle = hashToggle ^ 3;
+ var hashValue = '%0' + hashToggle;
+ if (bridgeMode === jsToNativeModes.IFRAME_HASH_WITH_PAYLOAD) {
+ hashValue += iOSExec.nativeFetchMessages();
+ }
+ execHashIframe.contentWindow.location.hash = hashValue;
+ } else {
+ execIframe = execIframe || createExecIframe();
+ // Check if they've removed it from the DOM, and put it back if so.
+ if (!execIframe.contentWindow) {
+ execIframe = createExecIframe();
}
+ execIframe.src = "gap://ready";
}
}
[2/6] js commit: CB-5606 WP8. ArrayBuffer does not exist in WP7
Posted by an...@apache.org.
CB-5606 WP8. ArrayBuffer does not exist in WP7
github: close #65
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/81f9a00a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/81f9a00a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/81f9a00a
Branch: refs/heads/browserify
Commit: 81f9a00ae27351350008bb84236635065cf124e8
Parents: a64a94c
Author: Edwin <ed...@service2media.com>
Authored: Tue Feb 25 10:32:29 2014 +0100
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Mar 28 14:26:11 2014 -0400
----------------------------------------------------------------------
src/windowsphone/exec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/81f9a00a/src/windowsphone/exec.js
----------------------------------------------------------------------
diff --git a/src/windowsphone/exec.js b/src/windowsphone/exec.js
index 5317459..548f410 100644
--- a/src/windowsphone/exec.js
+++ b/src/windowsphone/exec.js
@@ -48,7 +48,7 @@ module.exports = function(success, fail, service, action, args) {
for(var n = 0; n < args.length; n++)
{
// special case for ArrayBuffer which could not be stringified out of the box
- if(args[n] instanceof ArrayBuffer)
+ if(typeof ArrayBuffer !== "undefined" && args[n] instanceof ArrayBuffer)
{
args[n] = base64.fromArrayBuffer(args[n]);
}
[4/6] js commit: CB-6419 pause and resume events should be fired
without a timeout
Posted by an...@apache.org.
CB-6419 pause and resume events should be fired without a timeout
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/b0a18f81
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/b0a18f81
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/b0a18f81
Branch: refs/heads/browserify
Commit: b0a18f81c3237a36b4a5c92a0ebc68b8ed9e8682
Parents: 53eae16
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Apr 8 14:50:12 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Apr 8 14:50:12 2014 -0700
----------------------------------------------------------------------
src/windows8/platform.js | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b0a18f81/src/windows8/platform.js
----------------------------------------------------------------------
diff --git a/src/windows8/platform.js b/src/windows8/platform.js
index 67a564c..fc82161 100755
--- a/src/windows8/platform.js
+++ b/src/windows8/platform.js
@@ -33,11 +33,11 @@ module.exports = {
var onWinJSReady = function () {
var app = WinJS.Application;
var checkpointHandler = function checkpointHandler() {
- cordova.fireDocumentEvent('pause');
+ cordova.fireDocumentEvent('pause',null,true);
};
var resumingHandler = function resumingHandler() {
- cordova.fireDocumentEvent('resume');
+ cordova.fireDocumentEvent('resume',null,true);
};
app.addEventListener("checkpoint", checkpointHandler);
@@ -52,8 +52,6 @@ module.exports = {
scriptElem.src = "//Microsoft.WinJS.1.0/js/base.js";
scriptElem.addEventListener("load", onWinJSReady);
document.head.appendChild(scriptElem);
-
- console.log("added WinJS ... ");
}
else {
onWinJSReady();