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:11 UTC
[01/25] js commit: [CB-4004] Add base64 encoding utility function
(cherry picked from commit ff218213e141c7a42f0ee6b7bce30ef4858f016f)
Updated Branches:
refs/heads/2.9.x c01c1730e -> af4bcf4b4
[CB-4004] Add base64 encoding utility function
(cherry picked from commit ff218213e141c7a42f0ee6b7bce30ef4858f016f)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/a750db71
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/a750db71
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/a750db71
Branch: refs/heads/2.9.x
Commit: a750db71bc13383c55029e43bf41d1701953ea51
Parents: c01c173
Author: Ian Clelland <ic...@chromium.org>
Authored: Wed Jul 3 16:33:07 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:33:45 2013 -0400
----------------------------------------------------------------------
lib/common/base64.js | 71 +++++++++++++++++++++++++++++++++++++++++++++++
test/test.base64.js | 50 +++++++++++++++++++++++++++++++++
2 files changed, 121 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a750db71/lib/common/base64.js
----------------------------------------------------------------------
diff --git a/lib/common/base64.js b/lib/common/base64.js
new file mode 100644
index 0000000..38426e6
--- /dev/null
+++ b/lib/common/base64.js
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var base64 = exports;
+
+base64.fromArrayBuffer = function(arrayBuffer) {
+ var array = new Uint8Array(arrayBuffer);
+ return uint8ToBase64(array);
+};
+
+//------------------------------------------------------------------------------
+
+/* This code is based on the performance tests at http://jsperf.com/b64tests
+ * This 12-bit-at-a-time algorithm was the best performing version on all
+ * platforms tested.
+ */
+
+var b64_6bit = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+var b64_12bit;
+
+var b64_12bitTable = function() {
+ b64_12bit = [];
+ for (var i=0; i<64; i++) {
+ for (var j=0; j<64; j++) {
+ b64_12bit[i*64+j] = b64_6bit[i] + b64_6bit[j];
+ }
+ }
+ b64_12bitTable = function() { return b64_12bit; };
+ return b64_12bit;
+}
+
+function uint8ToBase64(rawData) {
+ var numBytes = rawData.byteLength;
+ var output="";
+ var segment;
+ var table = b64_12bitTable();
+ for (var i=0;i<numBytes-2;i+=3) {
+ segment = (rawData[i] << 16) + (rawData[i+1] << 8) + rawData[i+2];
+ output += table[segment >> 12];
+ output += table[segment & 0xfff];
+ }
+ if (numBytes - i == 2) {
+ segment = (rawData[i] << 16) + (rawData[i+1] << 8);
+ output += table[segment >> 12];
+ output += b64_6bit[(segment & 0xfff) >> 6];
+ output += '=';
+ } else if (numBytes - i == 1) {
+ segment = (rawData[i] << 16);
+ output += table[segment >> 12];
+ output += '==';
+ }
+ return output;
+}
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a750db71/test/test.base64.js
----------------------------------------------------------------------
diff --git a/test/test.base64.js b/test/test.base64.js
new file mode 100644
index 0000000..666cafe
--- /dev/null
+++ b/test/test.base64.js
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+describe("base64", function () {
+ var base64 = require('cordova/base64');
+
+ it("can base64 encode strings correctly", function () {
+ var arrayBuffer = new ArrayBuffer(6),
+ view = new Uint8Array(arrayBuffer);
+ for (var i = 0; i < view.length; i++) {
+ view[i] = i;
+ }
+ expect(base64.fromArrayBuffer(arrayBuffer.slice(0,1))).toBe('AA==');
+ expect(base64.fromArrayBuffer(arrayBuffer.slice(0,2))).toBe('AAE=');
+ expect(base64.fromArrayBuffer(arrayBuffer.slice(0,3))).toBe('AAEC');
+ expect(base64.fromArrayBuffer(arrayBuffer.slice(0,4))).toBe('AAECAw==');
+ expect(base64.fromArrayBuffer(arrayBuffer.slice(0,5))).toBe('AAECAwQ=');
+ expect(base64.fromArrayBuffer(arrayBuffer)).toBe('AAECAwQF');
+ });
+
+ it("can base64 encode a binary string in an ArrayBuffer", function () {
+ var arrayBuffer = new ArrayBuffer(256),
+ view = new Uint8Array(arrayBuffer);
+ base64string = 'AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3BxcnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmqq6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w=='
+
+ for (var i = 0; i < view.length; i++) {
+ view[i] = i;
+ }
+
+ expect(base64.fromArrayBuffer(arrayBuffer)).toBe(base64string);
+ });
+});
[17/25] js commit: [CB-4420] Add a helper function for resolving
relative URLs.
Posted by ag...@apache.org.
[CB-4420] Add a helper function for resolving relative URLs.
Note that the tests required a newer version of jsdom.
(cherry picked from commit 2ec92f7b412a3bda84e44f156b9b371c9f94a501)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/808d3da5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/808d3da5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/808d3da5
Branch: refs/heads/2.9.x
Commit: 808d3da5129bd7fbc57aa7ff70dcd884a9f052d7
Parents: c72e321
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Jul 29 15:22:49 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:37:33 2013 -0400
----------------------------------------------------------------------
lib/common/urlutil.js | 32 +++++++++++++++++++++++
package.json | 2 +-
test/runner.js | 2 +-
test/test.urlutil.js | 65 ++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 99 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/808d3da5/lib/common/urlutil.js
----------------------------------------------------------------------
diff --git a/lib/common/urlutil.js b/lib/common/urlutil.js
new file mode 100644
index 0000000..4741a51
--- /dev/null
+++ b/lib/common/urlutil.js
@@ -0,0 +1,32 @@
+/*
+ *
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var urlutil = exports;
+var anchorEl = document.createElement('a');
+
+/**
+ * For already absolute URLs, returns what is passed in.
+ * For relative URLs, converts them to absolute ones.
+ */
+urlutil.makeAbsolute = function(url) {
+ anchorEl.href = url;
+ return anchorEl.href;
+};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/808d3da5/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index f0a82de..b81f0f5 100644
--- a/package.json
+++ b/package.json
@@ -54,7 +54,7 @@
}
],
"dependencies": {
- "jsdom": "0.2.14",
+ "jsdom": "0.8.2",
"connect": "1.8.5"
},
"devDependencies": {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/808d3da5/test/runner.js
----------------------------------------------------------------------
diff --git a/test/runner.js b/test/runner.js
index 6ca0c01..0005731 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -49,7 +49,7 @@ module.exports = {
try {
jsdom = require("jsdom").jsdom;
- document = jsdom("<html><head></head></html>");
+ document = jsdom(null, null, { url: 'http://jsdomtest.info/a?b#c' });
window = document.createWindow();
} catch (e) {
//no jsDom (some people don't have compilers)
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/808d3da5/test/test.urlutil.js
----------------------------------------------------------------------
diff --git a/test/test.urlutil.js b/test/test.urlutil.js
new file mode 100644
index 0000000..c4f9acb
--- /dev/null
+++ b/test/test.urlutil.js
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+describe('urlutil', function () {
+ var urlutil = require('cordova/urlutil');
+
+ it('can handle absolute URLs', function () {
+ expect(urlutil.makeAbsolute('http://www.foo.com')).toBe('http://www.foo.com/');
+ expect(urlutil.makeAbsolute('http://www.foo.com?foo#bar')).toBe('http://www.foo.com/?foo#bar');
+ expect(urlutil.makeAbsolute('http://www.foo.com/%20hi')).toBe('http://www.foo.com/%20hi');
+ });
+
+ function testRootRelative(url) {
+ var rootUrl = url.slice(0, 10) + url.slice(10).replace(/[?#].*/, '').replace(/\/.*/, '') + '/';
+ expect(urlutil.makeAbsolute('/')).toBe(rootUrl);
+ expect(urlutil.makeAbsolute('/foo?a#b')).toBe(rootUrl + 'foo?a#b');
+ expect(urlutil.makeAbsolute('/foo/b%20ar')).toBe(rootUrl + 'foo/b%20ar');
+ }
+ it('can handle root-relative URLs', function () {
+ testRootRelative(window.location.href);
+ });
+
+ it('can handle relative URLs', function () {
+ var rootUrl = window.location.href.replace(/[?#].*/, '').replace(/[^\/]*$/, '');
+ expect(urlutil.makeAbsolute('foo?a#b')).toBe(rootUrl + 'foo?a#b');
+ expect(urlutil.makeAbsolute('foo/b%20ar')).toBe(rootUrl + 'foo/b%20ar');
+ });
+
+ it('can handle relative URLs with base tags', function () {
+ var rootUrl = 'http://base.com/esab/';
+ var baseTag = document.createElement('base');
+ baseTag.href = rootUrl;
+ document.head.appendChild(baseTag);
+ this.after(function() {
+ document.head.removeChild(baseTag);
+ });
+ expect(urlutil.makeAbsolute('foo?a#b')).toBe(rootUrl + 'foo?a#b');
+ expect(urlutil.makeAbsolute('foo/b%20ar')).toBe(rootUrl + 'foo/b%20ar');
+ testRootRelative(rootUrl);
+ });
+
+ it('can handle scheme-relative URLs', function () {
+ var rootUrl = window.location.href.replace(/:.*/, '');
+ expect(urlutil.makeAbsolute('//www.foo.com/baz%20?foo#bar')).toBe(rootUrl + '://www.foo.com/baz%20?foo#bar');
+ });
+
+});
[21/25] js commit: [all] [CB-4725] Export cordova version as
"cordova.version" (cherry picked from commit
e2942e162e1db06446d44d0b814ba450eb22a028)
Posted by ag...@apache.org.
[all] [CB-4725] Export cordova version as "cordova.version"
(cherry picked from commit e2942e162e1db06446d44d0b814ba450eb22a028)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/6e6ff82f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/6e6ff82f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/6e6ff82f
Branch: refs/heads/2.9.x
Commit: 6e6ff82ff0f4381232d5c61c2f21b82af9671875
Parents: 257ab55
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 3 09:42:54 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:41:23 2013 -0400
----------------------------------------------------------------------
lib/cordova.js | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/6e6ff82f/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index c6a37fd..7c717dd 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -113,6 +113,7 @@ if(typeof window.console.warn === "undefined") {
var cordova = {
define:define,
require:require,
+ version:CORDOVA_JS_BUILD_LABEL,
/**
* Methods to add/remove your own addEventListener hijacking on document + window.
*/
[03/25] js commit: Use new base64 method for iOS and OSX as well
(cherry picked from commit 0e89b601a586877a7ff3308f75e41b6360d9ec12)
Posted by ag...@apache.org.
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);
[09/25] js commit: [All] remove mistaken windows only debug message
(cherry picked from commit 52ce7be6dc835f83c324cd01c7539a1d164e8b5d)
Posted by ag...@apache.org.
[All] remove mistaken windows only debug message
(cherry picked from commit 52ce7be6dc835f83c324cd01c7539a1d164e8b5d)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d3ba335b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d3ba335b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d3ba335b
Branch: refs/heads/2.9.x
Commit: d3ba335b83e5a153c2cf6c1ceb2e09c95116faed
Parents: e4193f9
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Jul 9 21:54:42 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:45 2013 -0400
----------------------------------------------------------------------
lib/cordova.js | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d3ba335b/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 0a566bb..5e4e1b4 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -99,7 +99,6 @@ function createEvent(type, data) {
}
if(typeof window.console === "undefined") {
- window.external.Notify("console was undefined, in cordova.js fixing it.");
window.console = {
log:function(){}
};
[15/25] jshint cleanup (sorry im ocd) (cherry picked from commit
d716e31b39bd39a06f1db80040e2c8a6a78a34e8)
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/Notification.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Notification.js b/lib/tizen/plugin/tizen/Notification.js
index a14834f..2010b0e 100644
--- a/lib/tizen/plugin/tizen/Notification.js
+++ b/lib/tizen/plugin/tizen/Notification.js
@@ -121,12 +121,12 @@ module.exports = {
};
}
- for (index in buttonsArray) {
- console.log ("index: ", index);
+ for (index in buttonsArray) {
+ console.log ("index: ", index);
- element = document.getElementById("popup-button-" + buttonsArray[index]);
- element.addEventListener("click", createListener(element), false);
- }
+ element = document.getElementById("popup-button-" + buttonsArray[index]);
+ element.addEventListener("click", createListener(element), false);
+ }
},
prompt: function (message, promptCallback, title, buttonLabels) {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/webos/plugin/webos/camera.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/camera.js b/lib/webos/plugin/webos/camera.js
index 0288293..a8e993a 100644
--- a/lib/webos/plugin/webos/camera.js
+++ b/lib/webos/plugin/webos/camera.js
@@ -28,8 +28,8 @@ module.exports = {
service.Request('palm://com.palm.applicationManager', {
method: 'launch',
parameters: {
- id: 'com.palm.app.camera',
- params: {
+ id: 'com.palm.app.camera',
+ params: {
appId: 'com.palm.app.camera',
name: 'capture',
sublaunch: true,
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/webos/plugin/webos/notification.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/notification.js b/lib/webos/plugin/webos/notification.js
index d65c102..01b8b5e 100644
--- a/lib/webos/plugin/webos/notification.js
+++ b/lib/webos/plugin/webos/notification.js
@@ -87,9 +87,9 @@ module.exports = {
//the intensity for palm is inverted; 0=high intensity, 100=low intensity
//this is opposite from our api, so we invert
if (isNaN(intensity) || intensity > 100 || intensity <= 0)
- intensity = 0;
+ intensity = 0;
else
- intensity = 100 - intensity;
+ intensity = 100 - intensity;
// if the app id does not have the namespace "com.palm.", an error will be thrown here
//this.vibhandle = new Mojo.Service.Request("palm://com.palm.vibrate", {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/webos/plugin/webos/orientation.js
----------------------------------------------------------------------
diff --git a/lib/webos/plugin/webos/orientation.js b/lib/webos/plugin/webos/orientation.js
index 25ed3ad..3c05d9b 100644
--- a/lib/webos/plugin/webos/orientation.js
+++ b/lib/webos/plugin/webos/orientation.js
@@ -29,6 +29,6 @@ module.exports = {
* orientation is one of 'up', 'down', 'left', 'right', or 'free'
*/
getCurrentOrientation: function() {
- return PalmSystem.windowOrientation;
+ return PalmSystem.windowOrientation;
}
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/windows8/plugin/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/FileProxy.js b/lib/windows8/plugin/windows8/FileProxy.js
index fba3b83..717f143 100644
--- a/lib/windows8/plugin/windows8/FileProxy.js
+++ b/lib/windows8/plugin/windows8/FileProxy.js
@@ -302,59 +302,59 @@ module.exports = {
var fullPath = args[0];
Windows.Storage.StorageFolder.getFolderFromPathAsync(fullPath).done(function (storageFolder) {
- var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
- var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
+ var storageFolderPer = Windows.Storage.ApplicationData.current.localFolder;
+ var storageFolderTem = Windows.Storage.ApplicationData.current.temporaryFolder;
- if (storageFolder.path == storageFolderPer.path || storageFolder.path == storageFolderTem.path) {
- fail && fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
- return;
- }
+ if (storageFolder.path == storageFolderPer.path || storageFolder.path == storageFolderTem.path) {
+ fail && fail(FileError.NO_MODIFICATION_ALLOWED_ERR);
+ return;
+ }
- var removeFolders = function (path) {
- return new WinJS.Promise(function (complete) {
- var filePromiseArr = [];
- var storageFolderTop = null;
- Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
- function (storageFolder) {
- var fileListPromise = storageFolder.createFileQuery().getFilesAsync();
+ var removeFolders = function (path) {
+ return new WinJS.Promise(function (complete) {
+ var filePromiseArr = [];
+ var storageFolderTop = null;
+ Windows.Storage.StorageFolder.getFolderFromPathAsync(path).then(
+ function (storageFolder) {
+ var fileListPromise = storageFolder.createFileQuery().getFilesAsync();
- storageFolderTop = storageFolder;
- return fileListPromise;
- }
- // remove all the files directly under the folder.
- ).then(function (fileList) {
- if (fileList !== null) {
- for (var i = 0; i < fileList.length; i++) {
- var filePromise = fileList[i].deleteAsync();
- filePromiseArr.push(filePromise);
+ storageFolderTop = storageFolder;
+ return fileListPromise;
}
- }
- WinJS.Promise.join(filePromiseArr).then(function () {
- var folderListPromise = storageFolderTop.createFolderQuery().getFoldersAsync();
- return folderListPromise;
- // remove empty folders.
- }).then(function (folderList) {
- var folderPromiseArr = [];
- if (folderList.length !== 0) {
- for (var j = 0; j < folderList.length; j++) {
-
- folderPromiseArr.push(removeFolders(folderList[j].path));
+ // remove all the files directly under the folder.
+ ).then(function (fileList) {
+ if (fileList !== null) {
+ for (var i = 0; i < fileList.length; i++) {
+ var filePromise = fileList[i].deleteAsync();
+ filePromiseArr.push(filePromise);
}
- WinJS.Promise.join(folderPromiseArr).then(function () {
- storageFolderTop.deleteAsync().then(complete);
- });
- } else {
- storageFolderTop.deleteAsync().then(complete);
}
+ WinJS.Promise.join(filePromiseArr).then(function () {
+ var folderListPromise = storageFolderTop.createFolderQuery().getFoldersAsync();
+ return folderListPromise;
+ // remove empty folders.
+ }).then(function (folderList) {
+ var folderPromiseArr = [];
+ if (folderList.length !== 0) {
+ for (var j = 0; j < folderList.length; j++) {
+
+ folderPromiseArr.push(removeFolders(folderList[j].path));
+ }
+ WinJS.Promise.join(folderPromiseArr).then(function () {
+ storageFolderTop.deleteAsync().then(complete);
+ });
+ } else {
+ storageFolderTop.deleteAsync().then(complete);
+ }
+ }, function () { });
}, function () { });
- }, function () { });
- });
- };
- removeFolders(storageFolder.path).then(function () {
- Windows.Storage.StorageFolder.getFolderFromPathAsync(storageFolder.path).then(
- function () {},
- function () {
- if (typeof successCallback !== 'undefined' && successCallback !== null) { successCallback(); }
+ });
+ };
+ removeFolders(storageFolder.path).then(function () {
+ Windows.Storage.StorageFolder.getFolderFromPathAsync(storageFolder.path).then(
+ function () {},
+ function () {
+ if (typeof successCallback !== 'undefined' && successCallback !== null) { successCallback(); }
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/windows8/plugin/windows8/console.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/console.js b/lib/windows8/plugin/windows8/console.js
index f53297a..a71a2c5 100644
--- a/lib/windows8/plugin/windows8/console.js
+++ b/lib/windows8/plugin/windows8/console.js
@@ -40,7 +40,7 @@ if(!console || !console.log)
}
else if(console && console.log) {
- console.log("console.log exists already!");
- console.warn = console.warn || function(msg){console.log("warn:"+msg);};
- console.error = console.error || function(msg){console.log("error:"+msg);};
+ console.log("console.log exists already!");
+ console.warn = console.warn || function(msg){console.log("warn:"+msg);};
+ console.error = console.error || function(msg){console.log("error:"+msg);};
}
[08/25] js commit: Fix a failure case in pluginloader where an
onerror callback was not being set.
Posted by ag...@apache.org.
Fix a failure case in pluginloader where an onerror callback was not being set.
Probably is never triggered... Might as well though.
(cherry picked from commit c2a6ba1cb8c7d004b44bb6b825017f30bf403d54)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/e4193f9c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/e4193f9c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/e4193f9c
Branch: refs/heads/2.9.x
Commit: e4193f9c6f769f9ab719980337a26ee756e8d039
Parents: a1ff039
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jul 9 23:03:06 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:37 2013 -0400
----------------------------------------------------------------------
lib/common/pluginloader.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e4193f9c/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
index 4b5955d..7341e14 100644
--- a/lib/common/pluginloader.js
+++ b/lib/common/pluginloader.js
@@ -38,7 +38,7 @@ function injectScript(url, onload, onerror) {
var script = document.createElement("script");
// onload fires even when script fails loads with an error.
script.onload = onload;
- script.onerror = onerror;
+ script.onerror = onerror || onload;
script.src = url;
document.head.appendChild(script);
}
[10/25] js commit: [all] Fix pluginloader never finishing (broken by
recent commit) (cherry picked from commit
553681f0adf55c8928be8d72164f22e17323f496)
Posted by ag...@apache.org.
[all] Fix pluginloader never finishing (broken by recent commit)
(cherry picked from commit 553681f0adf55c8928be8d72164f22e17323f496)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5f9b6705
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5f9b6705
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5f9b6705
Branch: refs/heads/2.9.x
Commit: 5f9b67050ecbbb86d72bc5a2003d2f7a0cdd6644
Parents: d3ba335
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Jul 10 11:38:25 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:54 2013 -0400
----------------------------------------------------------------------
lib/common/pluginloader.js | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5f9b6705/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
index 7341e14..002f944 100644
--- a/lib/common/pluginloader.js
+++ b/lib/common/pluginloader.js
@@ -22,19 +22,8 @@
var channel = require('cordova/channel');
var modulemapper = require('cordova/modulemapper');
-var scriptCounter = 0;
-var moduleList = null;
-
-function scriptLoadedCallback() {
- scriptCounter--;
- if (scriptCounter === 0) {
- onScriptLoadingComplete();
- }
-}
-
// Helper function to inject a <script> tag.
function injectScript(url, onload, onerror) {
- scriptCounter++;
var script = document.createElement("script");
// onload fires even when script fails loads with an error.
script.onload = onload;
@@ -43,10 +32,9 @@ function injectScript(url, onload, onerror) {
document.head.appendChild(script);
}
-function onScriptLoadingComplete() {
+function onScriptLoadingComplete(moduleList) {
// Loop through all the plugins and then through their clobbers and merges.
- for (var i = 0; i < moduleList.length; i++) {
- var module = moduleList[i];
+ for (var i = 0, module; module = moduleList[i]; i++) {
if (module) {
try {
if (module.clobbers && module.clobbers.length) {
@@ -88,8 +76,15 @@ function finishPluginLoading() {
// See plugman's plugin_loader.js for the details of this object.
// This function is only called if the really is a plugins array that isn't empty.
// Otherwise the onerror response handler will just call finishPluginLoading().
-function handlePluginsObject(path) {
+function handlePluginsObject(path, moduleList) {
// Now inject the scripts.
+ var scriptCounter = moduleList.length;
+ function scriptLoadedCallback() {
+ if (!--scriptCounter) {
+ onScriptLoadingComplete(moduleList);
+ }
+ }
+
for (var i = 0; i < moduleList.length; i++) {
injectScript(path + moduleList[i].file, scriptLoadedCallback);
}
@@ -98,8 +93,8 @@ function handlePluginsObject(path) {
function injectPluginScript(pathPrefix) {
injectScript(pathPrefix + 'cordova_plugins.js', function(){
try {
- moduleList = require("cordova/plugin_list");
- handlePluginsObject(pathPrefix);
+ var moduleList = require("cordova/plugin_list");
+ handlePluginsObject(pathPrefix, moduleList);
} catch (e) {
// Error loading cordova_plugins.js, file not found or something
// this is an acceptable error, pre-3.0.0, so we just move on.
[04/25] js commit: Change plugin_loader.js into a regular module that
is called from bootstrap
Posted by ag...@apache.org.
Change plugin_loader.js into a regular module that is called from bootstrap
Instead of being hardcoded into packager.js.
(cherry picked from commit 5686a320aa690e52b2c363cba1f8792112088f52)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5f976d4e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5f976d4e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5f976d4e
Branch: refs/heads/2.9.x
Commit: 5f976d4e435d1ddba21ca38be00179ba1d7d8a3b
Parents: cf14dda
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jul 5 09:53:53 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:00 2013 -0400
----------------------------------------------------------------------
build/packager.js | 10 ---
lib/common/pluginloader.js | 164 +++++++++++++++++++++++++++++++++++
lib/scripts/bootstrap.js | 6 ++
lib/scripts/plugin_loader.js | 178 --------------------------------------
4 files changed, 170 insertions(+), 188 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5f976d4e/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index d859636..5026fbd 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -160,16 +160,6 @@ packager.bundle = function(platform, debug, commitId) {
writeScript(output, scripts[bootstrapPlatform], debug)
}
- // Include the plugin loading code.
- if (platform !== 'test') {
- // NB: This should probably run last of all, and definitely after the bootstrap.
- if (!scripts['plugin_loader']) {
- throw new Error("didn't find a script for 'plugin_loader'");
- }
-
- writeScript(output, scripts['plugin_loader'], debug);
- }
-
// write trailer
output.push('})();')
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5f976d4e/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
new file mode 100644
index 0000000..764aa90
--- /dev/null
+++ b/lib/common/pluginloader.js
@@ -0,0 +1,164 @@
+/*
+ *
+ * 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
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var channel = require('cordova/channel');
+var modulemapper = require('cordova/modulemapper');
+
+var scriptCounter = 0;
+var moduleList = null;
+
+function scriptLoadedCallback() {
+ scriptCounter--;
+ if (scriptCounter === 0) {
+ onScriptLoadingComplete();
+ }
+}
+
+// Helper function to inject a <script> tag.
+function injectScript(url, onload) {
+ scriptCounter++;
+ var script = document.createElement("script");
+ // onload fires even when script fails loads with an error.
+ script.onload = onload;
+ script.src = url;
+ document.head.appendChild(script);
+}
+
+function onScriptLoadingComplete() {
+ // Loop through all the plugins and then through their clobbers and merges.
+ for (var i = 0; i < moduleList.length; i++) {
+ var module = moduleList[i];
+ if (module) {
+ try {
+ if (module.clobbers && module.clobbers.length) {
+ for (var j = 0; j < module.clobbers.length; j++) {
+ modulemapper.clobbers(module.id, module.clobbers[j]);
+ }
+ }
+
+ if (module.merges && module.merges.length) {
+ for (var k = 0; k < module.merges.length; k++) {
+ modulemapper.merges(module.id, module.merges[k]);
+ }
+ }
+
+ // Finally, if runs is truthy we want to simply require() the module.
+ // This can be skipped if it had any merges or clobbers, though,
+ // since the mapper will already have required the module.
+ if (module.runs && !(module.clobbers && module.clobbers.length) && !(module.merges && module.merges.length)) {
+ require(module.id);
+ }
+ }
+ catch(err) {
+ // error with module, most likely clobbers, should we continue?
+ }
+ }
+ }
+
+ finishPluginLoading();
+}
+
+// Called when:
+// * There are plugins defined and all plugins are finished loading.
+// * There are no plugins to load.
+function finishPluginLoading() {
+ channel.onPluginsReady.fire();
+}
+
+// Handler for the cordova_plugins.js content.
+// See plugman's plugin_loader.js for the details of this object.
+// This function is only called if the really is a plugins array that isn't empty.
+// Otherwise the onerror response handler will just call finishPluginLoading().
+function handlePluginsObject(path) {
+ // Now inject the scripts.
+ for (var i = 0; i < moduleList.length; i++) {
+ injectScript(path + moduleList[i].file, scriptLoadedCallback);
+ }
+}
+
+function injectPluginScript(pathPrefix) {
+ injectScript(pathPrefix + 'cordova_plugins.js', function(){
+ try {
+ moduleList = require("cordova/plugin_list");
+ handlePluginsObject(pathPrefix);
+ } catch (e) {
+ // Error loading cordova_plugins.js, file not found or something
+ // this is an acceptable error, pre-3.0.0, so we just move on.
+ finishPluginLoading();
+ }
+ });
+}
+
+function findCordovaPath() {
+ var path = null;
+ var scripts = document.getElementsByTagName('script');
+ var term = 'cordova.js';
+ for (var n = scripts.length-1; n>-1; n--) {
+ var src = scripts[n].src;
+ if (src.indexOf(term) == (src.length - term.length)) {
+ path = src.substring(0, src.length - term.length);
+ break;
+ }
+ }
+ return path;
+}
+
+// Tries to load all plugins' js-modules.
+// This is an async process, but onDeviceReady is blocked on onPluginsReady.
+// onPluginsReady is fired when there are no plugins to load, or they are all done.
+exports.load = function() {
+ var pathPrefix = findCordovaPath();
+ if (pathPrefix === null) {
+ console.warn('Could not find cordova.js script tag. Plugin loading may fail.');
+ pathPrefix = '';
+ }
+
+ // Try to XHR the cordova_plugins.json file asynchronously.
+ var xhr = new XMLHttpRequest();
+ xhr.onload = function() {
+ // If the response is a JSON string which composes an array, call handlePluginsObject.
+ // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
+ var obj;
+ try {
+ obj = (this.status === 0 || this.status === 200) && this.responseText && JSON.parse(this.responseText);
+ } catch (err) {
+ // obj will be undefined.
+ }
+ if (Array.isArray(obj) && obj.length > 0) {
+ moduleList = obj;
+ handlePluginsObject(pathPrefix);
+ } else {
+ finishPluginLoading();
+ }
+ };
+ xhr.onerror = function() {
+ // One some phones (Windows) this xhr.open throws an Access Denied exception
+ // So lets keep trying, but with a script tag injection technique instead of XHR
+ injectPluginScript(pathPrefix);
+ };
+ try {
+ xhr.open('GET', pathPrefix + 'cordova_plugins.json', true); // Async
+ xhr.send();
+ } catch(err){
+ injectPluginScript(pathPrefix);
+ }
+};
+
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5f976d4e/lib/scripts/bootstrap.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap.js b/lib/scripts/bootstrap.js
index 47c3179..27d653c 100644
--- a/lib/scripts/bootstrap.js
+++ b/lib/scripts/bootstrap.js
@@ -26,6 +26,8 @@
context._cordovaJsLoaded = true;
var channel = require('cordova/channel');
+ var pluginloader = require('cordova/pluginloader');
+
var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
function logUnfiredChannels(arr) {
@@ -94,4 +96,8 @@
}, platformInitChannelsArray);
+ // Don't attempt to load when running unit tests.
+ if (typeof XMLHttpRequest != 'undefined') {
+ pluginloader.load();
+ }
}(window));
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5f976d4e/lib/scripts/plugin_loader.js
----------------------------------------------------------------------
diff --git a/lib/scripts/plugin_loader.js b/lib/scripts/plugin_loader.js
deleted file mode 100644
index d9bea0a..0000000
--- a/lib/scripts/plugin_loader.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- *
- * 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
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-// Tries to load all plugins' js-modules.
-// This is an async process, but onDeviceReady is blocked on onPluginsReady.
-// onPluginsReady is fired when there are no plugins to load, or they are all done.
-(function (context) {
- // To be populated with the handler by handlePluginsObject.
- var onScriptLoadingComplete;
-
- var scriptCounter = 0;
- function scriptLoadedCallback() {
- scriptCounter--;
- if (scriptCounter === 0) {
- onScriptLoadingComplete && onScriptLoadingComplete();
- }
- }
-
- function scriptErrorCallback(err) {
- // Open Question: If a script path specified in cordova_plugins.js does not exist, do we fail for all?
- // this is currently just continuing.
- scriptCounter--;
- if (scriptCounter === 0) {
- onScriptLoadingComplete && onScriptLoadingComplete();
- }
- }
-
- // Helper function to inject a <script> tag.
- function injectScript(path) {
- scriptCounter++;
- var script = document.createElement("script");
- script.onload = scriptLoadedCallback;
- script.onerror = scriptErrorCallback;
- script.src = path;
- document.head.appendChild(script);
- }
-
- // Called when:
- // * There are plugins defined and all plugins are finished loading.
- // * There are no plugins to load.
- function finishPluginLoading() {
- context.cordova.require('cordova/channel').onPluginsReady.fire();
- }
-
- // Handler for the cordova_plugins.js content.
- // See plugman's plugin_loader.js for the details of this object.
- // This function is only called if the really is a plugins array that isn't empty.
- // Otherwise the onerror response handler will just call finishPluginLoading().
- function handlePluginsObject(modules, path) {
- // First create the callback for when all plugins are loaded.
- var mapper = context.cordova.require('cordova/modulemapper');
- onScriptLoadingComplete = function() {
- // Loop through all the plugins and then through their clobbers and merges.
- for (var i = 0; i < modules.length; i++) {
- var module = modules[i];
- if (module) {
- try {
- if (module.clobbers && module.clobbers.length) {
- for (var j = 0; j < module.clobbers.length; j++) {
- mapper.clobbers(module.id, module.clobbers[j]);
- }
- }
-
- if (module.merges && module.merges.length) {
- for (var k = 0; k < module.merges.length; k++) {
- mapper.merges(module.id, module.merges[k]);
- }
- }
-
- // Finally, if runs is truthy we want to simply require() the module.
- // This can be skipped if it had any merges or clobbers, though,
- // since the mapper will already have required the module.
- if (module.runs && !(module.clobbers && module.clobbers.length) && !(module.merges && module.merges.length)) {
- context.cordova.require(module.id);
- }
- }
- catch(err) {
- // error with module, most likely clobbers, should we continue?
- }
- }
- }
-
- finishPluginLoading();
- };
-
- // Now inject the scripts.
- for (var i = 0; i < modules.length; i++) {
- injectScript(path + modules[i].file);
- }
- }
-
- // Find the root of the app
- var path = '';
- var scripts = document.getElementsByTagName('script');
- var term = 'cordova.js';
- for (var n = scripts.length-1; n>-1; n--) {
- var src = scripts[n].src;
- if (src.indexOf(term) == (src.length - term.length)) {
- path = src.substring(0, src.length - term.length);
- break;
- }
- }
-
- var plugins_json = path + 'cordova_plugins.json';
- var plugins_js = path + 'cordova_plugins.js';
-
- // One some phones (Windows) this xhr.open throws an Access Denied exception
- // So lets keep trying, but with a script tag injection technique instead of XHR
- var injectPluginScript = function injectPluginScript() {
- try {
- var script = document.createElement("script");
- script.onload = function(){
- var list = cordova.require("cordova/plugin_list");
- handlePluginsObject(list,path);
- };
- script.onerror = function() {
- // Error loading cordova_plugins.js, file not found or something
- // this is an acceptable error, pre-3.0.0, so we just move on.
- finishPluginLoading();
- };
- script.src = plugins_js;
- document.head.appendChild(script);
-
- } catch(err){
- finishPluginLoading();
- }
- }
-
-
- // Try to XHR the cordova_plugins.json file asynchronously.
- var xhr = new XMLHttpRequest();
- xhr.onload = function() {
- // If the response is a JSON string which composes an array, call handlePluginsObject.
- // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
- var obj;
- try {
- obj = (this.status == 0 || this.status == 200) && this.responseText && JSON.parse(this.responseText);
- } catch (err) {
- // obj will be undefined.
- }
- if (Array.isArray(obj) && obj.length > 0) {
- handlePluginsObject(obj, path);
- } else {
- finishPluginLoading();
- }
- };
- xhr.onerror = function() {
- // In this case, the json file was not present, but XHR was allowed,
- // so we should still try the script injection technique with the js file
- // in case that is there.
- injectPluginScript();
- };
- try { // we commented we were going to try, so let us actually try and catch
- xhr.open('GET', plugins_json, true); // Async
- xhr.send();
- } catch(err){
- injectPluginScript();
- }
-}(window));
-
[05/25] js commit: [all] [CB-4022] Defer running of modules
until after all scripts are loaded. (cherry picked from commit
0c80083d289681616480054b84102758e9ed20bd)
Posted by ag...@apache.org.
[all] [CB-4022] Defer running of <runs> modules until after all scripts are loaded.
(cherry picked from commit 0c80083d289681616480054b84102758e9ed20bd)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/931e7718
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/931e7718
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/931e7718
Branch: refs/heads/2.9.x
Commit: 931e7718fa03a744be8ac90b88606fa5406486c6
Parents: 5f976d4
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jul 5 10:04:37 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:02 2013 -0400
----------------------------------------------------------------------
lib/common/modulemapper.js | 10 +++++++++-
lib/common/pluginloader.js | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/931e7718/lib/common/modulemapper.js
----------------------------------------------------------------------
diff --git a/lib/common/modulemapper.js b/lib/common/modulemapper.js
index bc414ca..208fbcb 100644
--- a/lib/common/modulemapper.js
+++ b/lib/common/modulemapper.js
@@ -51,6 +51,10 @@ exports.defaults = function(moduleName, symbolPath, opt_deprecationMessage) {
addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
};
+exports.runs = function(moduleName) {
+ addEntry('r', moduleName, null);
+};
+
function prepareNamespace(symbolPath, context) {
if (!symbolPath) {
return context;
@@ -69,12 +73,16 @@ exports.mapModules = function(context) {
for (var i = 0, len = symbolList.length; i < len; i += 3) {
var strategy = symbolList[i];
var moduleName = symbolList[i + 1];
+ var module = require(moduleName);
+ // <runs/>
+ if (strategy == 'r') {
+ continue;
+ }
var symbolPath = symbolList[i + 2];
var lastDot = symbolPath.lastIndexOf('.');
var namespace = symbolPath.substr(0, lastDot);
var lastName = symbolPath.substr(lastDot + 1);
- var module = require(moduleName);
var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
var parentObj = prepareNamespace(namespace, context);
var target = parentObj[lastName];
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/931e7718/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
index 764aa90..f160312 100644
--- a/lib/common/pluginloader.js
+++ b/lib/common/pluginloader.js
@@ -64,7 +64,7 @@ function onScriptLoadingComplete() {
// This can be skipped if it had any merges or clobbers, though,
// since the mapper will already have required the module.
if (module.runs && !(module.clobbers && module.clobbers.length) && !(module.merges && module.merges.length)) {
- require(module.id);
+ modulemapper.runs(module.id);
}
}
catch(err) {
[07/25] js commit: [All] patch,
in case console.warn is not defined (cherry picked from commit
984b1f1e26b12af2ad2acda96074341853ea8706)
Posted by ag...@apache.org.
[All] patch, in case console.warn is not defined
(cherry picked from commit 984b1f1e26b12af2ad2acda96074341853ea8706)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/a1ff039a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/a1ff039a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/a1ff039a
Branch: refs/heads/2.9.x
Commit: a1ff039ab6e717ac8eae66df96bbcbb5b19aced6
Parents: af01151
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Jul 9 18:53:02 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:26 2013 -0400
----------------------------------------------------------------------
lib/cordova.js | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a1ff039a/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 2bf49ab..0a566bb 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -99,10 +99,17 @@ function createEvent(type, data) {
}
if(typeof window.console === "undefined") {
+ window.external.Notify("console was undefined, in cordova.js fixing it.");
window.console = {
log:function(){}
};
}
+// there are places in the framework where we call `warn` also, so we should make sure it exists
+if(typeof window.console.warn === "undefined") {
+ window.console.warn = function(msg) {
+ this.log("warn: " + msg);
+ }
+}
var cordova = {
define:define,
[20/25] js commit: [android] Tweak the online bridge to tell native
when an event has happened.
Posted by ag...@apache.org.
[android] Tweak the online bridge to tell native when an event has happened.
This allows the native side to not send excess events.
(cherry picked from commit 1be2876635d2a788270238c4b1cfad200c488e32)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/257ab551
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/257ab551
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/257ab551
Branch: refs/heads/2.9.x
Commit: 257ab5519a0fbd903fdfda77c2e13d9641f1a1cd
Parents: afb4f94
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Aug 15 15:47:27 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:38:41 2013 -0400
----------------------------------------------------------------------
lib/android/exec.js | 12 ++++++++----
lib/android/plugin/android/promptbasednativeapi.js | 4 ++--
2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/257ab551/lib/android/exec.js
----------------------------------------------------------------------
diff --git a/lib/android/exec.js b/lib/android/exec.js
index 08d3e56..f22c46b 100644
--- a/lib/android/exec.js
+++ b/lib/android/exec.js
@@ -103,8 +103,12 @@ function androidExec(success, fail, service, action, args) {
}
}
-function pollOnce() {
- var msg = nativeApiProvider.get().retrieveJsMessages();
+function pollOnceFromOnlineEvent() {
+ pollOnce(true);
+}
+
+function pollOnce(opt_fromOnlineEvent) {
+ var msg = nativeApiProvider.get().retrieveJsMessages(!!opt_fromOnlineEvent);
androidExec.processMessages(msg);
}
@@ -123,8 +127,8 @@ function hookOnlineApis() {
// It currently fires them only on document though, so we bridge them
// to window here (while first listening for exec()-releated online/offline
// events).
- window.addEventListener('online', pollOnce, false);
- window.addEventListener('offline', pollOnce, false);
+ window.addEventListener('online', pollOnceFromOnlineEvent, false);
+ window.addEventListener('offline', pollOnceFromOnlineEvent, false);
cordova.addWindowEventHandler('online');
cordova.addWindowEventHandler('offline');
document.addEventListener('online', proxyEvent, false);
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/257ab551/lib/android/plugin/android/promptbasednativeapi.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/promptbasednativeapi.js b/lib/android/plugin/android/promptbasednativeapi.js
index a665135..c12f46e 100644
--- a/lib/android/plugin/android/promptbasednativeapi.js
+++ b/lib/android/plugin/android/promptbasednativeapi.js
@@ -29,7 +29,7 @@ module.exports = {
setNativeToJsBridgeMode: function(value) {
prompt(value, 'gap_bridge_mode:');
},
- retrieveJsMessages: function() {
- return prompt('', 'gap_poll:');
+ retrieveJsMessages: function(fromOnlineEvent) {
+ return prompt(+fromOnlineEvent, 'gap_poll:');
}
};
[18/25] js commit: Change Gruntfile to auto-build before running
tests (cherry picked from commit 45baa2cce0c9aa682f77f09a35917f6cd7622720)
Posted by ag...@apache.org.
Change Gruntfile to auto-build before running tests
(cherry picked from commit 45baa2cce0c9aa682f77f09a35917f6cd7622720)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/df8d3e1b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/df8d3e1b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/df8d3e1b
Branch: refs/heads/2.9.x
Commit: df8d3e1b4fb2dfd41c680eeb12d8cf1be4563fee
Parents: 808d3da
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Jul 29 15:23:50 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:37:42 2013 -0400
----------------------------------------------------------------------
Gruntfile.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/df8d3e1b/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 81275ad..83f2b7d 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -118,17 +118,17 @@ module.exports = function(grunt) {
packager.generate(platformName, useWindowsLineEndings, done);
});
- grunt.registerTask('test', 'Runs test in node', function() {
+ grunt.registerTask('_test', 'Runs test in node', function() {
var done = this.async();
require('./test/runner').node(done);
});
- grunt.registerTask('btest', 'Runs tests in the browser', function() {
+ grunt.registerTask('_btest', 'Runs tests in the browser', function() {
require('./test/runner').browser();
this.async(); // never finish.
});
- grunt.registerTask('complainwhitespace', 'Complain about what fixwhitespace would fix', function() {
+ grunt.registerTask('_complainwhitespace', 'Complain about what fixwhitespace would fix', function() {
var done = this.async();
var complainedAboutWhitespace = false;
processWhiteSpace(function(file, newSource) {
@@ -140,7 +140,7 @@ module.exports = function(grunt) {
}, done);
});
- grunt.registerTask('fixwhitespace', 'Converts tabs to four spaces, eliminates trailing white space, converts newlines to proper form - enforcing style guide ftw!', function() {
+ grunt.registerTask('_fixwhitespace', 'Converts tabs to four spaces, eliminates trailing white space, converts newlines to proper form - enforcing style guide ftw!', function() {
var done = this.async();
var complainedAboutWhitespace = false;
processWhiteSpace(function(file, newSource) {
@@ -154,7 +154,7 @@ module.exports = function(grunt) {
});
// TODO - Delete this task and use Grunt's built-in jshint (CB-3964).
- grunt.registerTask('hint', 'Runs jshint.', function() {
+ grunt.registerTask('_hint', 'Runs jshint.', function() {
var done = this.async();
var knownWarnings = [
"Redefinition of 'FileReader'",
@@ -182,5 +182,8 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task(s).
- grunt.registerTask('default', ['cordovajs', 'hint', 'complainwhitespace', 'test']);
+ grunt.registerTask('build', ['cordovajs', '_hint', '_complainwhitespace']);
+ grunt.registerTask('default', ['build', '_test']);
+ grunt.registerTask('test', ['build', '_test']);
+ grunt.registerTask('btest', ['build', '_btest']);
};
[19/25] js commit: Make base64 tests work in browser as well as Node
(cherry picked from commit ee2c1d20c3cc4e5ff9d0aa9e6fa0368a6b6956f6)
Posted by ag...@apache.org.
Make base64 tests work in browser as well as Node
(cherry picked from commit ee2c1d20c3cc4e5ff9d0aa9e6fa0368a6b6956f6)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/afb4f946
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/afb4f946
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/afb4f946
Branch: refs/heads/2.9.x
Commit: afb4f94683eb5b87bb94370f4aa5f9f059391233
Parents: df8d3e1
Author: Andrew Grieve <ag...@chromium.org>
Authored: Mon Jul 29 15:24:07 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:37:48 2013 -0400
----------------------------------------------------------------------
test/test.base64.js | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/afb4f946/test/test.base64.js
----------------------------------------------------------------------
diff --git a/test/test.base64.js b/test/test.base64.js
index f9b1912..563cff3 100644
--- a/test/test.base64.js
+++ b/test/test.base64.js
@@ -49,15 +49,15 @@ describe("base64", function () {
});
it("can base64 encode an text string in an ArrayBuffer", function () {
- var buffer = new Buffer('Some Awesome Test This Is!', 'binary')
- , base64string = buffer.toString('base64')
- , arrayBuffer = new ArrayBuffer(buffer.length)
- , view = new Uint8Array(arrayBuffer);
+ var orig = 'Some Awesome Test This Is!'
+ , base64string = typeof btoa != 'undefined' ? btoa(orig) : new Buffer('Some Awesome Test This Is!', 'binary').toString('base64')
+ , arrayBuffer = new ArrayBuffer(orig.length)
+ , view = new Uint8Array(arrayBuffer);
- for (var i = 0; i < buffer.length; i++) {
- view[i] = buffer[i];
- }
+ for (var i = 0; i < orig.length; i++) {
+ view[i] = orig.charCodeAt(i);
+ }
- expect(base64.fromArrayBuffer(arrayBuffer)).toBe(base64string);
+ expect(base64.fromArrayBuffer(arrayBuffer)).toBe(base64string);
});
});
[23/25] js commit: [CB-4761] Add cordova.platformId property (cherry
picked from commit fbb4342a2c7dfa5c04f68ea2dabc97726e6a9532)
Posted by ag...@apache.org.
[CB-4761] Add cordova.platformId property
(cherry picked from commit fbb4342a2c7dfa5c04f68ea2dabc97726e6a9532)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/6d4c79d4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/6d4c79d4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/6d4c79d4
Branch: refs/heads/2.9.x
Commit: 6d4c79d4ff8e132e708b70542a7bb5bb91ecbb40
Parents: f87145b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Sep 13 23:10:17 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:42:00 2013 -0400
----------------------------------------------------------------------
lib/cordova.js | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/6d4c79d4/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 7c717dd..6ffcd3d 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -21,6 +21,7 @@
var channel = require('cordova/channel');
+var platform = require('cordova/platform');
/**
* Listen for DOMContentLoaded and notify our channel subscribers.
@@ -114,6 +115,7 @@ var cordova = {
define:define,
require:require,
version:CORDOVA_JS_BUILD_LABEL,
+ platformId:platform.id,
/**
* Methods to add/remove your own addEventListener hijacking on document + window.
*/
[14/25] js commit: [CB-4187] Fix the fix for start-up when no plugins
are installed. (cherry picked from commit
ab2cb2cf6d3839373a0fa1372f2383fd17b93ecb)
Posted by ag...@apache.org.
[CB-4187] Fix the fix for start-up when no plugins are installed.
(cherry picked from commit ab2cb2cf6d3839373a0fa1372f2383fd17b93ecb)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/9c34b589
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/9c34b589
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/9c34b589
Branch: refs/heads/2.9.x
Commit: 9c34b58999e3a63a20985babf1dd84a78cd33d65
Parents: 41a2e9e
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Jul 16 23:03:04 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:37:00 2013 -0400
----------------------------------------------------------------------
lib/common/pluginloader.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/9c34b589/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
index 5f61b39..19f84bb 100644
--- a/lib/common/pluginloader.js
+++ b/lib/common/pluginloader.js
@@ -81,7 +81,7 @@ function handlePluginsObject(path, moduleList) {
var scriptCounter = moduleList.length;
if (!scriptCounter) {
- onScriptLoadingComplete();
+ finishPluginLoading();
return;
}
function scriptLoadedCallback() {
[11/25] js commit: catch exception for missing or invalid file path
(cherry picked from commit 87cc336cb59f8df559a201fdb1e2a6251b57a06b)
Posted by ag...@apache.org.
catch exception for missing or invalid file path
(cherry picked from commit 87cc336cb59f8df559a201fdb1e2a6251b57a06b)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/e13fbe7a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/e13fbe7a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/e13fbe7a
Branch: refs/heads/2.9.x
Commit: e13fbe7a44837031e70518b49ca1ddb6ecbd3a13
Parents: 5f9b670
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Jul 11 15:59:31 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:36:10 2013 -0400
----------------------------------------------------------------------
build/packager.js | 47 ++++++++++++++++++++++++++---------------------
1 file changed, 26 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e13fbe7a/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index 5026fbd..7e2f19b 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -188,28 +188,33 @@ function collectFiles(dir, id) {
var result = {}
- var entries = fs.readdirSync(dir)
-
- entries = entries.filter(function(entry) {
- if (entry.match(/\.js$/)) return true
-
- var stat = fs.statSync(path.join(dir, entry))
- if (stat.isDirectory()) return true
- })
+ try {
+ var entries = fs.readdirSync(dir)
+
+ entries = entries.filter(function(entry) {
+ if (entry.match(/\.js$/)) return true
+
+ var stat = fs.statSync(path.join(dir, entry))
+ if (stat.isDirectory()) return true
+ })
+
+ entries.forEach(function(entry) {
+ var moduleId = path.join(id, entry)
+ var fileName = path.join(dir, entry)
+
+ var stat = fs.statSync(fileName)
+ if (stat.isDirectory()) {
+ copyProps(result, collectFiles(fileName, moduleId))
+ }
+ else {
+ moduleId = getModuleId(moduleId)
+ result[moduleId] = fileName
+ }
+ })
+ }
+ catch(ex) {
- entries.forEach(function(entry) {
- var moduleId = path.join(id, entry)
- var fileName = path.join(dir, entry)
-
- var stat = fs.statSync(fileName)
- if (stat.isDirectory()) {
- copyProps(result, collectFiles(fileName, moduleId))
- }
- else {
- moduleId = getModuleId(moduleId)
- result[moduleId] = fileName
- }
- })
+ }
return copyProps({}, result)
}
[02/25] js commit: CB 4004: Adding base64 encoding for array buffers,
while removing the String expansion (cherry picked from commit
5ba835cf64a50f48dcdc8ced49fed1a714c098cc)
Posted by ag...@apache.org.
CB 4004: Adding base64 encoding for array buffers, while removing the String expansion
(cherry picked from commit 5ba835cf64a50f48dcdc8ced49fed1a714c098cc)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/082a7253
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/082a7253
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/082a7253
Branch: refs/heads/2.9.x
Commit: 082a72532a446b4e9168afa42c12f9d408814bbe
Parents: a750db7
Author: Chris Barton <c....@gmail.com>
Authored: Wed Jun 26 11:23:29 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:33:52 2013 -0400
----------------------------------------------------------------------
lib/android/exec.js | 3 ++-
test/test.base64.js | 13 +++++++++++++
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/082a7253/lib/android/exec.js
----------------------------------------------------------------------
diff --git a/lib/android/exec.js b/lib/android/exec.js
index 206c09a..f55b5ad 100644
--- a/lib/android/exec.js
+++ b/lib/android/exec.js
@@ -36,6 +36,7 @@
var cordova = require('cordova'),
nativeApiProvider = require('cordova/plugin/android/nativeapiprovider'),
utils = require('cordova/utils'),
+ base64 = require('cordova/base64'),
jsToNativeModes = {
PROMPT: 0,
JS_OBJECT: 1,
@@ -74,7 +75,7 @@ function androidExec(success, fail, service, action, args) {
// Process any ArrayBuffers in the args into a string.
for (var i = 0; i < args.length; i++) {
if (utils.typeName(args[i]) == 'ArrayBuffer') {
- args[i] = window.btoa(String.fromCharCode.apply(null, new Uint8Array(args[i])));
+ args[i] = utils.encodeBase64(args[i]);
}
}
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/082a7253/test/test.base64.js
----------------------------------------------------------------------
diff --git a/test/test.base64.js b/test/test.base64.js
index 666cafe..f9b1912 100644
--- a/test/test.base64.js
+++ b/test/test.base64.js
@@ -47,4 +47,17 @@ describe("base64", function () {
expect(base64.fromArrayBuffer(arrayBuffer)).toBe(base64string);
});
+
+ it("can base64 encode an text string in an ArrayBuffer", function () {
+ var buffer = new Buffer('Some Awesome Test This Is!', 'binary')
+ , base64string = buffer.toString('base64')
+ , arrayBuffer = new ArrayBuffer(buffer.length)
+ , view = new Uint8Array(arrayBuffer);
+
+ for (var i = 0; i < buffer.length; i++) {
+ view[i] = buffer[i];
+ }
+
+ expect(base64.fromArrayBuffer(arrayBuffer)).toBe(base64string);
+ });
});
[16/25] js commit: jshint cleanup (sorry im ocd) (cherry picked from
commit d716e31b39bd39a06f1db80040e2c8a6a78a34e8)
Posted by ag...@apache.org.
jshint cleanup (sorry im ocd)
(cherry picked from commit d716e31b39bd39a06f1db80040e2c8a6a78a34e8)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/c72e3213
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/c72e3213
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/c72e3213
Branch: refs/heads/2.9.x
Commit: c72e32132e77facb18b098617ea072846493b52d
Parents: 9c34b58
Author: Fil Maj <ma...@gmail.com>
Authored: Tue Jul 23 21:27:06 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:37:16 2013 -0400
----------------------------------------------------------------------
lib/android/plugin/android/app.js | 122 +--
lib/android/plugin/android/storage.js | 6 +-
lib/bada/plugin/bada/Camera.js | 2 +-
lib/bada/plugin/bada/Capture.js | 16 +-
lib/bada/plugin/bada/Compass.js | 28 +-
lib/bada/plugin/bada/Contacts.js | 10 +-
lib/bada/plugin/bada/Notification.js | 2 +-
lib/bada/plugin/bada/device.js | 114 +--
lib/blackberry/plugin/air/Entry.js | 6 +-
lib/blackberry/plugin/air/FileReader.js | 2 +-
lib/blackberry/plugin/air/FileWriter.js | 6 +-
lib/blackberry/plugin/air/capture.js | 4 +-
lib/blackberry/plugin/java/MediaError.js | 4 +-
lib/blackberry/plugin/java/app.js | 80 +-
lib/common/argscheck.js | 2 +-
lib/common/base64.js | 6 +-
lib/common/builder.js | 50 +-
lib/cordova.js | 18 +-
lib/firefoxos/plugin/firefoxos/orientation.js | 2 +-
lib/ios/exec.js | 21 +-
lib/osx/exec.js | 4 +-
lib/tizen/plugin/tizen/BufferLoader.js | 8 +-
lib/tizen/plugin/tizen/Camera.js | 100 +--
lib/tizen/plugin/tizen/Contact.js | 19 +-
lib/tizen/plugin/tizen/Device.js | 8 +-
lib/tizen/plugin/tizen/File.js | 4 +-
lib/tizen/plugin/tizen/Globalization.js | 912 ++++++++++-----------
lib/tizen/plugin/tizen/Media.js | 2 +-
lib/tizen/plugin/tizen/MediaError.js | 4 +-
lib/tizen/plugin/tizen/Notification.js | 10 +-
lib/webos/plugin/webos/camera.js | 4 +-
lib/webos/plugin/webos/notification.js | 4 +-
lib/webos/plugin/webos/orientation.js | 2 +-
lib/windows8/plugin/windows8/FileProxy.js | 92 +--
lib/windows8/plugin/windows8/console.js | 6 +-
35 files changed, 840 insertions(+), 840 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/android/plugin/android/app.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/app.js b/lib/android/plugin/android/app.js
index e755799..c2a4df5 100644
--- a/lib/android/plugin/android/app.js
+++ b/lib/android/plugin/android/app.js
@@ -22,71 +22,71 @@
var exec = require('cordova/exec');
module.exports = {
- /**
- * Clear the resource cache.
- */
- clearCache:function() {
- exec(null, null, "App", "clearCache", []);
- },
+ /**
+ * Clear the resource cache.
+ */
+ clearCache:function() {
+ exec(null, null, "App", "clearCache", []);
+ },
- /**
- * Load the url into the webview or into new browser instance.
- *
- * @param url The URL to load
- * @param props Properties that can be passed in to the activity:
- * wait: int => wait msec before loading URL
- * loadingDialog: "Title,Message" => display a native loading dialog
- * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error
- * clearHistory: boolean => clear webview history (default=false)
- * openExternal: boolean => open in a new browser (default=false)
- *
- * Example:
- * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
- */
- loadUrl:function(url, props) {
- exec(null, null, "App", "loadUrl", [url, props]);
- },
+ /**
+ * Load the url into the webview or into new browser instance.
+ *
+ * @param url The URL to load
+ * @param props Properties that can be passed in to the activity:
+ * wait: int => wait msec before loading URL
+ * loadingDialog: "Title,Message" => display a native loading dialog
+ * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error
+ * clearHistory: boolean => clear webview history (default=false)
+ * openExternal: boolean => open in a new browser (default=false)
+ *
+ * Example:
+ * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
+ */
+ loadUrl:function(url, props) {
+ exec(null, null, "App", "loadUrl", [url, props]);
+ },
- /**
- * Cancel loadUrl that is waiting to be loaded.
- */
- cancelLoadUrl:function() {
- exec(null, null, "App", "cancelLoadUrl", []);
- },
+ /**
+ * Cancel loadUrl that is waiting to be loaded.
+ */
+ cancelLoadUrl:function() {
+ exec(null, null, "App", "cancelLoadUrl", []);
+ },
- /**
- * Clear web history in this web view.
- * Instead of BACK button loading the previous web page, it will exit the app.
- */
- clearHistory:function() {
- exec(null, null, "App", "clearHistory", []);
- },
+ /**
+ * Clear web history in this web view.
+ * Instead of BACK button loading the previous web page, it will exit the app.
+ */
+ clearHistory:function() {
+ exec(null, null, "App", "clearHistory", []);
+ },
- /**
- * Go to previous page displayed.
- * This is the same as pressing the backbutton on Android device.
- */
- backHistory:function() {
- exec(null, null, "App", "backHistory", []);
- },
+ /**
+ * Go to previous page displayed.
+ * This is the same as pressing the backbutton on Android device.
+ */
+ backHistory:function() {
+ exec(null, null, "App", "backHistory", []);
+ },
- /**
- * Override the default behavior of the Android back button.
- * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
- *
- * Note: The user should not have to call this method. Instead, when the user
- * registers for the "backbutton" event, this is automatically done.
- *
- * @param override T=override, F=cancel override
- */
- overrideBackbutton:function(override) {
- exec(null, null, "App", "overrideBackbutton", [override]);
- },
+ /**
+ * Override the default behavior of the Android back button.
+ * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired.
+ *
+ * Note: The user should not have to call this method. Instead, when the user
+ * registers for the "backbutton" event, this is automatically done.
+ *
+ * @param override T=override, F=cancel override
+ */
+ overrideBackbutton:function(override) {
+ exec(null, null, "App", "overrideBackbutton", [override]);
+ },
- /**
- * Exit and terminate the application.
- */
- exitApp:function() {
- return exec(null, null, "App", "exitApp", []);
- }
+ /**
+ * Exit and terminate the application.
+ */
+ exitApp:function() {
+ return exec(null, null, "App", "exitApp", []);
+ }
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/android/plugin/android/storage.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/storage.js b/lib/android/plugin/android/storage.js
index b5e8fda..e615ebc 100644
--- a/lib/android/plugin/android/storage.js
+++ b/lib/android/plugin/android/storage.js
@@ -305,7 +305,7 @@ var DroidDB_openDatabase = function(name, version, display_name, size) {
module.exports = {
- openDatabase:DroidDB_openDatabase,
- failQuery:failQuery,
- completeQuery:completeQuery
+ openDatabase:DroidDB_openDatabase,
+ failQuery:failQuery,
+ completeQuery:completeQuery
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/bada/plugin/bada/Camera.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Camera.js b/lib/bada/plugin/bada/Camera.js
index a55d6d2..48feefd 100644
--- a/lib/bada/plugin/bada/Camera.js
+++ b/lib/bada/plugin/bada/Camera.js
@@ -55,7 +55,7 @@ module.exports = {
var success = function(cams) {
if (cams.length > 0) {
- self._cams = cams;
+ self._cams = cams;
self._mainCamera = cams[0];
self._mainCamera.createPreviewNode(onCreatePreviewNodeSuccess, error);
return;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/bada/plugin/bada/Capture.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Capture.js b/lib/bada/plugin/bada/Capture.js
index c7cad83..80a6592 100644
--- a/lib/bada/plugin/bada/Capture.js
+++ b/lib/bada/plugin/bada/Capture.js
@@ -49,10 +49,10 @@ module.exports = {
var pluginResult = [];
if(cbtype === "onAppControlCompleted") {
for(i = 1 ; i < resultList.length ; i += 1) {
- if(resultList[i]) {
- //console.log("resultList[" + i + "] = " + resultList[i]);
- pluginResult.push( {fullPath: resultList[i]} );
- }
+ if(resultList[i]) {
+ //console.log("resultList[" + i + "] = " + resultList[i]);
+ pluginResult.push( {fullPath: resultList[i]} );
+ }
}
success(pluginResult);
} else {
@@ -74,10 +74,10 @@ module.exports = {
var mediaFiles = [];
if(cbtype === "onAppControlCompleted") {
for(i = 1 ; i < resultList.length ; i += 1) {
- if(resultList[i]) {
- //console.log("resultList[" + i + "] = " + resultList[i]);
- mediaFiles.push( {fullPath: resultList[i]} );
- }
+ if(resultList[i]) {
+ //console.log("resultList[" + i + "] = " + resultList[i]);
+ mediaFiles.push( {fullPath: resultList[i]} );
+ }
}
success(mediaFiles);
} else {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/bada/plugin/bada/Compass.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Compass.js b/lib/bada/plugin/bada/Compass.js
index 43a6c97..e67e1e0 100644
--- a/lib/bada/plugin/bada/Compass.js
+++ b/lib/bada/plugin/bada/Compass.js
@@ -22,19 +22,19 @@
var CompassHeading = require('cordova/plugin/CompassHeading');
module.exports = {
- getHeading: function(compassSuccess, compassError, compassOptions) {
- if(deviceapis.orientation === undefined) {
- console.log("navigator.compass.getHeading", "Operation not supported!");
- return -1;
- }
- var success = function(orientation) {
- var heading = 360 - orientation.alpha;
- var compassHeading = new CompassHeading(heading, heading, 0);
- compassSuccess(compassHeading);
- };
- var error = function(error) {
- compassError(error);
- };
- deviceapis.orientation.getCurrentOrientation(success, error);
+ getHeading: function(compassSuccess, compassError, compassOptions) {
+ if(deviceapis.orientation === undefined) {
+ console.log("navigator.compass.getHeading", "Operation not supported!");
+ return -1;
}
+ var success = function(orientation) {
+ var heading = 360 - orientation.alpha;
+ var compassHeading = new CompassHeading(heading, heading, 0);
+ compassSuccess(compassHeading);
+ };
+ var error = function(error) {
+ compassError(error);
+ };
+ deviceapis.orientation.getCurrentOrientation(success, error);
+ }
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/bada/plugin/bada/Contacts.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Contacts.js b/lib/bada/plugin/bada/Contacts.js
index 16e5286..925121c 100644
--- a/lib/bada/plugin/bada/Contacts.js
+++ b/lib/bada/plugin/bada/Contacts.js
@@ -35,8 +35,8 @@ function _pgToWac(contact) {
// name
if(contact.name) {
- wacContact.firstName = contact.name.givenName;
- wacContact.lastName = contact.name.familyName;
+ wacContact.firstName = contact.name.givenName;
+ wacContact.lastName = contact.name.familyName;
}
// nickname
@@ -99,7 +99,7 @@ function _pgToWac(contact) {
// photos
// can only store one photo URL
if(contact.photos && contact.photos.length > 0) {
- wacContact.photoURL = contact.photos[0].value;
+ wacContact.photoURL = contact.photos[0].value;
}
return wacContact;
@@ -185,7 +185,7 @@ function _wacToPg(contact) {
// photos
// can only store one photo URL
if(contact.photoURL) {
- pgContact.photos = [{value: contact.photoURL, type: "DEFAULT"}];
+ pgContact.photos = [{value: contact.photoURL, type: "DEFAULT"}];
}
return pgContact;
@@ -196,7 +196,7 @@ function _buildWacFilters(fields, options) {
var wacFilters = {};
for(i = 0, j = fields.length ; i < j ; i += 1) {
if(allowedFilters.indexOf(fields[i]) != -1) {
- wacFilters[fields[i]] = options.filter;
+ wacFilters[fields[i]] = options.filter;
}
}
}
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/bada/plugin/bada/Notification.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Notification.js b/lib/bada/plugin/bada/Notification.js
index 1985eee..ec455e9 100644
--- a/lib/bada/plugin/bada/Notification.js
+++ b/lib/bada/plugin/bada/Notification.js
@@ -58,7 +58,7 @@ module.exports = {
catch(e) {
console.log("Exception thrown: " + e);
}
- },
+ },
lightOn: function(milliseconds) {
deviceapis.deviceinteraction.lightOn(function() {
console.log("Lighting for "+milliseconds+" second");
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/bada/plugin/bada/device.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/device.js b/lib/bada/plugin/bada/device.js
index 8896c25..8fed9b1 100644
--- a/lib/bada/plugin/bada/device.js
+++ b/lib/bada/plugin/bada/device.js
@@ -32,73 +32,73 @@ function Device() {
var me = this;
channel.onCordovaReady.subscribe(function() {
- me.getDeviceInfo(function (device) {
- me.platform = device.platform;
- me.version = device.version;
- me.name = device.name;
- me.uuid = device.uuid;
- me.cordova = device.cordova;
+ me.getDeviceInfo(function (device) {
+ me.platform = device.platform;
+ me.version = device.version;
+ me.name = device.name;
+ me.uuid = device.uuid;
+ me.cordova = device.cordova;
- channel.onCordovaInfoReady.fire();
- },
- function (e) {
- me.available = false;
- utils.alert("error initializing cordova: " + e);
- });
+ channel.onCordovaInfoReady.fire();
+ },
+ function (e) {
+ me.available = false;
+ utils.alert("error initializing cordova: " + e);
+ });
});
}
Device.prototype.getDeviceInfo = function(success, fail, args) {
- var info = deviceapis.devicestatus;
- var properties = ["name", "uuid", "os_name", "os_vendor", "os_version"];
+ var info = deviceapis.devicestatus;
+ var properties = ["name", "uuid", "os_name", "os_vendor", "os_version"];
- var me = this;
+ var me = this;
- var name = null,
- platform = null,
- uuid = null,
- os_name = null,
- os_version = null,
- os_vendor = null;
+ var name = null,
+ platform = null,
+ uuid = null,
+ os_name = null,
+ os_version = null,
+ os_vendor = null;
- var checkProperties = function() {
- properties.pop();
- if(properties.length === 0) {
- me.name = name;
- me.platform = os_vendor + " " + os_name;
- me.version = os_version;
- me.uuid = uuid;
- me.cordova = CORDOVA_JS_BUILD_LABEL;
- success(me);
- }
- };
+ var checkProperties = function() {
+ properties.pop();
+ if(properties.length === 0) {
+ me.name = name;
+ me.platform = os_vendor + " " + os_name;
+ me.version = os_version;
+ me.uuid = uuid;
+ me.cordova = CORDOVA_JS_BUILD_LABEL;
+ success(me);
+ }
+ };
- info.getPropertyValue(function(value) {
- //console.log("Device IMEI: "+value);
- uuid = value;
- checkProperties();
- }, fail, {aspect: "Device", property: "imei"});
- info.getPropertyValue(function(value) {
- //console.log("Device name: "+value);
- name = value;
- checkProperties();
- }, fail, {aspect: "Device", property: "version"});
- info.getPropertyValue(function(value) {
- //console.log("OperatingSystem name: "+value);
- os_name = value;
- checkProperties();
- }, fail, {aspect: "OperatingSystem", property: "name"});
- info.getPropertyValue(function(value) {
- //console.log("OperatingSystem version: "+value);
- os_version = value;
- checkProperties();
- }, fail, {aspect: "OperatingSystem", property: "version"});
- info.getPropertyValue(function(value) {
- //console.log("OperatingSystem vendor: "+value);
- os_vendor = value;
- checkProperties();
- }, fail, {aspect: "OperatingSystem", property: "vendor"});
+ info.getPropertyValue(function(value) {
+ //console.log("Device IMEI: "+value);
+ uuid = value;
+ checkProperties();
+ }, fail, {aspect: "Device", property: "imei"});
+ info.getPropertyValue(function(value) {
+ //console.log("Device name: "+value);
+ name = value;
+ checkProperties();
+ }, fail, {aspect: "Device", property: "version"});
+ info.getPropertyValue(function(value) {
+ //console.log("OperatingSystem name: "+value);
+ os_name = value;
+ checkProperties();
+ }, fail, {aspect: "OperatingSystem", property: "name"});
+ info.getPropertyValue(function(value) {
+ //console.log("OperatingSystem version: "+value);
+ os_version = value;
+ checkProperties();
+ }, fail, {aspect: "OperatingSystem", property: "version"});
+ info.getPropertyValue(function(value) {
+ //console.log("OperatingSystem vendor: "+value);
+ os_vendor = value;
+ checkProperties();
+ }, fail, {aspect: "OperatingSystem", property: "vendor"});
};
module.exports = new Device();
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/blackberry/plugin/air/Entry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/Entry.js b/lib/blackberry/plugin/air/Entry.js
index 1eb7360..55a56f4 100644
--- a/lib/blackberry/plugin/air/Entry.js
+++ b/lib/blackberry/plugin/air/Entry.js
@@ -49,11 +49,11 @@ var validFileRe = new RegExp('^[a-zA-Z][0-9a-zA-Z._ ]*$');
module.exports = {
getMetadata : function(successCallback, errorCallback){
var success = typeof successCallback !== 'function' ? null : function(lastModified) {
- var metadata = new Metadata(lastModified);
- successCallback(metadata);
+ var metadata = new Metadata(lastModified);
+ successCallback(metadata);
};
var fail = typeof errorCallback !== 'function' ? null : function(code) {
- errorCallback(new FileError(code));
+ errorCallback(new FileError(code));
};
if(this.isFile){
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/blackberry/plugin/air/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/FileReader.js b/lib/blackberry/plugin/air/FileReader.js
index b6769b0..e6a66ef 100644
--- a/lib/blackberry/plugin/air/FileReader.js
+++ b/lib/blackberry/plugin/air/FileReader.js
@@ -62,7 +62,7 @@ FileReader.prototype.abort = function() {
this.result = null;
if (this.readyState == FileReader.DONE || this.readyState == FileReader.EMPTY) {
- return;
+ return;
}
this.readyState = FileReader.DONE;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/blackberry/plugin/air/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/FileWriter.js b/lib/blackberry/plugin/air/FileWriter.js
index 1f68893..c4176fe 100644
--- a/lib/blackberry/plugin/air/FileWriter.js
+++ b/lib/blackberry/plugin/air/FileWriter.js
@@ -154,7 +154,7 @@ FileWriter.prototype.write = function(text) {
me.readyState = FileWriter.DONE;
if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
+ me.onwriteend(new ProgressEvent("writeend", {"target":me}));
}
};
@@ -246,7 +246,7 @@ FileWriter.prototype.truncate = function(size) {
me.length = me.position;
if (typeof me.onwrite === "function") {
- me.onwrite(new ProgressEvent("write", {"target":me}));
+ me.onwrite(new ProgressEvent("write", {"target":me}));
}
};
@@ -262,7 +262,7 @@ FileWriter.prototype.truncate = function(size) {
me.readyState = FileWriter.DONE;
if (typeof me.onwriteend === "function") {
- me.onwriteend(new ProgressEvent("writeend", {"target":me}));
+ me.onwriteend(new ProgressEvent("writeend", {"target":me}));
}
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/blackberry/plugin/air/capture.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/air/capture.js b/lib/blackberry/plugin/air/capture.js
index 0b837be..7809195 100644
--- a/lib/blackberry/plugin/air/capture.js
+++ b/lib/blackberry/plugin/air/capture.js
@@ -77,8 +77,8 @@ module.exports = {
},
captureAudio: function (args, win, fail) {
var onCaptureAudioWin = function(filePath){
- // for some reason the filePath is coming back as a string between two double quotes
- filePath = filePath.slice(1, filePath.length-1);
+ // for some reason the filePath is coming back as a string between two double quotes
+ filePath = filePath.slice(1, filePath.length-1);
var file = blackberry.io.file.getFileProperties(filePath);
win([{
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/blackberry/plugin/java/MediaError.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/MediaError.js b/lib/blackberry/plugin/java/MediaError.js
index 6702452..c7c1960 100644
--- a/lib/blackberry/plugin/java/MediaError.js
+++ b/lib/blackberry/plugin/java/MediaError.js
@@ -24,6 +24,6 @@
// from being defined. This object is used to merge in differences between the BB
// MediaError object and the Cordova version.
module.exports = {
- MEDIA_ERR_NONE_ACTIVE : 0,
- MEDIA_ERR_NONE_SUPPORTED : 4
+ MEDIA_ERR_NONE_ACTIVE : 0,
+ MEDIA_ERR_NONE_SUPPORTED : 4
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/blackberry/plugin/java/app.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/java/app.js b/lib/blackberry/plugin/java/app.js
index bbfd360..7596f0d 100644
--- a/lib/blackberry/plugin/java/app.js
+++ b/lib/blackberry/plugin/java/app.js
@@ -24,49 +24,49 @@ var exec = require('cordova/exec'),
manager = require('cordova/plugin/' + platform.runtime() + '/manager');
module.exports = {
- /**
- * Clear the resource cache.
- */
- clearCache:function() {
- if (typeof blackberry.widgetcache === "undefined" || blackberry.widgetcache === null) {
- console.log("blackberry.widgetcache permission not found. Cache clear request denied.");
- return;
- }
- blackberry.widgetcache.clearAll();
- },
+ /**
+ * Clear the resource cache.
+ */
+ clearCache:function() {
+ if (typeof blackberry.widgetcache === "undefined" || blackberry.widgetcache === null) {
+ console.log("blackberry.widgetcache permission not found. Cache clear request denied.");
+ return;
+ }
+ blackberry.widgetcache.clearAll();
+ },
- /**
- * Clear web history in this web view.
- * Instead of BACK button loading the previous web page, it will exit the app.
- */
- clearHistory:function() {
- exec(null, null, "App", "clearHistory", []);
- },
+ /**
+ * Clear web history in this web view.
+ * Instead of BACK button loading the previous web page, it will exit the app.
+ */
+ clearHistory:function() {
+ exec(null, null, "App", "clearHistory", []);
+ },
- /**
- * Go to previous page displayed.
- * This is the same as pressing the backbutton on Android device.
- */
- backHistory:function() {
- // window.history.back() behaves oddly on BlackBerry, so use
- // native implementation.
- exec(null, null, "App", "backHistory", []);
- },
+ /**
+ * Go to previous page displayed.
+ * This is the same as pressing the backbutton on Android device.
+ */
+ backHistory:function() {
+ // window.history.back() behaves oddly on BlackBerry, so use
+ // native implementation.
+ exec(null, null, "App", "backHistory", []);
+ },
- /**
- * Exit and terminate the application.
- */
- exitApp:function() {
- // Call onunload if it is defined since BlackBerry does not invoke
- // on application exit.
- if (typeof window.onunload === "function") {
- window.onunload();
- }
+ /**
+ * Exit and terminate the application.
+ */
+ exitApp:function() {
+ // Call onunload if it is defined since BlackBerry does not invoke
+ // on application exit.
+ if (typeof window.onunload === "function") {
+ window.onunload();
+ }
- // allow Cordova JavaScript Extension opportunity to cleanup
- manager.destroy();
+ // allow Cordova JavaScript Extension opportunity to cleanup
+ manager.destroy();
- // exit the app
- blackberry.app.exit();
- }
+ // exit the app
+ blackberry.app.exit();
+ }
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/common/argscheck.js
----------------------------------------------------------------------
diff --git a/lib/common/argscheck.js b/lib/common/argscheck.js
index 5d0cbe7..104739a 100644
--- a/lib/common/argscheck.js
+++ b/lib/common/argscheck.js
@@ -34,7 +34,7 @@ var typeMap = {
};
function extractParamName(callee, argIndex) {
- return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
+ return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
}
function checkArgs(spec, functionName, args, opt_callee) {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/common/base64.js
----------------------------------------------------------------------
diff --git a/lib/common/base64.js b/lib/common/base64.js
index 38426e6..be58f38 100644
--- a/lib/common/base64.js
+++ b/lib/common/base64.js
@@ -22,8 +22,8 @@
var base64 = exports;
base64.fromArrayBuffer = function(arrayBuffer) {
- var array = new Uint8Array(arrayBuffer);
- return uint8ToBase64(array);
+ var array = new Uint8Array(arrayBuffer);
+ return uint8ToBase64(array);
};
//------------------------------------------------------------------------------
@@ -45,7 +45,7 @@ var b64_12bitTable = function() {
}
b64_12bitTable = function() { return b64_12bit; };
return b64_12bit;
-}
+};
function uint8ToBase64(rawData) {
var numBytes = rawData.byteLength;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/common/builder.js
----------------------------------------------------------------------
diff --git a/lib/common/builder.js b/lib/common/builder.js
index b3b4d39..4421121 100644
--- a/lib/common/builder.js
+++ b/lib/common/builder.js
@@ -56,36 +56,36 @@ function assignOrWrapInDeprecateGetter(obj, key, value, message) {
function include(parent, objects, clobber, merge) {
each(objects, function (obj, key) {
try {
- var result = obj.path ? require(obj.path) : {};
+ var result = obj.path ? require(obj.path) : {};
- if (clobber) {
- // Clobber if it doesn't exist.
- if (typeof parent[key] === 'undefined') {
- assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- } else if (typeof obj.path !== 'undefined') {
- // If merging, merge properties onto parent, otherwise, clobber.
- if (merge) {
- recursiveMerge(parent[key], result);
- } else {
- assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
- }
- }
- result = parent[key];
- } else {
- // Overwrite if not currently defined.
- if (typeof parent[key] == 'undefined') {
- assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ if (clobber) {
+ // Clobber if it doesn't exist.
+ if (typeof parent[key] === 'undefined') {
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ } else if (typeof obj.path !== 'undefined') {
+ // If merging, merge properties onto parent, otherwise, clobber.
+ if (merge) {
+ recursiveMerge(parent[key], result);
+ } else {
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ }
+ }
+ result = parent[key];
} else {
- // Set result to what already exists, so we can build children into it if they exist.
- result = parent[key];
+ // Overwrite if not currently defined.
+ if (typeof parent[key] == 'undefined') {
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+ } else {
+ // Set result to what already exists, so we can build children into it if they exist.
+ result = parent[key];
+ }
}
- }
- if (obj.children) {
- include(result, obj.children, clobber, merge);
- }
+ if (obj.children) {
+ include(result, obj.children, clobber, merge);
+ }
} catch(e) {
- utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
+ utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
}
});
}
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 5e4e1b4..c6a37fd 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -107,7 +107,7 @@ if(typeof window.console === "undefined") {
if(typeof window.console.warn === "undefined") {
window.console.warn = function(msg) {
this.log("warn: " + msg);
- }
+ };
}
var cordova = {
@@ -148,16 +148,16 @@ var cordova = {
var evt = createEvent(type, data);
if (typeof documentEventHandlers[type] != 'undefined') {
if( bNoDetach ) {
- documentEventHandlers[type].fire(evt);
+ documentEventHandlers[type].fire(evt);
}
else {
- setTimeout(function() {
- // Fire deviceready on listeners that were registered before cordova.js was loaded.
- if (type == 'deviceready') {
- document.dispatchEvent(evt);
- }
- documentEventHandlers[type].fire(evt);
- }, 0);
+ setTimeout(function() {
+ // Fire deviceready on listeners that were registered before cordova.js was loaded.
+ if (type == 'deviceready') {
+ document.dispatchEvent(evt);
+ }
+ documentEventHandlers[type].fire(evt);
+ }, 0);
}
} else {
document.dispatchEvent(evt);
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/firefoxos/plugin/firefoxos/orientation.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/plugin/firefoxos/orientation.js b/lib/firefoxos/plugin/firefoxos/orientation.js
index ed4a41d..3edfaff 100644
--- a/lib/firefoxos/plugin/firefoxos/orientation.js
+++ b/lib/firefoxos/plugin/firefoxos/orientation.js
@@ -25,7 +25,7 @@
module.exports = {
getCurrentOrientation: function() {
- return window.screen.orientation;
+ return window.screen.orientation;
}
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index be05e94..c3e7689 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -67,7 +67,7 @@ function shouldBundleCommandJson() {
function massageArgsJsToNative(args) {
if (!args || utils.typeName(args) != 'Array') {
- return args;
+ return args;
}
var ret = [];
args.forEach(function(arg, i) {
@@ -139,18 +139,17 @@ function iOSExec() {
callbackId = 'INVALID';
} else {
// FORMAT TWO, REMOVED
- try {
- splitCommand = arguments[0].split(".");
- action = splitCommand.pop();
- service = splitCommand.join(".");
- actionArgs = Array.prototype.splice.call(arguments, 1);
+ try {
+ splitCommand = arguments[0].split(".");
+ action = splitCommand.pop();
+ service = splitCommand.join(".");
+ actionArgs = Array.prototype.splice.call(arguments, 1);
- console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' +
+ console.log('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' +
"cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");"
- );
- return;
- } catch (e) {
- }
+ );
+ return;
+ } catch (e) {}
}
// Register the callbacks and add the callbackId to the positional
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/osx/exec.js
----------------------------------------------------------------------
diff --git a/lib/osx/exec.js b/lib/osx/exec.js
index 811848e..ff52009 100644
--- a/lib/osx/exec.js
+++ b/lib/osx/exec.js
@@ -63,7 +63,7 @@ function convertMessageToArgsNativeToJs(message) {
function massageArgsJsToNative(args) {
if (!args || utils.typeName(args) != 'Array') {
- return args;
+ return args;
}
var ret = [];
args.forEach(function(arg, i) {
@@ -98,7 +98,7 @@ function OSXExec() {
{success:successCallback, fail:failCallback};
}
- actionArgs = massageArgsJsToNative(actionArgs);
+ actionArgs = massageArgsJsToNative(actionArgs);
if (window.cordovabridge && window.cordovabridge.exec) {
window.cordovabridge.exec(callbackId, service, action, actionArgs);
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/BufferLoader.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/BufferLoader.js b/lib/tizen/plugin/tizen/BufferLoader.js
index 6ef19f4..f4f7909 100644
--- a/lib/tizen/plugin/tizen/BufferLoader.js
+++ b/lib/tizen/plugin/tizen/BufferLoader.js
@@ -67,10 +67,10 @@ BufferLoader.prototype.loadBuffer = function(url, index) {
loader = this;
request.onload = function() {
- // Asynchronously decode the audio file data in request.response
- loader.context.decodeAudioData(
- request.response,
- function(buffer) {
+ // Asynchronously decode the audio file data in request.response
+ loader.context.decodeAudioData(
+ request.response,
+ function(buffer) {
if (!buffer) {
console.log ("BufferLoader.prototype.loadBuffer,error decoding file data: " + url);
return;
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/Camera.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Camera.js b/lib/tizen/plugin/tizen/Camera.js
index 06e134c..76918f0 100644
--- a/lib/tizen/plugin/tizen/Camera.js
+++ b/lib/tizen/plugin/tizen/Camera.js
@@ -36,7 +36,7 @@ function cameraMakeReplyCallback(successCallback, errorCallback) {
}
},
onfail: function() {
- console.log('The service launch failed');
+ console.log('The service launch failed');
}
};
}
@@ -48,61 +48,61 @@ module.exports = {
encodingType = args[5],
mediaType = args[6];
- // Not supported
- /*
- quality = args[0]
- targetWidth = args[3]
- targetHeight = args[4]
- allowEdit = args[7]
- correctOrientation = args[8]
- saveToPhotoAlbum = args[9]
- */
+ // Not supported
+ /*
+ quality = args[0]
+ targetWidth = args[3]
+ targetHeight = args[4]
+ allowEdit = args[7]
+ correctOrientation = args[8]
+ saveToPhotoAlbum = args[9]
+ */
- if (destinationType !== Camera.DestinationType.FILE_URI) {
- errorCallback('DestinationType not supported');
- return;
- }
+ if (destinationType !== Camera.DestinationType.FILE_URI) {
+ errorCallback('DestinationType not supported');
+ return;
+ }
- if (mediaType !== Camera.MediaType.PICTURE) {
- errorCallback('MediaType not supported');
- return;
- }
+ if (mediaType !== Camera.MediaType.PICTURE) {
+ errorCallback('MediaType not supported');
+ return;
+ }
- var mimeType;
- if (encodingType === Camera.EncodingType.JPEG) {
- mimeType = 'image/jpeg';
- }
- else if (encodingType === Camera.EncodingType.PNG) {
- mimeType = 'image/png';
- }
- else {
- mimeType = 'image/*';
- }
+ var mimeType;
+ if (encodingType === Camera.EncodingType.JPEG) {
+ mimeType = 'image/jpeg';
+ }
+ else if (encodingType === Camera.EncodingType.PNG) {
+ mimeType = 'image/png';
+ }
+ else {
+ mimeType = 'image/*';
+ }
- var serviceId;
- if (sourceType === Camera.PictureSourceType.CAMERA) {
- serviceId = 'http://tizen.org/appcontrol/operation/create_content';
- }
- else {
- serviceId = 'http://tizen.org/appcontrol/operation/pick';
- }
+ var serviceId;
+ if (sourceType === Camera.PictureSourceType.CAMERA) {
+ serviceId = 'http://tizen.org/appcontrol/operation/create_content';
+ }
+ else {
+ serviceId = 'http://tizen.org/appcontrol/operation/pick';
+ }
- var serviceControl = new tizen.ApplicationControl(
- serviceId,
- null,
- mimeType,
- null);
+ var serviceControl = new tizen.ApplicationControl(
+ serviceId,
+ null,
+ mimeType,
+ null);
- tizen.application.launchAppControl(
- serviceControl,
- null,
- null,
- function(error) {
- errorCallback(error.message);
- },
- cameraMakeReplyCallback(successCallback, errorCallback)
- );
- }
+ tizen.application.launchAppControl(
+ serviceControl,
+ null,
+ null,
+ function(error) {
+ errorCallback(error.message);
+ },
+ cameraMakeReplyCallback(successCallback, errorCallback)
+ );
+ }
};
//console.log("TIZEN CAMERA END");
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/Contact.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Contact.js b/lib/tizen/plugin/tizen/Contact.js
index 148a0e8..439893d 100644
--- a/lib/tizen/plugin/tizen/Contact.js
+++ b/lib/tizen/plugin/tizen/Contact.js
@@ -326,15 +326,16 @@ var saveToDevice = function(contact) {
addresses.push(
new tizen.ContactAddress({
- country: address.country,
- region : address.region,
- city: address.locality,
- streetAddress: address.streetAddress,
- additionalInformation: "",
- postalCode: address.postalCode,
- isDefault: address.pref, //Tizen 2.0
- types : addressTypes
- }));
+ country: address.country,
+ region : address.region,
+ city: address.locality,
+ streetAddress: address.streetAddress,
+ additionalInformation: "",
+ postalCode: address.postalCode,
+ isDefault: address.pref, //Tizen 2.0
+ types : addressTypes
+ })
+ );
}
tizenContact.addresses = addresses.length > 0 ? addresses : [];
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/Device.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Device.js b/lib/tizen/plugin/tizen/Device.js
index dad43a9..fb8a694 100644
--- a/lib/tizen/plugin/tizen/Device.js
+++ b/lib/tizen/plugin/tizen/Device.js
@@ -48,10 +48,10 @@ Device.prototype.getDeviceInfo = function() {
this.model = deviceCapabilities.platformName;
channel.onCordovaInfoReady.fire();
- }
- else {
- console.log("error initializing cordova: ");
- }
+ }
+ else {
+ console.log("error initializing cordova: ");
+ }
};
module.exports = new Device();
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/File.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/File.js b/lib/tizen/plugin/tizen/File.js
index 29583f8..e99eef3 100644
--- a/lib/tizen/plugin/tizen/File.js
+++ b/lib/tizen/plugin/tizen/File.js
@@ -161,7 +161,7 @@ module.exports = {
},
function(error) {
errorCallback(error.code);
- }
+ }
);
},
function(error) {
@@ -497,7 +497,7 @@ module.exports = {
function(entry) {
var onLoadEnd = function(evt) {
if (!evt.target.error) {
- successCallback(evt.target.result);
+ successCallback(evt.target.result);
}
},
onError = function(evt) {
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/Globalization.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Globalization.js b/lib/tizen/plugin/tizen/Globalization.js
index aa7f94a..8196d17 100644
--- a/lib/tizen/plugin/tizen/Globalization.js
+++ b/lib/tizen/plugin/tizen/Globalization.js
@@ -28,467 +28,467 @@ var argscheck = require('cordova/argscheck'),
var globalization = {
-/**
-* Returns the string identifier for the client's current language.
-* It returns the language identifier string to the successCB callback with a
-* properties object as a parameter. If there is an error getting the language,
-* then the errorCB callback is invoked.
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.value {String}: The language identifier
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getPreferredLanguage(function (language) {alert('language:' + language.value + '\n');},
-* function () {});
-*/
-getPreferredLanguage:function(successCB, failureCB) {
- console.log('exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);');
-
- tizen.systeminfo.getPropertyValue (
- "LOCALE",
- function (localeInfo) {
- console.log("Cordova, getLocaleName, language is " + localeInfo.language);
- successCB( {"value": localeInfo.language});
- },
- function(error) {
- console.log("Cordova, getLocaleName, An error occurred " + error.message);
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve language name"));
- }
- );
-},
-
-/**
-* Returns the string identifier for the client's current locale setting.
-* It returns the locale identifier string to the successCB callback with a
-* properties object as a parameter. If there is an error getting the locale,
-* then the errorCB callback is invoked.
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.value {String}: The locale identifier
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getLocaleName(function (locale) {alert('locale:' + locale.value + '\n');},
-* function () {});
-*/
-getLocaleName:function(successCB, failureCB) {
- tizen.systeminfo.getPropertyValue (
- "LOCALE",
- function (localeInfo) {
- console.log("Cordova, getLocaleName, locale name (country) is " + localeInfo.country);
- successCB( {"value":localeInfo.language});
- },
- function(error) {
- console.log("Cordova, getLocaleName, An error occurred " + error.message);
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve locale name"));
+ /**
+ * Returns the string identifier for the client's current language.
+ * It returns the language identifier string to the successCB callback with a
+ * properties object as a parameter. If there is an error getting the language,
+ * then the errorCB callback is invoked.
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ *
+ * @return Object.value {String}: The language identifier
+ *
+ * @error GlobalizationError.UNKNOWN_ERROR
+ *
+ * Example
+ * globalization.getPreferredLanguage(function (language) {alert('language:' + language.value + '\n');},
+ * function () {});
+ */
+ getPreferredLanguage:function(successCB, failureCB) {
+ console.log('exec(successCB, failureCB, "Globalization","getPreferredLanguage", []);');
+
+ tizen.systeminfo.getPropertyValue (
+ "LOCALE",
+ function (localeInfo) {
+ console.log("Cordova, getLocaleName, language is " + localeInfo.language);
+ successCB( {"value": localeInfo.language});
+ },
+ function(error) {
+ console.log("Cordova, getLocaleName, An error occurred " + error.message);
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve language name"));
+ }
+ );
+ },
+
+ /**
+ * Returns the string identifier for the client's current locale setting.
+ * It returns the locale identifier string to the successCB callback with a
+ * properties object as a parameter. If there is an error getting the locale,
+ * then the errorCB callback is invoked.
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ *
+ * @return Object.value {String}: The locale identifier
+ *
+ * @error GlobalizationError.UNKNOWN_ERROR
+ *
+ * Example
+ * globalization.getLocaleName(function (locale) {alert('locale:' + locale.value + '\n');},
+ * function () {});
+ */
+ getLocaleName:function(successCB, failureCB) {
+ tizen.systeminfo.getPropertyValue (
+ "LOCALE",
+ function (localeInfo) {
+ console.log("Cordova, getLocaleName, locale name (country) is " + localeInfo.country);
+ successCB( {"value":localeInfo.language});
+ },
+ function(error) {
+ console.log("Cordova, getLocaleName, An error occurred " + error.message);
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot retrieve locale name"));
+ }
+ );
+ },
+
+
+ /**
+ * Returns a date formatted as a string according to the client's user preferences and
+ * calendar using the time zone of the client. It returns the formatted date string to the
+ * successCB callback with a properties object as a parameter. If there is an error
+ * formatting the date, then the errorCB callback is invoked.
+ *
+ * The defaults are: formatLenght="short" and selector="date and time"
+ *
+ * @param {Date} date
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * formatLength {String}: 'short', 'medium', 'long', or 'full'
+ * selector {String}: 'date', 'time', or 'date and time'
+ *
+ * @return Object.value {String}: The localized date string
+ *
+ * @error GlobalizationError.FORMATTING_ERROR
+ *
+ * Example
+ * globalization.dateToString(new Date(),
+ * function (date) {alert('date:' + date.value + '\n');},
+ * function (errorCode) {alert(errorCode);},
+ * {formatLength:'short'});
+ */
+ dateToString:function(date, successCB, failureCB, options) {
+ var dateValue = date.valueOf();
+ console.log('exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);');
+
+ var tzdate = null;
+ var format = null;
+
+ tzdate = new tizen.TZDate(date);
+
+ if (tzdate) {
+ if (options && (options.formatLength == 'short') ){
+ format = tzdate.toLocaleDateString();
+ }
+ else{
+ format = tzdate.toLocaleString();
+ }
+ console.log('Cordova, globalization, dateToString ' +format);
}
- );
-},
-
-
-/**
-* Returns a date formatted as a string according to the client's user preferences and
-* calendar using the time zone of the client. It returns the formatted date string to the
-* successCB callback with a properties object as a parameter. If there is an error
-* formatting the date, then the errorCB callback is invoked.
-*
-* The defaults are: formatLenght="short" and selector="date and time"
-*
-* @param {Date} date
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* formatLength {String}: 'short', 'medium', 'long', or 'full'
-* selector {String}: 'date', 'time', or 'date and time'
-*
-* @return Object.value {String}: The localized date string
-*
-* @error GlobalizationError.FORMATTING_ERROR
-*
-* Example
-* globalization.dateToString(new Date(),
-* function (date) {alert('date:' + date.value + '\n');},
-* function (errorCode) {alert(errorCode);},
-* {formatLength:'short'});
-*/
-dateToString:function(date, successCB, failureCB, options) {
- var dateValue = date.valueOf();
- console.log('exec(successCB, failureCB, "Globalization", "dateToString", [{"date": dateValue, "options": options}]);');
-
- var tzdate = null;
- var format = null;
-
- tzdate = new tizen.TZDate(date);
- if (tzdate) {
- if (options && (options.formatLength == 'short') ){
- format = tzdate.toLocaleDateString();
+ if (format)
+ {
+ successCB ({"value": format});
}
- else{
- format = tzdate.toLocaleString();
+ else {
+ failureCB(new GlobalizationError(GlobalizationError.FORMATTING_ERROR , "cannot format date string"));
}
- console.log('Cordova, globalization, dateToString ' +format);
- }
-
- if (format)
- {
- successCB ({"value": format});
- }
- else {
- failureCB(new GlobalizationError(GlobalizationError.FORMATTING_ERROR , "cannot format date string"));
- }
-},
-
-
-/**
-* Parses a date formatted as a string according to the client's user
-* preferences and calendar using the time zone of the client and returns
-* the corresponding date object. It returns the date to the successCB
-* callback with a properties object as a parameter. If there is an error
-* parsing the date string, then the errorCB callback is invoked.
-*
-* The defaults are: formatLength="short" and selector="date and time"
-*
-* @param {String} dateString
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* formatLength {String}: 'short', 'medium', 'long', or 'full'
-* selector {String}: 'date', 'time', or 'date and time'
-*
-* @return Object.year {Number}: The four digit year
-* Object.month {Number}: The month from (0 - 11)
-* Object.day {Number}: The day from (1 - 31)
-* Object.hour {Number}: The hour from (0 - 23)
-* Object.minute {Number}: The minute from (0 - 59)
-* Object.second {Number}: The second from (0 - 59)
-* Object.millisecond {Number}: The milliseconds (from 0 - 999),
-* not available on all platforms
-*
-* @error GlobalizationError.PARSING_ERROR
-*
-* Example
-* globalization.stringToDate('4/11/2011',
-* function (date) { alert('Month:' + date.month + '\n' +
-* 'Day:' + date.day + '\n' +
-* 'Year:' + date.year + '\n');},
-* function (errorCode) {alert(errorCode);},
-* {selector:'date'});
-*/
-stringToDate:function(dateString, successCB, failureCB, options) {
- argscheck.checkArgs('sfFO', 'Globalization.stringToDate', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.PARSING_ERROR , "unsupported"));
-},
-
-
-/**
-* Returns a pattern string for formatting and parsing dates according to the client's
-* user preferences. It returns the pattern to the successCB callback with a
-* properties object as a parameter. If there is an error obtaining the pattern,
-* then the errorCB callback is invoked.
-*
-* The defaults are: formatLength="short" and selector="date and time"
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* formatLength {String}: 'short', 'medium', 'long', or 'full'
-* selector {String}: 'date', 'time', or 'date and time'
-*
-* @return Object.pattern {String}: The date and time pattern for formatting and parsing dates.
-* The patterns follow Unicode Technical Standard #35
-* http://unicode.org/reports/tr35/tr35-4.html
-* Object.timezone {String}: The abbreviated name of the time zone on the client
-* Object.utc_offset {Number}: The current difference in seconds between the client's
-* time zone and coordinated universal time.
-* Object.dst_offset {Number}: The current daylight saving time offset in seconds
-* between the client's non-daylight saving's time zone
-* and the client's daylight saving's time zone.
-*
-* @error GlobalizationError.PATTERN_ERROR
-*
-* Example
-* globalization.getDatePattern(
-* function (date) {alert('pattern:' + date.pattern + '\n');},
-* function () {},
-* {formatLength:'short'});
-*/
-getDatePattern:function(successCB, failureCB, options) {
- console.log(' exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);');
-
- var shortFormat = (options) ? ( options.formatLength === 'short') : true;
-
- var formatString = tizen.time.getDateFormat ( shortFormat);
-
-
- var current_datetime = tizen.time.getCurrentDateTime();
-
- // probably will require some control of operation...
- if (formatString)
- {
- successCB(
- {
- "pattern": formatString,
- "timezone": current_datetime.getTimezoneAbbreviation(),
- "utc_offset": current_datetime.difference(current_datetime.toUTC()).length,
- "dst_offset": current_datetime.isDST()
- }
- );
- }
- else {
- failureCB(new GlobalizationError(GlobalizationError.PATTERN_ERROR , "cannot get pattern"));
- }
-},
-
-
-/**
-* Returns an array of either the names of the months or days of the week
-* according to the client's user preferences and calendar. It returns the array of names to the
-* successCB callback with a properties object as a parameter. If there is an error obtaining the
-* names, then the errorCB callback is invoked.
-*
-* The defaults are: type="wide" and item="months"
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'narrow' or 'wide'
-* item {String}: 'months', or 'days'
-*
-* @return Object.value {Array{String}}: The array of names starting from either
-* the first month in the year or the
-* first day of the week.
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getDateNames(function (names) {
-* for(var i = 0; i < names.value.length; i++) {
-* alert('Month:' + names.value[i] + '\n');}},
-* function () {});
-*/
-getDateNames:function(successCB, failureCB, options) {
- argscheck.checkArgs('fFO', 'Globalization.getDateNames', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);');
-
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
-},
-
-/**
-* Returns whether daylight savings time is in effect for a given date using the client's
-* time zone and calendar. It returns whether or not daylight savings time is in effect
-* to the successCB callback with a properties object as a parameter. If there is an error
-* reading the date, then the errorCB callback is invoked.
-*
-* @param {Date} date
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.dst {Boolean}: The value "true" indicates that daylight savings time is
-* in effect for the given date and "false" indicate that it is not.
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.isDayLightSavingsTime(new Date(),
-* function (date) {alert('dst:' + date.dst + '\n');}
-* function () {});
-*/
-isDayLightSavingsTime:function(date, successCB, failureCB) {
-
- var tzdate = null,
- isDLS = false;
-
- console.log('exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);');
- console.log("date " + date + " value " + date.valueOf()) ;
-
- tzdate = new tizen.TZDate(date);
- if (tzdate) {
- isDLS = false | (tzdate && tzdate.isDST());
-
- console.log ("Cordova, globalization, isDayLightSavingsTime, " + isDLS);
-
- successCB({"dst":isDLS});
- }
- else {
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot get information"));
+ },
+
+
+ /**
+ * Parses a date formatted as a string according to the client's user
+ * preferences and calendar using the time zone of the client and returns
+ * the corresponding date object. It returns the date to the successCB
+ * callback with a properties object as a parameter. If there is an error
+ * parsing the date string, then the errorCB callback is invoked.
+ *
+ * The defaults are: formatLength="short" and selector="date and time"
+ *
+ * @param {String} dateString
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * formatLength {String}: 'short', 'medium', 'long', or 'full'
+ * selector {String}: 'date', 'time', or 'date and time'
+ *
+ * @return Object.year {Number}: The four digit year
+ * Object.month {Number}: The month from (0 - 11)
+ * Object.day {Number}: The day from (1 - 31)
+ * Object.hour {Number}: The hour from (0 - 23)
+ * Object.minute {Number}: The minute from (0 - 59)
+ * Object.second {Number}: The second from (0 - 59)
+ * Object.millisecond {Number}: The milliseconds (from 0 - 999),
+ * not available on all platforms
+ *
+ * @error GlobalizationError.PARSING_ERROR
+ *
+ * Example
+ * globalization.stringToDate('4/11/2011',
+ * function (date) { alert('Month:' + date.month + '\n' +
+ * 'Day:' + date.day + '\n' +
+ * 'Year:' + date.year + '\n');},
+ * function (errorCode) {alert(errorCode);},
+ * {selector:'date'});
+ */
+ stringToDate:function(dateString, successCB, failureCB, options) {
+ argscheck.checkArgs('sfFO', 'Globalization.stringToDate', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "stringToDate", [{"dateString": dateString, "options": options}]);');
+
+ //not supported
+ failureCB(new GlobalizationError(GlobalizationError.PARSING_ERROR , "unsupported"));
+ },
+
+
+ /**
+ * Returns a pattern string for formatting and parsing dates according to the client's
+ * user preferences. It returns the pattern to the successCB callback with a
+ * properties object as a parameter. If there is an error obtaining the pattern,
+ * then the errorCB callback is invoked.
+ *
+ * The defaults are: formatLength="short" and selector="date and time"
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * formatLength {String}: 'short', 'medium', 'long', or 'full'
+ * selector {String}: 'date', 'time', or 'date and time'
+ *
+ * @return Object.pattern {String}: The date and time pattern for formatting and parsing dates.
+ * The patterns follow Unicode Technical Standard #35
+ * http://unicode.org/reports/tr35/tr35-4.html
+ * Object.timezone {String}: The abbreviated name of the time zone on the client
+ * Object.utc_offset {Number}: The current difference in seconds between the client's
+ * time zone and coordinated universal time.
+ * Object.dst_offset {Number}: The current daylight saving time offset in seconds
+ * between the client's non-daylight saving's time zone
+ * and the client's daylight saving's time zone.
+ *
+ * @error GlobalizationError.PATTERN_ERROR
+ *
+ * Example
+ * globalization.getDatePattern(
+ * function (date) {alert('pattern:' + date.pattern + '\n');},
+ * function () {},
+ * {formatLength:'short'});
+ */
+ getDatePattern:function(successCB, failureCB, options) {
+ console.log(' exec(successCB, failureCB, "Globalization", "getDatePattern", [{"options": options}]);');
+
+ var shortFormat = (options) ? ( options.formatLength === 'short') : true;
+
+ var formatString = tizen.time.getDateFormat ( shortFormat);
+
+
+ var current_datetime = tizen.time.getCurrentDateTime();
+
+ // probably will require some control of operation...
+ if (formatString)
+ {
+ successCB(
+ {
+ "pattern": formatString,
+ "timezone": current_datetime.getTimezoneAbbreviation(),
+ "utc_offset": current_datetime.difference(current_datetime.toUTC()).length,
+ "dst_offset": current_datetime.isDST()
+ }
+ );
+ }
+ else {
+ failureCB(new GlobalizationError(GlobalizationError.PATTERN_ERROR , "cannot get pattern"));
+ }
+ },
+
+
+ /**
+ * Returns an array of either the names of the months or days of the week
+ * according to the client's user preferences and calendar. It returns the array of names to the
+ * successCB callback with a properties object as a parameter. If there is an error obtaining the
+ * names, then the errorCB callback is invoked.
+ *
+ * The defaults are: type="wide" and item="months"
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * type {String}: 'narrow' or 'wide'
+ * item {String}: 'months', or 'days'
+ *
+ * @return Object.value {Array{String}}: The array of names starting from either
+ * the first month in the year or the
+ * first day of the week.
+ * @error GlobalizationError.UNKNOWN_ERROR
+ *
+ * Example
+ * globalization.getDateNames(function (names) {
+ * for(var i = 0; i < names.value.length; i++) {
+ * alert('Month:' + names.value[i] + '\n');}},
+ * function () {});
+ */
+ getDateNames:function(successCB, failureCB, options) {
+ argscheck.checkArgs('fFO', 'Globalization.getDateNames', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "getDateNames", [{"options": options}]);');
+
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+ },
+
+ /**
+ * Returns whether daylight savings time is in effect for a given date using the client's
+ * time zone and calendar. It returns whether or not daylight savings time is in effect
+ * to the successCB callback with a properties object as a parameter. If there is an error
+ * reading the date, then the errorCB callback is invoked.
+ *
+ * @param {Date} date
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ *
+ * @return Object.dst {Boolean}: The value "true" indicates that daylight savings time is
+ * in effect for the given date and "false" indicate that it is not.
+ *
+ * @error GlobalizationError.UNKNOWN_ERROR
+ *
+ * Example
+ * globalization.isDayLightSavingsTime(new Date(),
+ * function (date) {alert('dst:' + date.dst + '\n');}
+ * function () {});
+ */
+ isDayLightSavingsTime:function(date, successCB, failureCB) {
+
+ var tzdate = null,
+ isDLS = false;
+
+ console.log('exec(successCB, failureCB, "Globalization", "isDayLightSavingsTime", [{"date": dateValue}]);');
+ console.log("date " + date + " value " + date.valueOf()) ;
+
+ tzdate = new tizen.TZDate(date);
+ if (tzdate) {
+ isDLS = false | (tzdate && tzdate.isDST());
+
+ console.log ("Cordova, globalization, isDayLightSavingsTime, " + isDLS);
+
+ successCB({"dst":isDLS});
+ }
+ else {
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "cannot get information"));
+ }
+ },
+
+ /**
+ * Returns the first day of the week according to the client's user preferences and calendar.
+ * The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
+ * It returns the day to the successCB callback with a properties object as a parameter.
+ * If there is an error obtaining the pattern, then the errorCB callback is invoked.
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ *
+ * @return Object.value {Number}: The number of the first day of the week.
+ *
+ * @error GlobalizationError.UNKNOWN_ERROR
+ *
+ * Example
+ * globalization.getFirstDayOfWeek(function (day)
+ * { alert('Day:' + day.value + '\n');},
+ * function () {});
+ */
+ getFirstDayOfWeek:function(successCB, failureCB) {
+ argscheck.checkArgs('fF', 'Globalization.getFirstDayOfWeek', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);');
+
+ // there is no API to get the fist day of the week in Tizen Dvice API
+ successCB({value:1});
+
+ // first day of week is a settings in the date book app
+ // what about : getting the settings directly or asking the date book ?
+ },
+
+
+ /**
+ * Returns a number formatted as a string according to the client's user preferences.
+ * It returns the formatted number string to the successCB callback with a properties object as a
+ * parameter. If there is an error formatting the number, then the errorCB callback is invoked.
+ *
+ * The defaults are: type="decimal"
+ *
+ * @param {Number} number
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * type {String}: 'decimal', "percent", or 'currency'
+ *
+ * @return Object.value {String}: The formatted number string.
+ *
+ * @error GlobalizationError.FORMATTING_ERROR
+ *
+ * Example
+ * globalization.numberToString(3.25,
+ * function (number) {alert('number:' + number.value + '\n');},
+ * function () {},
+ * {type:'decimal'});
+ */
+ numberToString:function(number, successCB, failureCB, options) {
+ argscheck.checkArgs('nfFO', 'Globalization.numberToString', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);');
+ //not supported
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+ },
+
+ /**
+ * Parses a number formatted as a string according to the client's user preferences and
+ * returns the corresponding number. It returns the number to the successCB callback with a
+ * properties object as a parameter. If there is an error parsing the number string, then
+ * the errorCB callback is invoked.
+ *
+ * The defaults are: type="decimal"
+ *
+ * @param {String} numberString
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * type {String}: 'decimal', "percent", or 'currency'
+ *
+ * @return Object.value {Number}: The parsed number.
+ *
+ * @error GlobalizationError.PARSING_ERROR
+ *
+ * Example
+ * globalization.stringToNumber('1234.56',
+ * function (number) {alert('Number:' + number.value + '\n');},
+ * function () { alert('Error parsing number');});
+ */
+ stringToNumber:function(numberString, successCB, failureCB, options) {
+ argscheck.checkArgs('sfFO', 'Globalization.stringToNumber', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);');
+
+ //not supported
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+ },
+
+ /**
+ * Returns a pattern string for formatting and parsing numbers according to the client's user
+ * preferences. It returns the pattern to the successCB callback with a properties object as a
+ * parameter. If there is an error obtaining the pattern, then the errorCB callback is invoked.
+ *
+ * The defaults are: type="decimal"
+ *
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ * @param {Object} options {optional}
+ * type {String}: 'decimal', "percent", or 'currency'
+ *
+ * @return Object.pattern {String}: The number pattern for formatting and parsing numbers.
+ * The patterns follow Unicode Technical Standard #35.
+ * http://unicode.org/reports/tr35/tr35-4.html
+ * Object.symbol {String}: The symbol to be used when formatting and parsing
+ * e.g., percent or currency symbol.
+ * Object.fraction {Number}: The number of fractional digits to use when parsing and
+ * formatting numbers.
+ * Object.rounding {Number}: The rounding increment to use when parsing and formatting.
+ * Object.positive {String}: The symbol to use for positive numbers when parsing and formatting.
+ * Object.negative: {String}: The symbol to use for negative numbers when parsing and formatting.
+ * Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
+ * Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
+ *
+ * @error GlobalizationError.PATTERN_ERROR
+ *
+ * Example
+ * globalization.getNumberPattern(
+ * function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
+ * function () {});
+ */
+ getNumberPattern:function(successCB, failureCB, options) {
+ argscheck.checkArgs('fFO', 'Globalization.getNumberPattern', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);');
+
+ //not supported
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
+ },
+
+ /**
+ * Returns a pattern string for formatting and parsing currency values according to the client's
+ * user preferences and ISO 4217 currency code. It returns the pattern to the successCB callback with a
+ * properties object as a parameter. If there is an error obtaining the pattern, then the errorCB
+ * callback is invoked.
+ *
+ * @param {String} currencyCode
+ * @param {Function} successCB
+ * @param {Function} errorCB
+ *
+ * @return Object.pattern {String}: The currency pattern for formatting and parsing currency values.
+ * The patterns follow Unicode Technical Standard #35
+ * http://unicode.org/reports/tr35/tr35-4.html
+ * Object.code {String}: The ISO 4217 currency code for the pattern.
+ * Object.fraction {Number}: The number of fractional digits to use when parsing and
+ * formatting currency.
+ * Object.rounding {Number}: The rounding increment to use when parsing and formatting.
+ * Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
+ * Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
+ *
+ * @error GlobalizationError.FORMATTING_ERROR
+ *
+ * Example
+ * globalization.getCurrencyPattern('EUR',
+ * function (currency) {alert('Pattern:' + currency.pattern + '\n');}
+ * function () {});
+ */
+ getCurrencyPattern:function(currencyCode, successCB, failureCB) {
+ argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
+ console.log('exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);');
+
+ //not supported
+ failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
}
-},
-
-/**
-* Returns the first day of the week according to the client's user preferences and calendar.
-* The days of the week are numbered starting from 1 where 1 is considered to be Sunday.
-* It returns the day to the successCB callback with a properties object as a parameter.
-* If there is an error obtaining the pattern, then the errorCB callback is invoked.
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.value {Number}: The number of the first day of the week.
-*
-* @error GlobalizationError.UNKNOWN_ERROR
-*
-* Example
-* globalization.getFirstDayOfWeek(function (day)
-* { alert('Day:' + day.value + '\n');},
-* function () {});
-*/
-getFirstDayOfWeek:function(successCB, failureCB) {
- argscheck.checkArgs('fF', 'Globalization.getFirstDayOfWeek', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getFirstDayOfWeek", []);');
-
- // there is no API to get the fist day of the week in Tizen Dvice API
- successCB({value:1});
-
- // first day of week is a settings in the date book app
- // what about : getting the settings directly or asking the date book ?
-},
-
-
-/**
-* Returns a number formatted as a string according to the client's user preferences.
-* It returns the formatted number string to the successCB callback with a properties object as a
-* parameter. If there is an error formatting the number, then the errorCB callback is invoked.
-*
-* The defaults are: type="decimal"
-*
-* @param {Number} number
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'decimal', "percent", or 'currency'
-*
-* @return Object.value {String}: The formatted number string.
-*
-* @error GlobalizationError.FORMATTING_ERROR
-*
-* Example
-* globalization.numberToString(3.25,
-* function (number) {alert('number:' + number.value + '\n');},
-* function () {},
-* {type:'decimal'});
-*/
-numberToString:function(number, successCB, failureCB, options) {
- argscheck.checkArgs('nfFO', 'Globalization.numberToString', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "numberToString", [{"number": number, "options": options}]);');
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
-},
-
-/**
-* Parses a number formatted as a string according to the client's user preferences and
-* returns the corresponding number. It returns the number to the successCB callback with a
-* properties object as a parameter. If there is an error parsing the number string, then
-* the errorCB callback is invoked.
-*
-* The defaults are: type="decimal"
-*
-* @param {String} numberString
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'decimal', "percent", or 'currency'
-*
-* @return Object.value {Number}: The parsed number.
-*
-* @error GlobalizationError.PARSING_ERROR
-*
-* Example
-* globalization.stringToNumber('1234.56',
-* function (number) {alert('Number:' + number.value + '\n');},
-* function () { alert('Error parsing number');});
-*/
-stringToNumber:function(numberString, successCB, failureCB, options) {
- argscheck.checkArgs('sfFO', 'Globalization.stringToNumber', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "stringToNumber", [{"numberString": numberString, "options": options}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
-},
-
-/**
-* Returns a pattern string for formatting and parsing numbers according to the client's user
-* preferences. It returns the pattern to the successCB callback with a properties object as a
-* parameter. If there is an error obtaining the pattern, then the errorCB callback is invoked.
-*
-* The defaults are: type="decimal"
-*
-* @param {Function} successCB
-* @param {Function} errorCB
-* @param {Object} options {optional}
-* type {String}: 'decimal', "percent", or 'currency'
-*
-* @return Object.pattern {String}: The number pattern for formatting and parsing numbers.
-* The patterns follow Unicode Technical Standard #35.
-* http://unicode.org/reports/tr35/tr35-4.html
-* Object.symbol {String}: The symbol to be used when formatting and parsing
-* e.g., percent or currency symbol.
-* Object.fraction {Number}: The number of fractional digits to use when parsing and
-* formatting numbers.
-* Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-* Object.positive {String}: The symbol to use for positive numbers when parsing and formatting.
-* Object.negative: {String}: The symbol to use for negative numbers when parsing and formatting.
-* Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-* Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-*
-* @error GlobalizationError.PATTERN_ERROR
-*
-* Example
-* globalization.getNumberPattern(
-* function (pattern) {alert('Pattern:' + pattern.pattern + '\n');},
-* function () {});
-*/
-getNumberPattern:function(successCB, failureCB, options) {
- argscheck.checkArgs('fFO', 'Globalization.getNumberPattern', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getNumberPattern", [{"options": options}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
-},
-
-/**
-* Returns a pattern string for formatting and parsing currency values according to the client's
-* user preferences and ISO 4217 currency code. It returns the pattern to the successCB callback with a
-* properties object as a parameter. If there is an error obtaining the pattern, then the errorCB
-* callback is invoked.
-*
-* @param {String} currencyCode
-* @param {Function} successCB
-* @param {Function} errorCB
-*
-* @return Object.pattern {String}: The currency pattern for formatting and parsing currency values.
-* The patterns follow Unicode Technical Standard #35
-* http://unicode.org/reports/tr35/tr35-4.html
-* Object.code {String}: The ISO 4217 currency code for the pattern.
-* Object.fraction {Number}: The number of fractional digits to use when parsing and
-* formatting currency.
-* Object.rounding {Number}: The rounding increment to use when parsing and formatting.
-* Object.decimal: {String}: The decimal symbol to use for parsing and formatting.
-* Object.grouping: {String}: The grouping symbol to use for parsing and formatting.
-*
-* @error GlobalizationError.FORMATTING_ERROR
-*
-* Example
-* globalization.getCurrencyPattern('EUR',
-* function (currency) {alert('Pattern:' + currency.pattern + '\n');}
-* function () {});
-*/
-getCurrencyPattern:function(currencyCode, successCB, failureCB) {
- argscheck.checkArgs('sfF', 'Globalization.getCurrencyPattern', arguments);
- console.log('exec(successCB, failureCB, "Globalization", "getCurrencyPattern", [{"currencyCode": currencyCode}]);');
-
- //not supported
- failureCB(new GlobalizationError(GlobalizationError.UNKNOWN_ERROR , "unsupported"));
-}
};
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/Media.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Media.js b/lib/tizen/plugin/tizen/Media.js
index e3161d2..546df40 100644
--- a/lib/tizen/plugin/tizen/Media.js
+++ b/lib/tizen/plugin/tizen/Media.js
@@ -97,7 +97,7 @@ module.exports = {
audioObjects[id].play();
};
- },
+ },
startPlayingAudio: function (successCallback, errorCallback, args) {
var id = args[0], src = args[1], options = args[2];
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c72e3213/lib/tizen/plugin/tizen/MediaError.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/MediaError.js b/lib/tizen/plugin/tizen/MediaError.js
index aa2db5b..534aab7 100644
--- a/lib/tizen/plugin/tizen/MediaError.js
+++ b/lib/tizen/plugin/tizen/MediaError.js
@@ -24,6 +24,6 @@
// version from being defined. This object is used to merge in differences
// between Tizen and Cordova MediaError objects.
module.exports = {
- MEDIA_ERR_NONE_ACTIVE : 0,
- MEDIA_ERR_NONE_SUPPORTED : 4
+ MEDIA_ERR_NONE_ACTIVE : 0,
+ MEDIA_ERR_NONE_SUPPORTED : 4
};
[06/25] js commit: [All][CB-4016] plugin loading uses script
injection to load cordova_plugins.js (cherry picked from commit
0ce47184000f9187654e1532265b9c9ae0c93330)
Posted by ag...@apache.org.
[All][CB-4016] plugin loading uses script injection to load cordova_plugins.js
(cherry picked from commit 0ce47184000f9187654e1532265b9c9ae0c93330)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/af01151c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/af01151c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/af01151c
Branch: refs/heads/2.9.x
Commit: af01151cba7824d974e0277cb48dd7d1d241a962
Parents: 931e771
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Jul 9 18:43:26 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:35:13 2013 -0400
----------------------------------------------------------------------
lib/common/pluginloader.js | 38 +++++---------------------------------
1 file changed, 5 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/af01151c/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
index f160312..4b5955d 100644
--- a/lib/common/pluginloader.js
+++ b/lib/common/pluginloader.js
@@ -33,11 +33,12 @@ function scriptLoadedCallback() {
}
// Helper function to inject a <script> tag.
-function injectScript(url, onload) {
+function injectScript(url, onload, onerror) {
scriptCounter++;
var script = document.createElement("script");
// onload fires even when script fails loads with an error.
script.onload = onload;
+ script.onerror = onerror;
script.src = url;
document.head.appendChild(script);
}
@@ -104,7 +105,7 @@ function injectPluginScript(pathPrefix) {
// this is an acceptable error, pre-3.0.0, so we just move on.
finishPluginLoading();
}
- });
+ },finishPluginLoading); // also, add script load error handler for file not found
}
function findCordovaPath() {
@@ -127,38 +128,9 @@ function findCordovaPath() {
exports.load = function() {
var pathPrefix = findCordovaPath();
if (pathPrefix === null) {
- console.warn('Could not find cordova.js script tag. Plugin loading may fail.');
+ console.log('Could not find cordova.js script tag. Plugin loading may fail.');
pathPrefix = '';
}
-
- // Try to XHR the cordova_plugins.json file asynchronously.
- var xhr = new XMLHttpRequest();
- xhr.onload = function() {
- // If the response is a JSON string which composes an array, call handlePluginsObject.
- // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
- var obj;
- try {
- obj = (this.status === 0 || this.status === 200) && this.responseText && JSON.parse(this.responseText);
- } catch (err) {
- // obj will be undefined.
- }
- if (Array.isArray(obj) && obj.length > 0) {
- moduleList = obj;
- handlePluginsObject(pathPrefix);
- } else {
- finishPluginLoading();
- }
- };
- xhr.onerror = function() {
- // One some phones (Windows) this xhr.open throws an Access Denied exception
- // So lets keep trying, but with a script tag injection technique instead of XHR
- injectPluginScript(pathPrefix);
- };
- try {
- xhr.open('GET', pathPrefix + 'cordova_plugins.json', true); // Async
- xhr.send();
- } catch(err){
- injectPluginScript(pathPrefix);
- }
+ injectPluginScript(pathPrefix);
};
[13/25] js commit: [CB-4004] Fix Android JS bridge break caused by
bad rebase before 5ba835c (cherry picked from commit
50f8dbb030e0eba700b50dc00188468467e1f9a4)
Posted by ag...@apache.org.
[CB-4004] Fix Android JS bridge break caused by bad rebase before 5ba835c
(cherry picked from commit 50f8dbb030e0eba700b50dc00188468467e1f9a4)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/41a2e9e2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/41a2e9e2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/41a2e9e2
Branch: refs/heads/2.9.x
Commit: 41a2e9e252f2996e8422b57cfcc62fce8786e070
Parents: 192aff3
Author: Ian Clelland <ic...@chromium.org>
Authored: Tue Jul 16 13:45:23 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:36:46 2013 -0400
----------------------------------------------------------------------
lib/android/exec.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/41a2e9e2/lib/android/exec.js
----------------------------------------------------------------------
diff --git a/lib/android/exec.js b/lib/android/exec.js
index f55b5ad..08d3e56 100644
--- a/lib/android/exec.js
+++ b/lib/android/exec.js
@@ -75,7 +75,7 @@ function androidExec(success, fail, service, action, args) {
// Process any ArrayBuffers in the args into a string.
for (var i = 0; i < args.length; i++) {
if (utils.typeName(args[i]) == 'ArrayBuffer') {
- args[i] = utils.encodeBase64(args[i]);
+ args[i] = base64.fromArrayBuffer(args[i]);
}
}
[24/25] js commit: Fix packager to not add commit hash when creating
a tagged version
Posted by ag...@apache.org.
Fix packager to not add commit hash when creating a tagged version
Was adding -0-HASH to version when we just want the tag.
(cherry picked from commit 606ff75941f6ec4bbec745e1489aa840bb8ed885)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/75d26440
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/75d26440
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/75d26440
Branch: refs/heads/2.9.x
Commit: 75d264406fe26a5dc2ac95fe0322093ef147c1d2
Parents: 6d4c79d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 17 10:00:11 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:42:11 2013 -0400
----------------------------------------------------------------------
build/packager.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/75d26440/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index 77a53a8..e742d3e 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -32,7 +32,7 @@ packager.computeCommitId = function(callback) {
}
if (fs.existsSync('.git')) {
var gitPath = 'git';
- var args = 'describe --tags --long';
+ var args = 'describe --tags';
childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
var isWindows = process.platform.slice(0, 3) == 'win';
if (err && isWindows) {
[12/25] js commit: [CB-4187] Fix start-up stalling when no plugins
are installed. (cherry picked from commit
e74c3f136dae6d5f38ce3370a1927b58ab47a0fc)
Posted by ag...@apache.org.
[CB-4187] Fix start-up stalling when no plugins are installed.
(cherry picked from commit e74c3f136dae6d5f38ce3370a1927b58ab47a0fc)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/192aff34
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/192aff34
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/192aff34
Branch: refs/heads/2.9.x
Commit: 192aff34b23de6fde7c60628b037aa464a832c55
Parents: e13fbe7
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Jul 11 21:59:21 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:36:30 2013 -0400
----------------------------------------------------------------------
lib/common/pluginloader.js | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/192aff34/lib/common/pluginloader.js
----------------------------------------------------------------------
diff --git a/lib/common/pluginloader.js b/lib/common/pluginloader.js
index 002f944..5f61b39 100644
--- a/lib/common/pluginloader.js
+++ b/lib/common/pluginloader.js
@@ -79,6 +79,11 @@ function finishPluginLoading() {
function handlePluginsObject(path, moduleList) {
// Now inject the scripts.
var scriptCounter = moduleList.length;
+
+ if (!scriptCounter) {
+ onScriptLoadingComplete();
+ return;
+ }
function scriptLoadedCallback() {
if (!--scriptCounter) {
onScriptLoadingComplete(moduleList);
[25/25] js commit: Change build stamp again by having it use only
VERSION file on master branch
Posted by ag...@apache.org.
Change build stamp again by having it use only VERSION file on master branch
This will have it show "3.2.0-dev-HASH" on master even though there is
no "3.2.0-dev" git tag.
(cherry picked from commit 8e5a2e730da70b8a8f597c7fba9bc328e0d89546)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/af4bcf4b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/af4bcf4b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/af4bcf4b
Branch: refs/heads/2.9.x
Commit: af4bcf4b45a8eed33cf8443319d720d11ae808eb
Parents: 75d2644
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 17 10:09:33 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:42:21 2013 -0400
----------------------------------------------------------------------
build/packager.js | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/af4bcf4b/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index e742d3e..909b140 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -30,9 +30,10 @@ packager.computeCommitId = function(callback) {
callback(cachedGitVersion);
return;
}
- if (fs.existsSync('.git')) {
+ var versionFileId = fs.readFileSync('VERSION', { encoding: 'utf8' }).trim();
+ if (/-dev$/.test(versionFileId) && fs.existsSync('.git')) {
var gitPath = 'git';
- var args = 'describe --tags';
+ var args = 'rev-list HEAD --max-count=1 --abbrev-commit';
childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
var isWindows = process.platform.slice(0, 3) == 'win';
if (err && isWindows) {
@@ -41,13 +42,13 @@ packager.computeCommitId = function(callback) {
if (err) {
error(err);
} else {
- done(stdout);
+ done(versionFileId + '-' + stdout);
}
});
} else if (err) {
error(err);
} else {
- done(stdout);
+ done(versionFileId + '-' + stdout);
}
});
} else {
[22/25] js commit: [CB-4149] Read version from VERSION when there is
no .git/ (cherry picked from commit 6140e1683c3df47a698748636c405fed3d2273f4)
Posted by ag...@apache.org.
[CB-4149] Read version from VERSION when there is no .git/
(cherry picked from commit 6140e1683c3df47a698748636c405fed3d2273f4)
Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/f87145b1
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/f87145b1
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/f87145b1
Branch: refs/heads/2.9.x
Commit: f87145b146ef8e23d67547b798641b55a240415e
Parents: 6e6ff82
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Sep 11 22:13:09 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Oct 22 11:41:44 2013 -0400
----------------------------------------------------------------------
build/packager.js | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-js/blob/f87145b1/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index 7e2f19b..77a53a8 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -30,32 +30,36 @@ packager.computeCommitId = function(callback) {
callback(cachedGitVersion);
return;
}
- var gitPath = 'git';
- var args = 'describe --tags --long';
- childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
- var isWindows = process.platform.slice(0, 3) == 'win';
- if (err && isWindows) {
- gitPath = '"' + path.join(process.env['ProgramFiles'], 'Git', 'bin', 'git.exe') + '"';
- childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
- if (err) {
- error(err);
- } else {
- done(stdout);
- }
- });
- } else if (err) {
- error(err);
- } else {
- done(stdout);
- }
- });
+ if (fs.existsSync('.git')) {
+ var gitPath = 'git';
+ var args = 'describe --tags --long';
+ childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
+ var isWindows = process.platform.slice(0, 3) == 'win';
+ if (err && isWindows) {
+ gitPath = '"' + path.join(process.env['ProgramFiles'], 'Git', 'bin', 'git.exe') + '"';
+ childProcess.exec(gitPath + ' ' + args, function(err, stdout, stderr) {
+ if (err) {
+ error(err);
+ } else {
+ done(stdout);
+ }
+ });
+ } else if (err) {
+ error(err);
+ } else {
+ done(stdout);
+ }
+ });
+ } else {
+ done(fs.readFileSync('VERSION', { encoding: 'utf8' }));
+ }
function error(err) {
throw new Error(err);
}
function done(stdout) {
- var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
+ var version = stdout.trim();
cachedGitVersion = version;
callback(version);
};