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/06/28 16:15:25 UTC

[01/26] js commit: [CB-3739][Tizen][Tizen SDK 2.1 Nectarine] - globalize API

Updated Branches:
  refs/heads/2.9.x 83dc4bd90 -> e63317e54


[CB-3739][Tizen][Tizen SDK 2.1 Nectarine]  - globalize API

provide a partial implementation using Tizen Device API

Using Device API is definitely not the right way as the support is partial
due to a lack of support of globalization from the tizen Web APIs

Tizen Web UI framework is using Globilize.js
So I will go with Globalize.js in order to provide a full support
Globalize.js was originally a jQuery plugin but is now independant as a JavaScript library


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/be7fa320
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/be7fa320
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/be7fa320

Branch: refs/heads/2.9.x
Commit: be7fa3204fc993a056e6e1f585e816d98937af95
Parents: 3068eff
Author: pplaquette <pp...@apache.org>
Authored: Tue Jun 18 18:42:53 2013 +0200
Committer: pplaquette <pp...@apache.org>
Committed: Tue Jun 18 18:42:53 2013 +0200

----------------------------------------------------------------------
 lib/tizen/plugin/tizen/Globalization.js | 118 +++++++++++++++++++++++++--
 1 file changed, 111 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/be7fa320/lib/tizen/plugin/tizen/Globalization.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/Globalization.js b/lib/tizen/plugin/tizen/Globalization.js
index c1c51e6..aa7f94a 100644
--- a/lib/tizen/plugin/tizen/Globalization.js
+++ b/lib/tizen/plugin/tizen/Globalization.js
@@ -19,6 +19,9 @@
  *
 */
 
+
+/*global tizen:false */
+
 var argscheck = require('cordova/argscheck'),
     exec = require('cordova/exec'),
     GlobalizationError = require('cordova/plugin/GlobalizationError');
@@ -43,8 +46,19 @@ var globalization = {
 *                                function () {});
 */
 getPreferredLanguage:function(successCB, failureCB) {
-    argscheck.checkArgs('fF', 'Globalization.getPreferredLanguage', arguments);
     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"));
+        }
+    );
 },
 
 /**
@@ -65,8 +79,17 @@ getPreferredLanguage:function(successCB, failureCB) {
 *                                function () {});
 */
 getLocaleName:function(successCB, failureCB) {
-    argscheck.checkArgs('fF', 'Globalization.getLocaleName', arguments);
-    console.log('exec(successCB, failureCB, "Globalization","getLocaleName", []);');
+    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"));
+        }
+    );
 },
 
 
@@ -96,9 +119,31 @@ getLocaleName:function(successCB, failureCB) {
 *                {formatLength:'short'});
 */
 dateToString:function(date, successCB, failureCB, options) {
-    argscheck.checkArgs('dfFO', 'Globalization.dateToString', arguments);
     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);
+    }
+
+    if (format)
+    {
+        successCB ({"value": format});
+    }
+    else {
+        failureCB(new GlobalizationError(GlobalizationError.FORMATTING_ERROR , "cannot format date string"));
+    }
 },
 
 
@@ -140,6 +185,9 @@ dateToString:function(date, successCB, failureCB, options) {
 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"));
 },
 
 
@@ -176,8 +224,30 @@ stringToDate:function(dateString, successCB, failureCB, options) {
 *                {formatLength:'short'});
 */
 getDatePattern:function(successCB, failureCB, options) {
-    argscheck.checkArgs('fFO', 'Globalization.getDatePattern', arguments);
     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"));
+    }
 },
 
 
@@ -209,6 +279,8 @@ getDatePattern:function(successCB, failureCB, options) {
 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"));
 },
 
 /**
@@ -232,9 +304,24 @@ getDateNames:function(successCB, failureCB, options) {
 *                function () {});
 */
 isDayLightSavingsTime:function(date, successCB, failureCB) {
-    argscheck.checkArgs('dfF', 'Globalization.isDayLightSavingsTime', arguments);
-    var dateValue = date.valueOf();
+
+    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"));
+    }
 },
 
 /**
@@ -258,6 +345,12 @@ isDayLightSavingsTime:function(date, successCB, failureCB) {
 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 ?
 },
 
 
@@ -287,6 +380,8 @@ getFirstDayOfWeek:function(successCB, failureCB) {
 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"));
 },
 
 /**
@@ -315,6 +410,9 @@ numberToString:function(number, successCB, failureCB, options) {
 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"));
 },
 
 /**
@@ -352,6 +450,9 @@ stringToNumber:function(numberString, successCB, failureCB, options) {
 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"));
 },
 
 /**
@@ -384,6 +485,9 @@ getNumberPattern:function(successCB, failureCB, options) {
 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"));
 }
 
 };


[23/26] js commit: Move computing of commit ID into packager.js (cherry picked from commit 232f389252c94d3f7b5404ccb8c4b96fcf5467fa)

Posted by ag...@apache.org.
Move computing of commit ID into packager.js
(cherry picked from commit 232f389252c94d3f7b5404ccb8c4b96fcf5467fa)


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/2d5fe122
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/2d5fe122
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/2d5fe122

Branch: refs/heads/2.9.x
Commit: 2d5fe122f7e9677f2351cec184240749a8a41147
Parents: 41a7576
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 13:15:00 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 28 10:12:24 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js      | 44 +-----------------------
 build/packager.js | 91 ++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 67 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2d5fe122/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 7d46a11..928b456 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,7 +17,6 @@
  * under the License.
 */
 module.exports = function(grunt) {
-    var childProcess = require('child_process');
     var fs = require('fs');
     var path = require('path');
 
@@ -83,43 +82,6 @@ module.exports = function(grunt) {
         scan(root);
     }
 
-    var cachedGitVersion = null;
-    function computeGitVersion(callback) {
-        if (cachedGitVersion) {
-            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);
-            }
-        });
-
-        function error(err) {
-            throw new Error(err);
-        }
-
-        function done(stdout) {
-            var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
-            cachedGitVersion = version;
-            callback(version);
-        };
-    }
-
     function processWhiteSpace(processor, callback) {
         var rexp_minified = new RegExp("\\.min\\.js$");
         var rexp_src = new RegExp('\\.js$');
@@ -152,11 +114,7 @@ module.exports = function(grunt) {
         var done = this.async();
         var platformName = this.target;
         var useWindowsLineEndings = this.data.useWindowsLineEndings;
-        computeGitVersion(function(version) {
-            grunt.log.writeln('Build label: ' + version);
-            packager.generate(platformName, version, useWindowsLineEndings);
-            done();
-        });
+        packager.generate(platformName, useWindowsLineEndings, done);
     });
 
     grunt.registerTask('test', 'Runs test in node', function() {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/2d5fe122/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index f81b6a4..d859636 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -17,43 +17,84 @@
  * under the License.
  */
 
+var childProcess = require('child_process');
 var fs    = require('fs')
 var util  = require('util')
 var path  = require('path')
 
 var packager = module.exports
 
-//------------------------------------------------------------------------------
-packager.generate = function(platform, commitId, useWindowsLineEndings) {
-    var outFile;
-    var time = new Date().valueOf();
-
-    var libraryRelease = packager.bundle(platform, false, commitId);
-    // if we are using windows line endings, we will also add the BOM
-    if(useWindowsLineEndings) {
-        libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
-    }
-    var libraryDebug   = packager.bundle(platform, true, commitId);
-    
-    time = new Date().valueOf() - time;
-    if (!fs.existsSync('pkg')) {
-      fs.mkdirSync('pkg');
+var cachedGitVersion = null;
+packager.computeCommitId = function(callback) {
+    if (cachedGitVersion) {
+        callback(cachedGitVersion);
+        return;
     }
-    if(!fs.existsSync('pkg/debug')) {
-        fs.mkdirSync('pkg/debug');
+    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);
+        }
+    });
+
+    function error(err) {
+        throw new Error(err);
     }
 
-    outFile = path.join('pkg', 'cordova.' + platform + '.js');
-    fs.writeFileSync(outFile, libraryRelease, 'utf8');
-    
-    outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
-    fs.writeFileSync(outFile, libraryDebug, 'utf8');
-    
-    console.log('generated platform: ' + platform + ' in ' + time + 'ms');
+    function done(stdout) {
+        var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
+        cachedGitVersion = version;
+        callback(version);
+    };
+}
+
+//------------------------------------------------------------------------------
+packager.generate = function(platform, useWindowsLineEndings, callback) {
+    packager.computeCommitId(function(commitId) {
+        var outFile;
+        var time = new Date().valueOf();
+
+        var libraryRelease = packager.bundle(platform, false, commitId);
+        // if we are using windows line endings, we will also add the BOM
+        if(useWindowsLineEndings) {
+            libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
+        }
+        var libraryDebug   = packager.bundle(platform, true, commitId);
+        
+        time = new Date().valueOf() - time;
+        if (!fs.existsSync('pkg')) {
+            fs.mkdirSync('pkg');
+        }
+        if(!fs.existsSync('pkg/debug')) {
+            fs.mkdirSync('pkg/debug');
+        }
+
+        outFile = path.join('pkg', 'cordova.' + platform + '.js');
+        fs.writeFileSync(outFile, libraryRelease, 'utf8');
+        
+        outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
+        fs.writeFileSync(outFile, libraryDebug, 'utf8');
+        
+        console.log('generated cordova.' + platform + '.js @ ' + commitId + ' in ' + time + 'ms');
+        callback();
+    });
 }
 
 //------------------------------------------------------------------------------
-packager.bundle = function(platform, debug, commitId ) {
+packager.bundle = function(platform, debug, commitId) {
     var modules = collectFiles('lib/common')
     var scripts = collectFiles('lib/scripts')
     


[15/26] js commit: [CB-3834] Missing double quotes in iOS deprecation notice

Posted by ag...@apache.org.
[CB-3834] Missing double quotes in iOS deprecation notice


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/e208322b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/e208322b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/e208322b

Branch: refs/heads/2.9.x
Commit: e208322ba4c6b97e4f02534735e9db4ea02a9c0f
Parents: bfc74d6
Author: Shazron Abdullah <sh...@apache.org>
Authored: Mon Jun 24 15:26:59 2013 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Mon Jun 24 15:26:59 2013 -0700

----------------------------------------------------------------------
 lib/ios/exec.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e208322b/lib/ios/exec.js
----------------------------------------------------------------------
diff --git a/lib/ios/exec.js b/lib/ios/exec.js
index 7023c06..93269c5 100644
--- a/lib/ios/exec.js
+++ b/lib/ios/exec.js
@@ -151,7 +151,7 @@ function iOSExec() {
            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: ' +
-                       "cordova.exec(null, null, \"" + service + "\", " + action + "\"," + JSON.stringify(actionArgs) + ");"
+                       "cordova.exec(null, null, \"" + service + "\", \"" + action + "\"," + JSON.stringify(actionArgs) + ");"
                        );
            return;
        } catch (e) {


[08/26] js commit: [WindowsPhone] Remove DOMStorage Shim in WP8

Posted by ag...@apache.org.
[WindowsPhone] Remove DOMStorage Shim in WP8


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0195db0c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0195db0c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0195db0c

Branch: refs/heads/2.9.x
Commit: 0195db0c9801fd202db3e5fa2940ee963c199ca0
Parents: af24bb7
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jun 21 00:34:25 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jun 21 00:34:25 2013 -0700

----------------------------------------------------------------------
 .../windowsphone/DOMStorage/plugininit.js       | 140 ++++++-------------
 1 file changed, 43 insertions(+), 97 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0195db0c/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
----------------------------------------------------------------------
diff --git a/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js b/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
index c546c0f..c8bd777 100644
--- a/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
+++ b/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
@@ -19,164 +19,112 @@
  *
 */
 
-(function(win,doc) {
-
+(function(win, doc) {
 var docDomain = null;
 try {
     docDomain = doc.domain;
-} catch (err) {
-    //console.log("caught exception trying to access document.domain");
-}
-
-// conditionally patch the window.localStorage and window.sessionStorage objects
-if (!docDomain || docDomain.length === 0) {
-
+} catch (err) {}
+var isIE10 = navigator.userAgent.toUpperCase().indexOf('MSIE 10') > -1;
+if (!isIE10 && (!docDomain || docDomain.length === 0) ) {
     var DOMStorage = function(type) {
-        // default type is local
-        if(type == "sessionStorage") {
+        if (type == "sessionStorage") {
             this._type = type;
         }
-        Object.defineProperty( this, "length", {
+        Object.defineProperty(this, "length", {
             configurable: true,
-            get: function(){ return this.getLength(); }
+            get: function() {
+                return this.getLength();
+            }
         });
     };
-
     DOMStorage.prototype = {
-        _type:"localStorage",
-        _result:null,
-        keys:null,
-
-        onResult:function(key,valueStr) {
-            if(!this.keys) {
+        _type: "localStorage",
+        _result: null,
+        keys: null,
+        onResult: function(key, valueStr) {
+            if (!this.keys) {
                 this.keys = [];
             }
             this._result = valueStr;
         },
-
-        onKeysChanged:function(jsonKeys) {
+        onKeysChanged: function(jsonKeys) {
             this.keys = JSON.parse(jsonKeys);
-
             var key;
-            for(var n = 0,len = this.keys.length; n < len; n++) {
+            for (var n = 0, len = this.keys.length; n < len; n++) {
                 key = this.keys[n];
-                if(!this.hasOwnProperty(key)) {
-                    Object.defineProperty( this, key, {
+                if (!this.hasOwnProperty(key)) {
+                    Object.defineProperty(this, key, {
                         configurable: true,
-                        get: function(){ return this.getItem(key); },
-                        set: function(val){ return this.setItem(key,val); }
+                        get: function() {
+                            return this.getItem(key);
+                        },
+                        set: function(val) {
+                            return this.setItem(key, val);
+                        }
                     });
                 }
             }
-
         },
-
-        initialize:function() {
+        initialize: function() {
             window.external.Notify("DOMStorage/" + this._type + "/load/keys");
         },
-
-    /*
-        The length attribute must return the number of key/value pairs currently present
-        in the list associated with the object.
-    */
-        getLength:function() {
-            if(!this.keys) {
+        getLength: function() {
+            if (!this.keys) {
                 this.initialize();
             }
             return this.keys.length;
         },
-
-    /*
-        The key(n) method must return the name of the nth key in the list.
-        The order of keys is user-agent defined, but must be consistent within an object so long as the number of keys doesn't change.
-        (Thus, adding or removing a key may change the order of the keys, but merely changing the value of an existing key must not.)
-        If n is greater than or equal to the number of key/value pairs in the object, then this method must return null.
-    */
-        key:function(n) {
-            if(!this.keys) {
+        key: function(n) {
+            if (!this.keys) {
                 this.initialize();
             }
-
-            if(n >= this.keys.length) {
+            if (n >= this.keys.length) {
                 return null;
             } else {
                 return this.keys[n];
             }
         },
-
-    /*
-        The getItem(key) method must return the current value associated with the given key.
-        If the given key does not exist in the list associated with the object then this method must return null.
-    */
-        getItem:function(key) {
-            if(!this.keys) {
+        getItem: function(key) {
+            if (!this.keys) {
                 this.initialize();
             }
-
             var retVal = null;
-            if(this.keys.indexOf(key) > -1) {
+            if (this.keys.indexOf(key) > -1) {
                 window.external.Notify("DOMStorage/" + this._type + "/get/" + key);
                 retVal = window.unescape(decodeURIComponent(this._result));
                 this._result = null;
             }
             return retVal;
         },
-    /*
-        The setItem(key, value) method must first check if a key/value pair with the given key already exists
-        in the list associated with the object.
-        If it does not, then a new key/value pair must be added to the list, with the given key and with its value set to value.
-        If the given key does exist in the list, then it must have its value updated to value.
-        If it couldn't set the new value, the method must raise an QUOTA_EXCEEDED_ERR exception.
-        (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
-    */
-        setItem:function(key,value) {
-            if(!this.keys) {
+        setItem: function(key, value) {
+            if (!this.keys) {
                 this.initialize();
             }
             window.external.Notify("DOMStorage/" + this._type + "/set/" + key + "/" + encodeURIComponent(window.escape(value)));
         },
-
-    /*
-        The removeItem(key) method must cause the key/value pair with the given key to be removed from the list
-        associated with the object, if it exists.
-        If no item with that key exists, the method must do nothing.
-    */
-        removeItem:function(key) {
-            if(!this.keys) {
+        removeItem: function(key) {
+            if (!this.keys) {
                 this.initialize();
             }
             var index = this.keys.indexOf(key);
-            if(index > -1) {
-                this.keys.splice(index,1);
-                // TODO: need sanity check for keys ? like 'clear','setItem', ...
+            if (index > -1) {
+                this.keys.splice(index, 1);
                 window.external.Notify("DOMStorage/" + this._type + "/remove/" + key);
                 delete this[key];
             }
         },
-
-    /*
-        The clear() method must atomically cause the list associated with the object to be emptied of all
-        key/value pairs, if there are any.
-        If there are none, then the method must do nothing.
-    */
-        clear:function() {
-            if(!this.keys) {
+        clear: function() {
+            if (!this.keys) {
                 this.initialize();
             }
-
-            for(var n=0,len=this.keys.length; n < len;n++) {
-                // TODO: do we need a sanity check for keys ? like 'clear','setItem', ...
+            for (var n = 0, len = this.keys.length; n < len; n++) {
                 delete this[this.keys[n]];
             }
             this.keys = [];
             window.external.Notify("DOMStorage/" + this._type + "/clear/");
         }
     };
-
-    // initialize DOMStorage
-
     if (typeof window.localStorage === "undefined") {
-
         Object.defineProperty(window, "localStorage", {
             writable: false,
             configurable: false,
@@ -184,7 +132,6 @@ if (!docDomain || docDomain.length === 0) {
         });
         window.localStorage.initialize();
     }
-
     if (typeof window.sessionStorage === "undefined") {
         Object.defineProperty(window, "sessionStorage", {
             writable: false,
@@ -194,7 +141,6 @@ if (!docDomain || docDomain.length === 0) {
         window.sessionStorage.initialize();
     }
 }
-
 })(window, document);
 
-module.exports = null;
+module.exports = null;
\ No newline at end of file


[14/26] js commit: [CB-3992] Allow FileWriter.write() to accept File as argument

Posted by ag...@apache.org.
[CB-3992] Allow FileWriter.write() to accept File as argument


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/bfc74d64
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/bfc74d64
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/bfc74d64

Branch: refs/heads/2.9.x
Commit: bfc74d647e1e0858b7cca4c21ac73efe7ec95380
Parents: b02ec10
Author: Ian Clelland <ic...@chromium.org>
Authored: Mon Jun 24 13:27:44 2013 -0400
Committer: Ian Clelland <ic...@chromium.org>
Committed: Mon Jun 24 14:44:38 2013 -0400

----------------------------------------------------------------------
 lib/common/plugin/FileWriter.js | 35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/bfc74d64/lib/common/plugin/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/FileWriter.js b/lib/common/plugin/FileWriter.js
index 98ee8d6..9cd2ad6 100644
--- a/lib/common/plugin/FileWriter.js
+++ b/lib/common/plugin/FileWriter.js
@@ -97,27 +97,28 @@ FileWriter.prototype.abort = function() {
  */
 FileWriter.prototype.write = function(data) {
 
-    var isBinary = false;
-
-    // If we don't have Blob or ArrayBuffer support, don't bother.
-    if (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined') {
-
-        // Check to see if the incoming data is a blob
-        if (data instanceof Blob) {
-            var that=this;
-            var fileReader = new FileReader();
-            fileReader.onload = function() {
-                // Call this method again, with the arraybuffer as argument
-                FileWriter.prototype.write.call(that, this.result);
-            };
+    var that=this;
+    var supportsBinary = (typeof window.Blob !== 'undefined' && typeof window.ArrayBuffer !== 'undefined');
+    var isBinary;
+
+    // Check to see if the incoming data is a blob
+    if (data instanceof File || (supportsBinary && data instanceof Blob)) {
+        var fileReader = new FileReader();
+        fileReader.onload = function() {
+            // Call this method again, with the arraybuffer as argument
+            FileWriter.prototype.write.call(that, this.result);
+        };
+        if (supportsBinary) {
             fileReader.readAsArrayBuffer(data);
-            return;
+        } else {
+            fileReader.readAsText(data);
         }
-
-        // Mark data type for safer transport over the binary bridge
-        isBinary = (data instanceof ArrayBuffer);
+        return;
     }
 
+    // Mark data type for safer transport over the binary bridge
+    isBinary = supportsBinary && (data instanceof ArrayBuffer);
+
     // Throw an exception if we are already writing a file
     if (this.readyState === FileWriter.WRITING) {
         throw new FileError(FileError.INVALID_STATE_ERR);


[07/26] js commit: [All] [CB-3941] [CB-3940] packaging was failing if pkg existed but pkg/debug did not. Fixed whitespace difference between build platforms

Posted by ag...@apache.org.
[All] [CB-3941] [CB-3940] packaging was failing if pkg existed but pkg/debug did not.  Fixed whitespace difference between build platforms


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/af24bb7d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/af24bb7d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/af24bb7d

Branch: refs/heads/2.9.x
Commit: af24bb7d196b141ee6838776da346472835921f1
Parents: 89127a8
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jun 19 18:56:10 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Jun 19 18:56:10 2013 -0700

----------------------------------------------------------------------
 build/packager.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/af24bb7d/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index ec52758..f81b6a4 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -38,8 +38,11 @@ packager.generate = function(platform, commitId, useWindowsLineEndings) {
     time = new Date().valueOf() - time;
     if (!fs.existsSync('pkg')) {
       fs.mkdirSync('pkg');
-      fs.mkdirSync('pkg/debug');
     }
+    if(!fs.existsSync('pkg/debug')) {
+        fs.mkdirSync('pkg/debug');
+    }
+
     outFile = path.join('pkg', 'cordova.' + platform + '.js');
     fs.writeFileSync(outFile, libraryRelease, 'utf8');
     
@@ -226,7 +229,7 @@ function writeContents(oFile, fileName, contents, debug) {
     }
     
     else {
-        contents = '// file: ' + fileName + '\n' + contents    
+        contents = '// file: ' + fileName.split("\\").join("/") + '\n' + contents;
     }
 
     oFile.push(contents)


[13/26] js commit: [android] CB-3927 Fix start-up race condition that could cause exec() responses to be dropped.

Posted by ag...@apache.org.
[android] CB-3927 Fix start-up race condition that could cause exec() responses to be dropped.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/b02ec10b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/b02ec10b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/b02ec10b

Branch: refs/heads/2.9.x
Commit: b02ec10bcee21a84f2568bb7615f835f38fc1662
Parents: 3a9b99a
Author: Jeffrey Willms <jb...@google.com>
Authored: Mon Jun 24 10:32:30 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Mon Jun 24 10:32:30 2013 -0400

----------------------------------------------------------------------
 lib/scripts/bootstrap-android.js | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/b02ec10b/lib/scripts/bootstrap-android.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-android.js b/lib/scripts/bootstrap-android.js
index 91a6f71..aa1ef0a 100644
--- a/lib/scripts/bootstrap-android.js
+++ b/lib/scripts/bootstrap-android.js
@@ -19,4 +19,6 @@
  *
 */
 
+// Tell the native code that a page change has occurred.
+require('cordova/exec')(null, null, 'PluginManager', 'startup', []);
 require('cordova/channel').onNativeReady.fire();


[09/26] js commit: [all] CB-3960 Convert Jakefile -> Gruntfile.js

Posted by ag...@apache.org.
[all] CB-3960 Convert Jakefile -> Gruntfile.js

Moves over all tasks except jshint. Our jshint options need updating to
work well with grunt.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/894f0411
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/894f0411
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/894f0411

Branch: refs/heads/2.9.x
Commit: 894f0411692364f48796ed9f7068c5af7a73aa95
Parents: 0195db0
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 12:58:50 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 21 12:58:50 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js   | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 Jakefile       | 184 +----------------------------------------------
 README.md      |  20 ++----
 build/dalek    |  14 ----
 grunt.js       |  75 -------------------
 package.json   |  54 +++++++-------
 test/runner.js |  10 +--
 7 files changed, 244 insertions(+), 315 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
new file mode 100644
index 0000000..f7c3b3d
--- /dev/null
+++ b/Gruntfile.js
@@ -0,0 +1,202 @@
+/*
+ * 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.
+*/
+module.exports = function(grunt) {
+    var childProcess = require('child_process');
+    var fs = require('fs');
+    var path = require('path');
+
+    // Project configuration.
+    grunt.initConfig({
+        pkg: grunt.file.readJSON('package.json'),
+        cordovajs: {
+          "android": {},
+          "bada": {},
+          "blackberry": {},
+          "blackberry10": {},
+          "errgen": {},
+          "firefoxos": {},
+          "ios": {},
+          "osx":  {},
+          "test": {},
+          "tizen": {},
+          "webos":  {},
+          "windows8": { useWindowsLineEndings: true },
+          "windowsphone": { useWindowsLineEndings: true },
+        },
+        clean: ['pkg'],
+        jshint: {
+            options: {
+                jshintrc: '.jshintrc',
+            },
+            src: [ 'lib/**/*.js' ]
+        },
+    });
+
+    // Iterates over a directory
+    function forEachFile(root, cbFile, cbDone) {
+        var count = 0;
+
+        function scan(name) {
+            ++count;
+
+            fs.stat(name, function (err, stats) {
+                if (err) cbFile(err);
+
+                if (stats.isDirectory()) {
+                    fs.readdir(name, function (err, files) {
+                        if (err) cbFile(err);
+
+                        files.forEach(function (file) {
+                            scan(path.join(name, file));
+                        });
+                        done();
+                    });
+                } else if (stats.isFile()) {
+                    cbFile(null, name, stats, done);
+                } else {
+                    done();
+                }
+            });
+        }
+
+        function done() {
+            --count;
+            if (count === 0 && cbDone) cbDone();
+        }
+
+        scan(root);
+    }
+
+    var cachedGitVersion = null;
+    function computeGitVersion(callback) {
+        if (cachedGitVersion) {
+            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);
+            }
+        });
+
+        function error(err) {
+            throw new Error(err);
+        }
+
+        function done(stdout) {
+            var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
+            cachedGitVersion = version;
+            callback(version);
+        };
+    }
+
+    function processWhiteSpace(processor, callback) {
+        var rexp_minified = new RegExp("\\.min\\.js$");
+        var rexp_src = new RegExp('\\.js$');
+        forEachFile('lib', function(err, file, stats, cbDone) {
+            //if (err) throw err;
+            if (rexp_minified.test(file) || !rexp_src.test(file)) {
+                cbDone();
+            } else {
+                var origsrc = src = fs.readFileSync(file, 'utf8');
+
+                // tabs -> four spaces
+                if (src.indexOf('\t') >= 0) {
+                    src = src.split('\t').join('    ');
+                }
+
+                // eliminate trailing white space
+                src = src.replace(/ +\n/g, '\n');
+
+                if (origsrc !== src) {
+                    // write it out yo
+                    processor(file, src);
+                }
+                cbDone();
+            }
+        }, callback);
+    }
+
+    grunt.registerMultiTask('cordovajs', 'Packages cordova.js', function() {
+        var packager = require("./build/packager");
+        var done = this.async();
+        var platformName = this.target;
+        var useWindowsLineEndings = this.data.useWindowsLineEndings;
+        computeGitVersion(function(version) {
+            grunt.log.writeln('Build label: ' + version);
+            packager.generate(platformName, version, useWindowsLineEndings);
+            done();
+        });
+    });
+
+    grunt.registerTask('test', 'Runs test in node', function() {
+        var done = this.async();
+        require('./test/runner').node();
+    });
+
+    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() {
+        var done = this.async();
+        var complainedAboutWhitespace = false;
+        processWhiteSpace(function(file, newSource) {
+            if (!complainedAboutWhitespace) {
+                grunt.log.writeln("files with whitespace issues: (to fix: `grunt fixwhitespace`)");
+                complainedAboutWhitespace = true;
+            }
+            grunt.log.writeln("   " + file);
+        }, done);
+    });
+
+    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) {
+            if (!complainedAboutWhitespace) {
+                grunt.log.writeln("Fixed whitespace issues in:");
+                complainedAboutWhitespace = true;
+            }
+            fs.writeFileSync(file, newSource, 'utf8');
+            grunt.log.writeln("   " + file);
+        }, done);
+    });
+
+    grunt.loadNpmTasks('grunt-contrib-clean');
+    grunt.loadNpmTasks('grunt-contrib-jshint');
+
+    // Default task(s).
+    grunt.registerTask('default', ['cordovajs', 'complainwhitespace', 'test']);
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
index c6bb633..089b9b0 100644
--- a/Jakefile
+++ b/Jakefile
@@ -17,139 +17,12 @@
  * under the License.
  */
 
-var util         = require('util'),
-    fs           = require('fs'),
-    childProcess = require('child_process'),
-    path         = require("path"),
-    rexp_minified = new RegExp("\\.min\\.js$"),
-    rexp_src = new RegExp('\\.js$');
+var childProcess = require('child_process');
 
-// HELPERS
-// Iterates over a directory
-function forEachFile(root, cbFile, cbDone) {
-    var count = 0;
-
-    function scan(name) {
-        ++count;
-
-        fs.stat(name, function (err, stats) {
-            if (err) cbFile(err);
-
-            if (stats.isDirectory()) {
-                fs.readdir(name, function (err, files) {
-                    if (err) cbFile(err);
-
-                    files.forEach(function (file) {
-                        scan(path.join(name, file));
-                    });
-                    done();
-                });
-            } else if (stats.isFile()) {
-                cbFile(null, name, stats, done);
-            } else {
-                done();
-            }
-        });
-    }
-
-    function done() {
-        --count;
-        if (count === 0 && cbDone) cbDone();
-    }
-
-    scan(root);
-}
-
-function computeGitVersion(callback) {
-    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);
-        }
-    });
-
-    function error(err) {
-        console.error('Git command failed: git ' + args);
-        console.error('Error: ' + err);
-        process.exit(1);
-    }
-
-    function done(stdout) {
-        var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
-        callback(version);
-    };
-}
-
-desc("runs build");
-task('default', ['build','test'], function () {});
-
-desc("clean");
-task('clean', ['set-cwd'], function () {
-    
-    var DEPLOY = path.join(__dirname,"pkg");
-    var cmd = 'rm -rf ' + DEPLOY + ' && ' +
-              'mkdir ' + DEPLOY + ' && ' +
-              'mkdir ' + path.join(DEPLOY ,'debug');
-
-    childProcess.exec(cmd,complete);
-}, true);
-
-desc("compiles the source files for all extensions");
-task('build', ['clean', 'hint'], function () {
-    var packager = require("./build/packager");
-    computeGitVersion(function(version) {
-        console.log("building " + version);
-
-        packager.generate("windows8", version,true);
-        packager.generate("blackberry", version);
-        packager.generate("blackberry10", version);
-        packager.generate("firefoxos", version);
-        packager.generate("ios", version);
-        packager.generate("windowsphone", version,true);
-        packager.generate("android", version);
-        packager.generate("bada", version);
-        packager.generate("tizen", version);
-        packager.generate("webos",  version);
-        packager.generate("osx",  version);
-        packager.generate("errgen", version);
-        packager.generate("test", version);
-        complete();
-    });
-}, true);
-
-desc("prints a dalek");
-task('dalek', ['set-cwd'], function () {
-    util.puts(fs.readFileSync("build/dalek", "utf-8"));
-});
-
-desc("runs the unit tests in node");
-task('test', ['set-cwd'], require('./test/runner').node);
-
-desc("starts a webserver to point at to run the unit tests");
-task('btest', ['set-cwd'], require('./test/runner').browser);
-
-desc("make sure we're in the right directory");
-task('set-cwd', [], function() {
-    if (__dirname != process.cwd()) {
-        process.chdir(__dirname);
-    }
-});
+task('default', ['hint'], function () {});
 
 desc('check sources with JSHint');
-task('hint', ['complainwhitespace'], function () {
+task('hint', [], function () {
     var knownWarnings = [
         "Redefinition of 'FileReader'", 
         "Redefinition of 'require'", 
@@ -173,54 +46,3 @@ task('hint', ['complainwhitespace'], function () {
     });
 }, true);
 
-var complainedAboutWhitespace = false
-
-desc('complain about what fixwhitespace would fix');
-task('complainwhitespace', function() {
-    processWhiteSpace(function(file, newSource) {
-        if (!complainedAboutWhitespace) {
-            console.log("files with whitespace issues: (to fix: `jake fixwhitespace`)")
-            complainedAboutWhitespace = true
-        }
-        
-        console.log("   " + file)
-    })
-}, true);
-
-desc('converts tabs to four spaces, eliminates trailing white space, converts newlines to proper form - enforcing style guide ftw!');
-task('fixwhitespace', function() {
-    processWhiteSpace(function(file, newSource) {
-        if (!complainedAboutWhitespace) {
-            console.log("fixed whitespace issues in:")
-            complainedAboutWhitespace = true
-        }
-        
-        fs.writeFileSync(file, newSource, 'utf8');
-        console.log("   " + file)
-    })
-}, true);
-
-function processWhiteSpace(processor) {
-    forEachFile('lib', function(err, file, stats, cbDone) {
-        //if (err) throw err;
-        if (rexp_minified.test(file) || !rexp_src.test(file)) {
-            cbDone();
-        } else {
-            var origsrc = src = fs.readFileSync(file, 'utf8');
-
-            // tabs -> four spaces
-            if (src.indexOf('\t') >= 0) {
-                src = src.split('\t').join('    ');
-            }
-
-            // eliminate trailing white space
-            src = src.replace(/ +\n/g, '\n');
-
-            if (origsrc !== src) {
-                // write it out yo
-                processor(file, src);
-            }
-            cbDone();
-        }
-    }, complete);
-}

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 994f05c..1d035b1 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,7 @@
 # under the License.
 #
 -->
-A unified JavaScript layer for [Apache Cordova](http://incubator.apache.org/projects/callback.html) projects.
+A unified JavaScript layer for [Apache Cordova](http://cordova.apache.org/) projects.
 
 # Project Structure
 
@@ -83,19 +83,13 @@ Make sure you have [node.js](http://nodejs.org) installed. It should come pre-in
 
     npm install
 
-All of the build tasks can be run via the `jake` node module. Install it globally first by running:
+All of the build tasks can be run via the `grunt` node module. Install it globally first by running:
 
-    sudo npm install -g jake
-
-Every build also runs the scripts through [JSHint](http://jshint.com). It is best
-installed globally, but it is _not_ necessary for building cordova-js
-(you just won't get syntax and style hints when you build):
-
-    sudo npm install -g jshint
+    sudo npm install -g grunt-cli
 
 Then from the repository root run:
 
-    jake
+    grunt
 
 This will run the `build`, `hint` and `test` tasks by default. All of the available tasks are:
 
@@ -134,13 +128,13 @@ The `boot` method does all the work.  First, it grabs the common platform defini
 
 Tests run in node or the browser. To run the tests in node:
     
-    jake test
+    grunt test
 
 To run them in the browser:
 
-    jake btest
+    grunt btest
 
-Final testing should always be done with the [Mobile Spec test application](https://github.com/apache/incubator-cordova-mobile-spec).
+Final testing should always be done with the [Mobile Spec test application](https://github.com/apache/cordova-mobile-spec).
 
 # Integration
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/build/dalek
----------------------------------------------------------------------
diff --git a/build/dalek b/build/dalek
deleted file mode 100644
index fcd5258..0000000
--- a/build/dalek
+++ /dev/null
@@ -1,14 +0,0 @@
-      OBEY! OBEY THE DALEKS! 
-    YOU WILL BE EXTERMINATED!!!
-                   /           
-              ___              
-      D>=G==='   '.            
-            |======|           
-            |======|           
-        )--/]IIIIII]           
-           |_______|           
-           C O O O D           
-          C O  O  O D          
-         C  O  O  O  D         
-         C__O__O__O__D         
-snd     [_____________]        

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/grunt.js
----------------------------------------------------------------------
diff --git a/grunt.js b/grunt.js
deleted file mode 100644
index 7617f2b..0000000
--- a/grunt.js
+++ /dev/null
@@ -1,75 +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.
- */
- 
-// open "http://search.npmjs.org/#/grunt" ; sudo npm -g install grunt
-
-var child_process = require("child_process")
-
-//------------------------------------------------------------------------------
-// list of source files to watch
-//------------------------------------------------------------------------------
-var sourceFiles = [
-    "build/**/*.js", 
-    "grunt.js",
-    "Jakefile",
-    "lib/**/*.js",
-    "test/**/*.js"
-]
-
-//------------------------------------------------------------------------------
-var gruntConfig = {
-    watch: {
-        jake: {
-            files: sourceFiles,
-            tasks: ["jake"]
-        }
-    }
-}
-
-//------------------------------------------------------------------------------
-// run "jake"
-//------------------------------------------------------------------------------
-function jakeTask(grunt) {
-    var done = this.async()
-    var make = child_process.spawn('jake')
-    
-    make.stdout.on("data", function(data) {
-        grunt.log.write("" + data)
-    })
-    
-    make.stderr.on("data", function(data) {
-        grunt.log.error("" + data)
-    })
-    
-    make.on("exit", function(code) {
-        if (code === 0) return done(true)
-        
-        grunt.log.writeln("error running jake", code)
-        return done(false)
-    })
-}
-
-//------------------------------------------------------------------------------
-module.exports = function(grunt) {
-    grunt.initConfig(gruntConfig)
-    
-    grunt.registerTask("default", "watch")
-    grunt.registerTask("jake", "run jake", function(){jakeTask.call(this,grunt)}
-    )
-}

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 2565cf9..f0a82de 100644
--- a/package.json
+++ b/package.json
@@ -5,57 +5,61 @@
   "version": "1.8.1",
   "homepage": "http://incubator.apache.org/cordova/",
   "repository": {
-    "type":"git",
+    "type": "git",
     "url": "http://git-wip-us.apache.org/repos/asf/incubator-cordova-js.git"
   },
   "engines": {
     "node": "~0.6.15"
   },
-  "contributors":[
+  "contributors": [
     {
-      "name":"Fil Maj",
-      "email":"filmaj@apache.org"
+      "name": "Fil Maj",
+      "email": "filmaj@apache.org"
     },
     {
-      "name":"Jesse MacFadyen",
-      "email":"purplecabbage@apache.org"
+      "name": "Jesse MacFadyen",
+      "email": "purplecabbage@apache.org"
     },
     {
-      "name":"Bryce Curtis",
-      "email":""
+      "name": "Bryce Curtis",
+      "email": ""
     },
     {
-      "name":"Drew Walters",
-      "email":""
+      "name": "Drew Walters",
+      "email": ""
     },
     {
-      "name":"Patrick Mueller",
-      "email":""
+      "name": "Patrick Mueller",
+      "email": ""
     },
     {
-      "name":"Simon MacDonald",
-      "email":""
+      "name": "Simon MacDonald",
+      "email": ""
     },
     {
-      "name":"Becky Gibson",
-      "email":""
+      "name": "Becky Gibson",
+      "email": ""
     },
     {
-      "name":"Anis Kadri",
-      "email":""
+      "name": "Anis Kadri",
+      "email": ""
     },
     {
-      "name":"Dan Silivestru",
-      "email":"dansilivestru@apache.org"
+      "name": "Dan Silivestru",
+      "email": "dansilivestru@apache.org"
     },
     {
-      "name":"Shazron Abdullah",
-      "email":"shazron@apache.org"
+      "name": "Shazron Abdullah",
+      "email": "shazron@apache.org"
     }
   ],
   "dependencies": {
-    "jsdom":"0.2.14",
-    "connect":"1.8.5"
+    "jsdom": "0.2.14",
+    "connect": "1.8.5"
   },
-  "devDependencies": {}
+  "devDependencies": {
+    "grunt": "~0.4.1",
+    "grunt-contrib-clean": "~0.4.1",
+    "grunt-contrib-jshint": "~0.6.0"
+  }
 }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/894f0411/test/runner.js
----------------------------------------------------------------------
diff --git a/test/runner.js b/test/runner.js
index c908cf3..51846ba 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -41,7 +41,7 @@ function collect(path, files, matches) {
 }
 
 module.exports = {
-    node: function () {
+    node: function(callback) {
         console.log('starting node-based tests')
         var jas = require("../thirdparty/jasmine/jasmine"),
             TerminalReporter = require('./reporter').TerminalReporter,
@@ -53,8 +53,7 @@ module.exports = {
             window = document.createWindow();
         } catch (e) {
             //no jsDom (some people don't have compilers)
-            console.log("can't run tests in node: run jake btest instead, or install jsdom via: npm install");
-            return;
+            throw new Error("can't run tests in node: run jake btest instead, or install jsdom via: npm install");
         }
 
         //Put jasmine in scope
@@ -62,9 +61,6 @@ module.exports = {
             this[key] = window[key] = global[key] = jas[key];
         });
 
-        //regenerate platform file
-        packager.generate('test');
-
         //load in our modules
         var testLibName = _path.join(__dirname, '..', 'pkg', 'cordova.test.js')
         var testLib     = fs.readFileSync(testLibName, 'utf8')
@@ -90,7 +86,7 @@ module.exports = {
         var env = jasmine.getEnv();
         env.addReporter(new TerminalReporter({
             color: true,
-            onComplete: process.exit
+            onComplete: function() { callback(true); }
         }));
 
         console.log("------------");


[10/26] js commit: Move computing of commit ID into packager.js

Posted by ag...@apache.org.
Move computing of commit ID into packager.js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/232f3892
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/232f3892
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/232f3892

Branch: refs/heads/2.9.x
Commit: 232f389252c94d3f7b5404ccb8c4b96fcf5467fa
Parents: 894f041
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 13:15:00 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 21 13:15:00 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js      | 44 +-----------------------
 build/packager.js | 91 ++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 67 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/232f3892/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index f7c3b3d..7665623 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,7 +17,6 @@
  * under the License.
 */
 module.exports = function(grunt) {
-    var childProcess = require('child_process');
     var fs = require('fs');
     var path = require('path');
 
@@ -83,43 +82,6 @@ module.exports = function(grunt) {
         scan(root);
     }
 
-    var cachedGitVersion = null;
-    function computeGitVersion(callback) {
-        if (cachedGitVersion) {
-            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);
-            }
-        });
-
-        function error(err) {
-            throw new Error(err);
-        }
-
-        function done(stdout) {
-            var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
-            cachedGitVersion = version;
-            callback(version);
-        };
-    }
-
     function processWhiteSpace(processor, callback) {
         var rexp_minified = new RegExp("\\.min\\.js$");
         var rexp_src = new RegExp('\\.js$');
@@ -152,11 +114,7 @@ module.exports = function(grunt) {
         var done = this.async();
         var platformName = this.target;
         var useWindowsLineEndings = this.data.useWindowsLineEndings;
-        computeGitVersion(function(version) {
-            grunt.log.writeln('Build label: ' + version);
-            packager.generate(platformName, version, useWindowsLineEndings);
-            done();
-        });
+        packager.generate(platformName, useWindowsLineEndings, done);
     });
 
     grunt.registerTask('test', 'Runs test in node', function() {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/232f3892/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index f81b6a4..d859636 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -17,43 +17,84 @@
  * under the License.
  */
 
+var childProcess = require('child_process');
 var fs    = require('fs')
 var util  = require('util')
 var path  = require('path')
 
 var packager = module.exports
 
-//------------------------------------------------------------------------------
-packager.generate = function(platform, commitId, useWindowsLineEndings) {
-    var outFile;
-    var time = new Date().valueOf();
-
-    var libraryRelease = packager.bundle(platform, false, commitId);
-    // if we are using windows line endings, we will also add the BOM
-    if(useWindowsLineEndings) {
-        libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
-    }
-    var libraryDebug   = packager.bundle(platform, true, commitId);
-    
-    time = new Date().valueOf() - time;
-    if (!fs.existsSync('pkg')) {
-      fs.mkdirSync('pkg');
+var cachedGitVersion = null;
+packager.computeCommitId = function(callback) {
+    if (cachedGitVersion) {
+        callback(cachedGitVersion);
+        return;
     }
-    if(!fs.existsSync('pkg/debug')) {
-        fs.mkdirSync('pkg/debug');
+    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);
+        }
+    });
+
+    function error(err) {
+        throw new Error(err);
     }
 
-    outFile = path.join('pkg', 'cordova.' + platform + '.js');
-    fs.writeFileSync(outFile, libraryRelease, 'utf8');
-    
-    outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
-    fs.writeFileSync(outFile, libraryDebug, 'utf8');
-    
-    console.log('generated platform: ' + platform + ' in ' + time + 'ms');
+    function done(stdout) {
+        var version = stdout.trim().replace(/^2.5.0-.*?-/, 'dev-');
+        cachedGitVersion = version;
+        callback(version);
+    };
+}
+
+//------------------------------------------------------------------------------
+packager.generate = function(platform, useWindowsLineEndings, callback) {
+    packager.computeCommitId(function(commitId) {
+        var outFile;
+        var time = new Date().valueOf();
+
+        var libraryRelease = packager.bundle(platform, false, commitId);
+        // if we are using windows line endings, we will also add the BOM
+        if(useWindowsLineEndings) {
+            libraryRelease = "\ufeff" + libraryRelease.split(/\r?\n/).join("\r\n");
+        }
+        var libraryDebug   = packager.bundle(platform, true, commitId);
+        
+        time = new Date().valueOf() - time;
+        if (!fs.existsSync('pkg')) {
+            fs.mkdirSync('pkg');
+        }
+        if(!fs.existsSync('pkg/debug')) {
+            fs.mkdirSync('pkg/debug');
+        }
+
+        outFile = path.join('pkg', 'cordova.' + platform + '.js');
+        fs.writeFileSync(outFile, libraryRelease, 'utf8');
+        
+        outFile = path.join('pkg', 'debug', 'cordova.' + platform + '-debug.js');
+        fs.writeFileSync(outFile, libraryDebug, 'utf8');
+        
+        console.log('generated cordova.' + platform + '.js @ ' + commitId + ' in ' + time + 'ms');
+        callback();
+    });
 }
 
 //------------------------------------------------------------------------------
-packager.bundle = function(platform, debug, commitId ) {
+packager.bundle = function(platform, debug, commitId) {
     var modules = collectFiles('lib/common')
     var scripts = collectFiles('lib/scripts')
     


[05/26] js commit: Combine XHR + script injection technqieues to load the plugins list (either .json or .js file).

Posted by ag...@apache.org.
Combine XHR + script injection technqieues to load the plugins list (either .json or .js file).


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/1fd26e16
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/1fd26e16
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/1fd26e16

Branch: refs/heads/2.9.x
Commit: 1fd26e16edb07ede87d3f02373ffa6c3909a3076
Parents: a945b9d
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Jun 19 13:39:40 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jun 19 13:39:40 2013 -0700

----------------------------------------------------------------------
 lib/scripts/plugin_loader.js | 58 +++++++++++++++++++++++++++++----------
 1 file changed, 43 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/1fd26e16/lib/scripts/plugin_loader.js
----------------------------------------------------------------------
diff --git a/lib/scripts/plugin_loader.js b/lib/scripts/plugin_loader.js
index b56f124..b27216b 100644
--- a/lib/scripts/plugin_loader.js
+++ b/lib/scripts/plugin_loader.js
@@ -119,24 +119,52 @@
         }
     }
 
+    var plugins_json = path + 'cordova_plugins.json';
     var plugins_js = path + 'cordova_plugins.js';
-    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.
+    // 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();
-        };
-        script.src = plugins_js;
-        document.head.appendChild(script);
-
-    } catch(err){
+        }
+    };
+    xhr.onerror = function() {
         finishPluginLoading();
+    };
+    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){
+        // 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
+        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();
+        }
     }
 }(window));
 


[19/26] js commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-js

Posted by ag...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cordova-js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d422f84c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d422f84c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d422f84c

Branch: refs/heads/2.9.x
Commit: d422f84c59e4b2fb0e1b4c272635579a623ae674
Parents: 718d011 d81abfc
Author: pplaquette <pp...@apache.org>
Authored: Thu Jun 27 11:26:53 2013 +0200
Committer: pplaquette <pp...@apache.org>
Committed: Thu Jun 27 11:26:53 2013 +0200

----------------------------------------------------------------------
 Gruntfile.js                                    |   2 +-
 lib/common/plugin/FileWriter.js                 |  35 +--
 lib/ios/exec.js                                 |   2 +-
 lib/scripts/bootstrap-android.js                |   2 +
 .../plugin/windowsphone/XHRPatch/plugininit.js  | 255 -------------------
 5 files changed, 22 insertions(+), 274 deletions(-)
----------------------------------------------------------------------



[22/26] js commit: [All] [CB-3941] [CB-3940] packaging was failing if pkg existed but pkg/debug did not. Fixed whitespace difference between build platforms (cherry picked from commit af24bb7d196b141ee6838776da346472835921f1)

Posted by ag...@apache.org.
[All] [CB-3941] [CB-3940] packaging was failing if pkg existed but pkg/debug did not.  Fixed whitespace difference between build platforms
(cherry picked from commit af24bb7d196b141ee6838776da346472835921f1)


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/41a75767
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/41a75767
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/41a75767

Branch: refs/heads/2.9.x
Commit: 41a75767aa8d54f200912e9c2714b77760476163
Parents: 83dc4bd
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jun 19 18:56:10 2013 -0700
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 28 10:12:18 2013 -0400

----------------------------------------------------------------------
 build/packager.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/41a75767/build/packager.js
----------------------------------------------------------------------
diff --git a/build/packager.js b/build/packager.js
index ec52758..f81b6a4 100644
--- a/build/packager.js
+++ b/build/packager.js
@@ -38,8 +38,11 @@ packager.generate = function(platform, commitId, useWindowsLineEndings) {
     time = new Date().valueOf() - time;
     if (!fs.existsSync('pkg')) {
       fs.mkdirSync('pkg');
-      fs.mkdirSync('pkg/debug');
     }
+    if(!fs.existsSync('pkg/debug')) {
+        fs.mkdirSync('pkg/debug');
+    }
+
     outFile = path.join('pkg', 'cordova.' + platform + '.js');
     fs.writeFileSync(outFile, libraryRelease, 'utf8');
     
@@ -226,7 +229,7 @@ function writeContents(oFile, fileName, contents, debug) {
     }
     
     else {
-        contents = '// file: ' + fileName + '\n' + contents    
+        contents = '// file: ' + fileName.split("\\").join("/") + '\n' + contents;
     }
 
     oFile.push(contents)


[17/26] js commit: added done per @infil00p

Posted by ag...@apache.org.
added done per @infil00p


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d81abfc9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d81abfc9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d81abfc9

Branch: refs/heads/2.9.x
Commit: d81abfc971f85667db93056024931d5c494df507
Parents: 97dae01
Author: Brian LeRoux <br...@westcoastlogic.com>
Authored: Tue Jun 25 13:55:41 2013 -0700
Committer: Brian LeRoux <br...@westcoastlogic.com>
Committed: Tue Jun 25 13:55:41 2013 -0700

----------------------------------------------------------------------
 Gruntfile.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d81abfc9/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 3b9ca4e..81275ad 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -120,7 +120,7 @@ module.exports = function(grunt) {
 
     grunt.registerTask('test', 'Runs test in node', function() {
         var done = this.async();
-        require('./test/runner').node();
+        require('./test/runner').node(done);
     });
 
     grunt.registerTask('btest', 'Runs tests in the browser', function() {


[04/26] js commit: Testing non-xhr loader with Fil

Posted by ag...@apache.org.
Testing non-xhr loader with Fil


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/bd4cff03
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/bd4cff03
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/bd4cff03

Branch: refs/heads/2.9.x
Commit: bd4cff03efc1cf11c812b05835dd74853f5e68cc
Parents: 0f10e3a
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri May 17 17:35:46 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jun 19 13:32:07 2013 -0700

----------------------------------------------------------------------
 lib/scripts/plugin_loader.js | 57 +++++++++++++++++++++++----------------
 1 file changed, 34 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/bd4cff03/lib/scripts/plugin_loader.js
----------------------------------------------------------------------
diff --git a/lib/scripts/plugin_loader.js b/lib/scripts/plugin_loader.js
index 892bd76..1a38eda 100644
--- a/lib/scripts/plugin_loader.js
+++ b/lib/scripts/plugin_loader.js
@@ -103,30 +103,41 @@
             break;
         }
     }
-    // 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() {
-        finishPluginLoading();
-    };
-    var plugins_json = path + 'cordova_plugins.json';
+
+    // // 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() {
+    //     finishPluginLoading();
+    // };
+
+    var plugins_js = path + 'cordova_plugins.js';
     try { // we commented we were going to try, so let us actually try and catch
-        xhr.open('GET', plugins_json, true); // Async
-        xhr.send();
+        //xhr.open('GET', plugins_json, true); // Async
+        //xhr.send();
+        var script = document.createElement("script");
+        script.onload = function(){
+            var list = cordova.require("cordova/plugin_list");
+            handlePluginsObject(list,path);
+
+        };
+        script.src = plugins_js;
+        document.head.appendChild(script);
+
     } catch(err){
         finishPluginLoading();
     }


[16/26] js commit: removed XHRPatch plugin, it is now part of native

Posted by ag...@apache.org.
removed XHRPatch plugin, it is now part of native


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/97dae01c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/97dae01c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/97dae01c

Branch: refs/heads/2.9.x
Commit: 97dae01c8accab4141469c74b7c6dfb5ad1aa8b4
Parents: e208322
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Mon Jun 24 22:01:10 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Mon Jun 24 22:01:10 2013 -0700

----------------------------------------------------------------------
 .../plugin/windowsphone/XHRPatch/plugininit.js  | 255 -------------------
 1 file changed, 255 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/97dae01c/lib/windowsphone/plugin/windowsphone/XHRPatch/plugininit.js
----------------------------------------------------------------------
diff --git a/lib/windowsphone/plugin/windowsphone/XHRPatch/plugininit.js b/lib/windowsphone/plugin/windowsphone/XHRPatch/plugininit.js
deleted file mode 100644
index 27fd21d..0000000
--- a/lib/windowsphone/plugin/windowsphone/XHRPatch/plugininit.js
+++ /dev/null
@@ -1,255 +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.
- *
-*/
-
-// TODO: the build process will implicitly wrap this in a define() call
-// with a closure of its own; do you need this extra closure?
-
-var LocalFileSystem = require('cordova/plugin/LocalFileSystem');
-
-(function (win, doc) {
-
-var docDomain = null;
-try {
-    docDomain = doc.domain;
-} catch (err) {
-    //console.log("caught exception trying to access document.domain");
-}
-
-if (!docDomain || docDomain.length === 0) {
-
-    var aliasXHR = win.XMLHttpRequest;
-
-    win.XMLHttpRequest = function () { };
-    win.XMLHttpRequest.noConflict = aliasXHR;
-    win.XMLHttpRequest.UNSENT = 0;
-    win.XMLHttpRequest.OPENED = 1;
-    win.XMLHttpRequest.HEADERS_RECEIVED = 2;
-    win.XMLHttpRequest.LOADING = 3;
-    win.XMLHttpRequest.DONE = 4;
-
-    win.XMLHttpRequest.prototype = {
-        UNSENT: 0,
-        OPENED: 1,
-        HEADERS_RECEIVED: 2,
-        LOADING: 3,
-        DONE: 4,
-
-        isAsync: false,
-        onreadystatechange: null,
-        readyState: 0,
-        _url: "",
-        timeout: 0,
-        withCredentials: false,
-        _requestHeaders: null,
-        open: function (reqType, uri, isAsync, user, password) {
-
-            if (uri && uri.indexOf("http") === 0) {
-                if (!this.wrappedXHR) {
-                    this.wrappedXHR = new aliasXHR();
-                    var self = this;
-
-                    // timeout
-                    if (this.timeout > 0) {
-                        this.wrappedXHR.timeout = this.timeout;
-                    }
-                    Object.defineProperty(this, "timeout", {
-                        set: function (val) {
-                            this.wrappedXHR.timeout = val;
-                        },
-                        get: function () {
-                            return this.wrappedXHR.timeout;
-                        }
-                    });
-
-
-
-                    if (this.withCredentials) {
-                        this.wrappedXHR.withCredentials = this.withCredentials;
-                    }
-                    Object.defineProperty(this, "withCredentials", {
-                        set: function (val) {
-                            this.wrappedXHR.withCredentials = val;
-                        },
-                        get: function () {
-                            return this.wrappedXHR.withCredentials;
-                        }
-                    });
-
-
-                    Object.defineProperty(this, "status", { get: function () {
-                        return this.wrappedXHR.status;
-                    }
-                    });
-                    Object.defineProperty(this, "responseText", { get: function () {
-                        return this.wrappedXHR.responseText;
-                    }
-                    });
-                    Object.defineProperty(this, "statusText", { get: function () {
-                        return this.wrappedXHR.statusText;
-                    }
-                    });
-
-                    Object.defineProperty(this, "responseXML", { get: function () {
-                        return this.wrappedXHR.responseXML;
-                    }
-                    });
-
-                    this.getResponseHeader = function (header) {
-                        return this.wrappedXHR.getResponseHeader(header);
-                    };
-                    this.getAllResponseHeaders = function () {
-                        return this.wrappedXHR.getAllResponseHeaders();
-                    };
-
-                    this.wrappedXHR.onreadystatechange = function () {
-                        self.changeReadyState(self.wrappedXHR.readyState);
-                    };
-                }
-                return this.wrappedXHR.open(reqType, uri, isAsync, user, password);
-            }
-            else {
-                // x-wmapp1://app/www/page2.html
-                // need to work some magic on the actual url/filepath
-                var newUrl = uri;
-                if (newUrl.indexOf(":/") > -1) {
-                    newUrl = newUrl.split(":/")[1];
-                }
-                // prefix relative urls to our physical root
-                if(newUrl.indexOf("app/www/") < 0 && this.getContentLocation() == this.contentLocation.ISOLATED_STORAGE)
-                {
-                    newUrl = "app/www/" + newUrl;
-                }
-
-                if (newUrl.lastIndexOf("/") === newUrl.length - 1) {
-                    newUrl += "index.html"; // default page is index.html, when call is to a dir/ ( why not ...? )
-                }
-                this._url = newUrl;
-            }
-        },
-        statusText: "",
-        changeReadyState: function (newState) {
-            this.readyState = newState;
-            if (this.onreadystatechange) {
-                this.onreadystatechange();
-            }
-        },
-        setRequestHeader: function (header, value) {
-            if (this.wrappedXHR) {
-                this.wrappedXHR.setRequestHeader(header, value);
-            }
-        },
-        getResponseHeader: function (header) {
-            return this.wrappedXHR ? this.wrappedXHR.getResponseHeader(header) : "";
-        },
-        getAllResponseHeaders: function () {
-            return this.wrappedXHR ? this.wrappedXHR.getAllResponseHeaders() : "";
-        },
-        responseText: "",
-        responseXML: "",
-        onResult: function (res) {
-            this.status = 200;
-            if(typeof res == "object")
-            {   // callback result handler may have already parsed this from a string-> a JSON object,
-                // if so, we need to restore its stringyness, as handlers are expecting string data.
-                // especially if used with jQ -> $.getJSON
-                res = JSON.stringify(res);
-            }
-            this.responseText = res;
-            this.responseXML = res;
-            this.changeReadyState(this.DONE);
-        },
-        onError: function (err) {
-            this.status = 404;
-            this.changeReadyState(this.DONE);
-        },
-
-        abort: function () {
-            if (this.wrappedXHR) {
-                return this.wrappedXHR.abort();
-            }
-        },
-
-        send: function (data) {
-            if (this.wrappedXHR) {
-                return this.wrappedXHR.send(data);
-            }
-            else {
-                this.changeReadyState(this.OPENED);
-
-                var alias = this;
-
-                var fail = function fail(evt) {
-                    alias.onError(evt.code);
-                };
-
-                if (alias.getContentLocation() == this.contentLocation.RESOURCES) {
-                    var exec = require('cordova/exec');
-                    exec(function(result) {
-                            alias.onResult.apply(alias, [result]);
-                        },
-                        fail,
-                        "File", "readResourceAsText", [alias._url]
-                    );
-                }
-                else {
-                    var gotFile = function gotFile(file) {
-                        var reader = new FileReader();
-                        reader.onloadend = function (evt) {
-                            alias.onResult.apply(alias,[evt.target.result]);
-                        };
-                        reader.readAsText(file);
-                    };
-
-                    var gotEntry = function gotEntry(entry) {
-                        entry.file(gotFile, fail);
-                    };
-
-                    var gotFS = function gotFS(fs) {
-                        fs.root.getFile(alias._url, null, gotEntry, fail);
-                    };
-
-                    window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
-                }
-            }
-        },
-
-        getContentLocation: function () {
-            if (window.contentLocation === undefined) {
-                window.contentLocation = (navigator.userAgent.toUpperCase().indexOf('MSIE 10') > -1) ?
-                    this.contentLocation.RESOURCES : this.contentLocation.ISOLATED_STORAGE;
-            }
-
-            return window.contentLocation;
-        },
-
-        contentLocation:{
-            ISOLATED_STORAGE: 0,
-            RESOURCES: 1
-        },
-
-        status: 404
-    };
-} // if doc domain
-
-// end closure wrap
-})(window, document);
-
-module.exports = null;


[11/26] js commit: [all] CB-3960 Move jshint into grunt (lamely)

Posted by ag...@apache.org.
[all] CB-3960 Move jshint into grunt (lamely)


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/3d81324b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/3d81324b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/3d81324b

Branch: refs/heads/2.9.x
Commit: 3d81324b9d89c8f51b14e2152eec5bfbea094caa
Parents: 232f389
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 13:36:58 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 21 13:36:58 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js | 28 +++++++++++++++++++++++++++-
 Jakefile     | 48 ------------------------------------------------
 2 files changed, 27 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3d81324b/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 7665623..3b9ca4e 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,6 +17,7 @@
  * under the License.
 */
 module.exports = function(grunt) {
+    var childProcess = require('child_process');
     var fs = require('fs');
     var path = require('path');
 
@@ -152,9 +153,34 @@ module.exports = function(grunt) {
         }, done);
     });
 
+    // TODO - Delete this task and use Grunt's built-in jshint (CB-3964).
+    grunt.registerTask('hint', 'Runs jshint.', function() {
+        var done = this.async();
+        var knownWarnings = [
+            "Redefinition of 'FileReader'",
+            "Redefinition of 'require'",
+            "Read only",
+            "Redefinition of 'console'"
+        ];
+        var filterKnownWarnings = function(el, index, array) {
+            var wut = true;
+            // filter out the known warnings listed out above
+            knownWarnings.forEach(function(e) {
+                wut = wut && (el.indexOf(e) == -1);
+            });
+            wut = wut && (!el.match(/\d+ errors/));
+            return wut;
+        };
+
+        childProcess.exec("jshint lib", function(err,stdout,stderr) {
+            var exs = stdout.split('\n');
+            grunt.log.writeln(exs.filter(filterKnownWarnings).join('\n'));
+            done();
+        });
+    });
     grunt.loadNpmTasks('grunt-contrib-clean');
     grunt.loadNpmTasks('grunt-contrib-jshint');
 
     // Default task(s).
-    grunt.registerTask('default', ['cordovajs', 'complainwhitespace', 'test']);
+    grunt.registerTask('default', ['cordovajs', 'hint', 'complainwhitespace', 'test']);
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3d81324b/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
deleted file mode 100644
index 089b9b0..0000000
--- a/Jakefile
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements.  See th
- * distributed with this work for additional infor
- * regarding copyright ownership.  The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License.  You may obtain a copy of the
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to 
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied.  See the Licen
- * specific language governing permissions and lim
- * under the License.
- */
-
-var childProcess = require('child_process');
-
-task('default', ['hint'], function () {});
-
-desc('check sources with JSHint');
-task('hint', [], function () {
-    var knownWarnings = [
-        "Redefinition of 'FileReader'", 
-        "Redefinition of 'require'", 
-        "Read only",
-        "Redefinition of 'console'"
-    ];
-    var filterKnownWarnings = function(el, index, array) {
-        var wut = true;
-        // filter out the known warnings listed out above
-        knownWarnings.forEach(function(e) {
-            wut = wut && (el.indexOf(e) == -1);
-        });
-        wut = wut && (!el.match(/\d+ errors/));
-        return wut;
-    };
-
-    childProcess.exec("jshint lib",function(err,stdout,stderr) {
-        var exs = stdout.split('\n');
-        console.log(exs.filter(filterKnownWarnings).join('\n')); 
-        complete();
-    });
-}, true);
-


[02/26] js commit: [Win8][CB-3540] remove deprecated device.name

Posted by ag...@apache.org.
[Win8][CB-3540] remove deprecated device.name


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0f10e3a2
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0f10e3a2
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0f10e3a2

Branch: refs/heads/2.9.x
Commit: 0f10e3a209285314ac52c9c77238bc28b4503253
Parents: be7fa32
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue Jun 18 17:22:50 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Tue Jun 18 17:22:50 2013 -0700

----------------------------------------------------------------------
 lib/windows8/plugin/windows8/DeviceProxy.js | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0f10e3a2/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
index cf442e3..7379f48 100644
--- a/lib/windows8/plugin/windows8/DeviceProxy.js
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -27,16 +27,6 @@ var FileError = require('cordova/plugin/FileError');
 module.exports = {
 
     getDeviceInfo:function(win,fail,args) {
-        //console.log("NativeProxy::getDeviceInfo");
-        var hostNames = Windows.Networking.Connectivity.NetworkInformation.getHostNames();
-
-        var name = "unknown";
-        hostNames.some(function (nm) {
-            if (nm.displayName.indexOf(".local") > -1) {
-                name = nm.displayName.split(".local")[0];
-                return true;
-            }
-        });
 
         // deviceId aka uuid, stored in Windows.Storage.ApplicationData.current.localSettings.values.deviceId
         var deviceId;
@@ -50,7 +40,7 @@ module.exports = {
         }
 
         setTimeout(function () {
-            win({ platform: "windows8", version: "8", name: name, uuid: deviceId, cordova: CORDOVA_JS_BUILD_LABEL });
+            win({ platform: "windows8", version: "8", uuid: deviceId, cordova: CORDOVA_JS_BUILD_LABEL });
         }, 0);
     }
 


[26/26] js commit: Merge branch 'master' into 2.9.x

Posted by ag...@apache.org.
Merge branch 'master' into 2.9.x


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/e63317e5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/e63317e5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/e63317e5

Branch: refs/heads/2.9.x
Commit: e63317e5480fddd9dd8dde0db431e5928d626ee1
Parents: c56748c 5ea1a88
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 28 10:14:54 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 28 10:14:54 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/exec.js                        |   1 -
 lib/blackberry10/plugin/blackberry10/capture.js |  76 ------
 lib/common/plugin/FileWriter.js                 |  35 +--
 lib/scripts/bootstrap-android.js                |   2 +
 lib/tizen/plugin/tizen/Globalization.js         | 118 ++++++++-
 lib/tizen/plugin/tizen/SplashScreen.js          |  43 ++++
 lib/windows8/plugin/windows8/DeviceProxy.js     |  12 +-
 .../windowsphone/DOMStorage/plugininit.js       | 200 ---------------
 .../plugin/windowsphone/XHRPatch/plugininit.js  | 255 -------------------
 test/blackberry10/test.capture.js               | 222 ----------------
 10 files changed, 175 insertions(+), 789 deletions(-)
----------------------------------------------------------------------



[18/26] js commit: [CB-3739][Tizen][Tizen SDK 2.1 Nectarine] - splashscreen

Posted by ag...@apache.org.
[CB-3739][Tizen][Tizen SDK 2.1 Nectarine] - splashscreen

actually add splashscreen.js in tizen
(just forgot to "add" the file .... :-( )


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/718d0111
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/718d0111
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/718d0111

Branch: refs/heads/2.9.x
Commit: 718d0111541422d88a36a9cd8c24b86e9e74d7db
Parents: 3a9b99a
Author: pplaquette <pp...@apache.org>
Authored: Thu Jun 27 11:02:18 2013 +0200
Committer: pplaquette <pp...@apache.org>
Committed: Thu Jun 27 11:02:18 2013 +0200

----------------------------------------------------------------------
 lib/tizen/plugin/tizen/SplashScreen.js | 43 +++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/718d0111/lib/tizen/plugin/tizen/SplashScreen.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/SplashScreen.js b/lib/tizen/plugin/tizen/SplashScreen.js
new file mode 100644
index 0000000..1187c45
--- /dev/null
+++ b/lib/tizen/plugin/tizen/SplashScreen.js
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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 exec = require('cordova/exec');
+
+var splashscreen = {
+
+    window: null,
+
+
+    show:function() {
+        console.log ("tizen splashscreen show()");
+
+        // open a windows in splashscreen.window
+        // add DOM with an Image
+
+    },
+    hide:function() {
+        console.log ("tizen splashscreen hide()");
+        //delete the window splashscreen.window
+        //set to null
+    }
+};
+
+module.exports = splashscreen;


[21/26] js commit: [BlackBerry10] [CB-3368] Removing old capture plugin to be replaced by a native one

Posted by ag...@apache.org.
[BlackBerry10] [CB-3368] Removing old capture plugin to be replaced by a native one

Reviewed by Bryan Higgins <bh...@blackberry.com>
Tested by Tracy Li <tl...@blackberry.com>


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/5ea1a88f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/5ea1a88f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/5ea1a88f

Branch: refs/heads/2.9.x
Commit: 5ea1a88f240c1d6c9d5707595fd27a06ad3c6fcd
Parents: f96eefc
Author: Jeffrey Heifetz <jh...@blackberry.com>
Authored: Fri May 10 15:35:27 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri Jun 28 09:46:10 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/exec.js                        |   1 -
 lib/blackberry10/plugin/blackberry10/capture.js |  76 -------
 test/blackberry10/test.capture.js               | 222 -------------------
 3 files changed, 299 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5ea1a88f/lib/blackberry10/exec.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/exec.js b/lib/blackberry10/exec.js
index c22f4a5..dda4d4a 100644
--- a/lib/blackberry10/exec.js
+++ b/lib/blackberry10/exec.js
@@ -22,7 +22,6 @@
 var cordova = require('cordova'),
     plugins = {
         'Compass' : require('cordova/plugin/blackberry10/magnetometer'),
-        'Capture' : require('cordova/plugin/blackberry10/capture'),
         'FileTransfer': require('cordova/plugin/blackberry10/fileTransfer')
     };
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5ea1a88f/lib/blackberry10/plugin/blackberry10/capture.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/capture.js b/lib/blackberry10/plugin/blackberry10/capture.js
deleted file mode 100644
index 3c8f1cb..0000000
--- a/lib/blackberry10/plugin/blackberry10/capture.js
+++ /dev/null
@@ -1,76 +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.
- *
-*/
-
-var cordova = require('cordova');
-
-function capture(action, win, fail) {
-    var noop = function () {};
-
-    blackberry.invoke.card.invokeCamera(action, function (path) {
-        var sb = blackberry.io.sandbox;
-        blackberry.io.sandbox = false;
-        window.webkitRequestFileSystem(window.PERSISTENT, 1024, function (fs) {
-            fs.root.getFile(path, {}, function (fe) {
-                fe.file(function (file) {
-                    file.fullPath = fe.fullPath;
-                    win([file]);
-                    blackberry.io.sandbox = sb;
-                }, fail);
-            }, fail);
-        }, fail);
-    }, noop, noop);
-}
-
-module.exports = {
-    getSupportedAudioModes: function (args, win, fail) {
-        return {"status": cordova.callbackStatus.OK, "message": []};
-    },
-    getSupportedImageModes: function (args, win, fail) {
-        return {"status": cordova.callbackStatus.OK, "message": []};
-    },
-    getSupportedVideoModes: function (args, win, fail) {
-        return {"status": cordova.callbackStatus.OK, "message": []};
-    },
-    captureImage: function (args, win, fail) {
-        if (args[0].limit > 0) {
-            capture("photo", win, fail);
-        }
-        else {
-            win([]);
-        }
-
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
-    },
-    captureVideo: function (args, win, fail) {
-        if (args[0].limit > 0) {
-            capture("video", win, fail);
-        }
-        else {
-            win([]);
-        }
-
-        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
-    },
-    captureAudio: function (args, win, fail) {
-        fail("Capturing Audio not supported");
-        return {"status": cordova.callbackStatus.NO_RESULT, "message": "WebWorks Is On It"};
-    }
-};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/5ea1a88f/test/blackberry10/test.capture.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.capture.js b/test/blackberry10/test.capture.js
deleted file mode 100644
index 95b48d4..0000000
--- a/test/blackberry10/test.capture.js
+++ /dev/null
@@ -1,222 +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.
- *
-*/
-
-describe("blackberry10 capture", function () {
-    var capture = require('cordova/plugin/blackberry10/capture'),
-        cordova = require('cordova');
-
-    describe("getSupportedAudioModes", function(){
-        it('should return Ok', function(){
-            expect(capture.getSupportedAudioModes()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: []
-            });
-        });
-    });
-
-    describe("getSupportedImageModes", function(){
-        it('should return Ok', function(){
-            expect(capture.getSupportedImageModes()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: []
-            });
-        });
-    });
-
-    describe("getSupportedVideoModes", function(){
-        it('should return Ok', function(){
-            expect(capture.getSupportedVideoModes()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: []
-            });
-        });
-    });
-
-    function testCapture(method, action) {
-        describe(method, function(){
-            beforeEach(function () {
-                global.blackberry = {
-                    invoke: {
-                        card: {
-                            invokeCamera: jasmine.createSpy('blackberry.invoke.card.invokeCamera')
-                        }
-                    }
-                };
-            });
-
-            afterEach(function () {
-                delete global.blackberry;
-            });
-
-            it('should return No Result', function(){
-                var args = [{limit: 0}],
-                    win = jasmine.createSpy('win'),
-                    fail = jasmine.createSpy('fail');
-
-                expect(capture[method](args, win, fail)).toEqual({
-                    status: cordova.callbackStatus.NO_RESULT,
-                    message: "WebWorks Is On It"
-                });
-            });
-
-            describe("when the limit is 0 or less", function () {
-                it('calls the win callback with an empty array', function(){
-                    var args = [{ limit: -9 }],
-                        win = jasmine.createSpy('win'),
-                        fail = jasmine.createSpy('fail');
-
-                    capture[method](args, win, fail);
-                    expect(win).toHaveBeenCalled();
-                });
-            });
-
-            describe("when the limit is greater than 0", function () {
-                var win, fail;
-
-                beforeEach(function () {
-                    win = jasmine.createSpy("win");
-                    fail = jasmine.createSpy("fail");
-                });
-
-                it("calls the invokeCamera method", function () {
-                    capture[method]([{limit: 1}], win, fail);
-                    expect(blackberry.invoke.card.invokeCamera).toHaveBeenCalledWith(action, 
-                                                                                     jasmine.any(Function),
-                                                                                     jasmine.any(Function),
-                                                                                     jasmine.any(Function));
-                });
-
-                describe("inside the invokeCamera callback", function () {
-                    var onsave;
-
-                    beforeEach(function () {
-                        window.webkitRequestFileSystem = jasmine.createSpy("window.webkitRequestFileSystem");
-                        global.blackberry.io = { sandbox: true };
-
-                        capture[method]([{limit: 1}], win, fail);
-                        onsave = blackberry.invoke.card.invokeCamera.mostRecentCall.args[1];
-                    });
-
-                    afterEach(function () {
-                        delete window.webkitRequestFileSystem;
-                    });
-
-                    it("sets the sandbox to false", function () {
-                        onsave();
-                        expect(blackberry.io.sandbox).toBe(false);
-                    });
-
-                    it("calls webkitRequestFileSystem", function () {
-                        onsave();
-                        expect(window.webkitRequestFileSystem).toHaveBeenCalledWith(
-                            window.PERSISTENT, 
-                            1024, 
-                            jasmine.any(Function), 
-                            fail);
-                    });
-
-                    describe("in the webkitRequestFileSystem callback", function () {
-                        var callback,
-                            fs = { root: { getFile: jasmine.createSpy("getFile") } };
-
-                        beforeEach(function () {
-                            onsave('/foo/bar/baz.gif');
-                            callback = window.webkitRequestFileSystem.mostRecentCall.args[2];
-                        });
-
-                        it("calls getfile on the provided filesystem", function () {
-                            callback(fs);
-                            expect(fs.root.getFile).toHaveBeenCalledWith('/foo/bar/baz.gif', 
-                                                                         {},
-                                                                         jasmine.any(Function), 
-                                                                         fail);
-                        });
-
-                        it("calls the file method of the fileEntity", function () {
-                            var fe = { file: jasmine.createSpy('file') };
-                            callback(fs);
-                            fs.root.getFile.mostRecentCall.args[2](fe);
-                            expect(fe.file).toHaveBeenCalledWith(jasmine.any(Function), fail);
-                        });
-
-                        describe("in the file callback", function () {
-                            var fe = { 
-                                    file: jasmine.createSpy('file'),
-                                    fullPath: 'file://this/is/the/full/path/eh.png'
-                                },
-                                fileCB;
-
-                            beforeEach(function () {
-                                callback(fs);
-                                fs.root.getFile.mostRecentCall.args[2](fe);
-                                fileCB = fe.file.mostRecentCall.args[0];
-                            });
-
-                            it("sets the fullPath of the file object", function () {
-                                var file = {};
-                                fileCB(file);
-                                expect(file.fullPath).toBe(fe.fullPath);
-                            });
-
-                            it("calls the win callback with an array containing the file", function () {
-                                var file = {};
-                                fileCB(file);
-                                expect(win).toHaveBeenCalledWith([file]);
-                            });
-
-                            it("resets the value of blackberry.io.sandbox", function () {
-                                var file = {};
-                                fileCB(file);
-                                expect(blackberry.io.sandbox).toBe(true);
-                            });
-                        });
-                    });
-                });
-            });
-        });
-    }
-
-    testCapture('captureImage', 'photo');
-    testCapture('captureVideo', 'video');
-
-    describe("captureAudio", function(){
-        it('should call the fail callback', function(){
-            var args = {},
-                win = jasmine.createSpy('win'),
-                fail = jasmine.createSpy('fail');
-
-            capture.captureAudio(args, win, fail);
-            expect(fail).toHaveBeenCalled();
-            expect(win).not.toHaveBeenCalled();
-        });
-
-        it('should return no result', function(){
-            var args = "arguments",
-                win = jasmine.createSpy('win'),
-                fail = jasmine.createSpy('fail');
-
-            expect(capture.captureAudio(args, win, fail)).toEqual({
-                status: cordova.callbackStatus.NO_RESULT,
-                message: "WebWorks Is On It"
-            });
-        });
-    });
-});


[03/26] js commit: more robust error handling.

Posted by ag...@apache.org.
more robust error handling.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/a945b9d5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/a945b9d5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/a945b9d5

Branch: refs/heads/2.9.x
Commit: a945b9d5cc8446a7acdf861ec46c4a89cd2fbac2
Parents: bd4cff0
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Tue May 21 18:14:57 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jun 19 13:32:07 2013 -0700

----------------------------------------------------------------------
 lib/scripts/plugin_loader.js | 85 +++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/a945b9d5/lib/scripts/plugin_loader.js
----------------------------------------------------------------------
diff --git a/lib/scripts/plugin_loader.js b/lib/scripts/plugin_loader.js
index 1a38eda..b56f124 100644
--- a/lib/scripts/plugin_loader.js
+++ b/lib/scripts/plugin_loader.js
@@ -34,11 +34,21 @@
         }
     }
 
+    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);
     }
@@ -50,10 +60,10 @@
         context.cordova.require('cordova/channel').onPluginsReady.fire();
     }
 
-    // Handler for the cordova_plugins.json content.
+    // 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 XHR response handler will just call finishPluginLoading().
+    // 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');
@@ -61,26 +71,31 @@
             // 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) continue;
-
-                if (module.clobbers && module.clobbers.length) {
-                    for (var j = 0; j < module.clobbers.length; j++) {
-                        mapper.clobbers(module.id, module.clobbers[j]);
+                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);
+                        }
                     }
-                }
-
-                if (module.merges && module.merges.length) {
-                    for (var k = 0; k < module.merges.length; k++) {
-                        mapper.merges(module.id, module.merges[k]);
+                    catch(err) {
+                        // error with module, most likely clobbers, should we continue?
                     }
                 }
-
-                // 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);
-                }
             }
 
             finishPluginLoading();
@@ -104,36 +119,18 @@
         }
     }
 
-    // // 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() {
-    //     finishPluginLoading();
-    // };
-
     var plugins_js = path + 'cordova_plugins.js';
-    try { // we commented we were going to try, so let us actually try and catch
-        //xhr.open('GET', plugins_json, true); // Async
-        //xhr.send();
+    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);


[06/26] js commit: moved plugin loader script injection to a function so it can also be called when xhr fails just because the json file is not present.

Posted by ag...@apache.org.
moved plugin loader script injection to a function so it can also be called when xhr fails just because the json file is not present.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/89127a80
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/89127a80
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/89127a80

Branch: refs/heads/2.9.x
Commit: 89127a803e91719fe30076b6e35548146aa74f56
Parents: 1fd26e1
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Wed Jun 19 14:35:26 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Wed Jun 19 14:35:26 2013 -0700

----------------------------------------------------------------------
 lib/scripts/plugin_loader.js | 50 +++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/89127a80/lib/scripts/plugin_loader.js
----------------------------------------------------------------------
diff --git a/lib/scripts/plugin_loader.js b/lib/scripts/plugin_loader.js
index b27216b..d9bea0a 100644
--- a/lib/scripts/plugin_loader.js
+++ b/lib/scripts/plugin_loader.js
@@ -121,6 +121,30 @@
 
     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() {
@@ -139,32 +163,16 @@
         }
     };
     xhr.onerror = function() {
-        finishPluginLoading();
+        // 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){
-        // 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
-        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();
-        }
+        injectPluginScript();
     }
 }(window));
 


[24/26] js commit: [all] CB-3960 Move jshint into grunt (lamely) (cherry picked from commit 3d81324b9d89c8f51b14e2152eec5bfbea094caa)

Posted by ag...@apache.org.
[all] CB-3960 Move jshint into grunt (lamely)
(cherry picked from commit 3d81324b9d89c8f51b14e2152eec5bfbea094caa)


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/8407cfbb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/8407cfbb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/8407cfbb

Branch: refs/heads/2.9.x
Commit: 8407cfbbcac805e1d813aab6d3df0b938259473b
Parents: 2d5fe12
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 13:36:58 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 28 10:13:07 2013 -0400

----------------------------------------------------------------------
 Gruntfile.js | 28 +++++++++++++++++++++++++++-
 Jakefile     | 48 ------------------------------------------------
 2 files changed, 27 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8407cfbb/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 928b456..81275ad 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -17,6 +17,7 @@
  * under the License.
 */
 module.exports = function(grunt) {
+    var childProcess = require('child_process');
     var fs = require('fs');
     var path = require('path');
 
@@ -152,9 +153,34 @@ module.exports = function(grunt) {
         }, done);
     });
 
+    // TODO - Delete this task and use Grunt's built-in jshint (CB-3964).
+    grunt.registerTask('hint', 'Runs jshint.', function() {
+        var done = this.async();
+        var knownWarnings = [
+            "Redefinition of 'FileReader'",
+            "Redefinition of 'require'",
+            "Read only",
+            "Redefinition of 'console'"
+        ];
+        var filterKnownWarnings = function(el, index, array) {
+            var wut = true;
+            // filter out the known warnings listed out above
+            knownWarnings.forEach(function(e) {
+                wut = wut && (el.indexOf(e) == -1);
+            });
+            wut = wut && (!el.match(/\d+ errors/));
+            return wut;
+        };
+
+        childProcess.exec("jshint lib", function(err,stdout,stderr) {
+            var exs = stdout.split('\n');
+            grunt.log.writeln(exs.filter(filterKnownWarnings).join('\n'));
+            done();
+        });
+    });
     grunt.loadNpmTasks('grunt-contrib-clean');
     grunt.loadNpmTasks('grunt-contrib-jshint');
 
     // Default task(s).
-    grunt.registerTask('default', ['cordovajs', 'complainwhitespace', 'test']);
+    grunt.registerTask('default', ['cordovajs', 'hint', 'complainwhitespace', 'test']);
 };

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8407cfbb/Jakefile
----------------------------------------------------------------------
diff --git a/Jakefile b/Jakefile
deleted file mode 100644
index 089b9b0..0000000
--- a/Jakefile
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF
- * or more contributor license agreements.  See th
- * distributed with this work for additional infor
- * regarding copyright ownership.  The ASF license
- * to you under the Apache License, Version 2.0 (t
- * "License"); you may not use this file except in
- * with the License.  You may obtain a copy of the
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to 
- * software distributed under the License is distr
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- * KIND, either express or implied.  See the Licen
- * specific language governing permissions and lim
- * under the License.
- */
-
-var childProcess = require('child_process');
-
-task('default', ['hint'], function () {});
-
-desc('check sources with JSHint');
-task('hint', [], function () {
-    var knownWarnings = [
-        "Redefinition of 'FileReader'", 
-        "Redefinition of 'require'", 
-        "Read only",
-        "Redefinition of 'console'"
-    ];
-    var filterKnownWarnings = function(el, index, array) {
-        var wut = true;
-        // filter out the known warnings listed out above
-        knownWarnings.forEach(function(e) {
-            wut = wut && (el.indexOf(e) == -1);
-        });
-        wut = wut && (!el.match(/\d+ errors/));
-        return wut;
-    };
-
-    childProcess.exec("jshint lib",function(err,stdout,stderr) {
-        var exs = stdout.split('\n');
-        console.log(exs.filter(filterKnownWarnings).join('\n')); 
-        complete();
-    });
-}, true);
-


[12/26] js commit: Change jake reference in code comments to say "grunt"

Posted by ag...@apache.org.
Change jake reference in code comments to say "grunt"


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/3a9b99a4
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/3a9b99a4
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/3a9b99a4

Branch: refs/heads/2.9.x
Commit: 3a9b99a4992b9c92a481006c29a58185cd50e056
Parents: 3d81324
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 15:25:27 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 21 15:25:27 2013 -0400

----------------------------------------------------------------------
 lib/common/argscheck.js | 2 +-
 test/runner.js          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3a9b99a4/lib/common/argscheck.js
----------------------------------------------------------------------
diff --git a/lib/common/argscheck.js b/lib/common/argscheck.js
index 524b435..5d0cbe7 100644
--- a/lib/common/argscheck.js
+++ b/lib/common/argscheck.js
@@ -63,7 +63,7 @@ function checkArgs(spec, functionName, args, opt_callee) {
     if (errMsg) {
         errMsg += ', but got ' + typeName + '.';
         errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
-        // Don't log when running jake test.
+        // Don't log when running unit tests.
         if (typeof jasmine == 'undefined') {
             console.error(errMsg);
         }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/3a9b99a4/test/runner.js
----------------------------------------------------------------------
diff --git a/test/runner.js b/test/runner.js
index 51846ba..97b713a 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -53,7 +53,7 @@ module.exports = {
             window = document.createWindow();
         } catch (e) {
             //no jsDom (some people don't have compilers)
-            throw new Error("can't run tests in node: run jake btest instead, or install jsdom via: npm install");
+            throw new Error("can't run tests in node: run grunt btest instead, or install jsdom via: npm install");
         }
 
         //Put jasmine in scope


[25/26] js commit: Change jake reference in code comments to say "grunt" (cherry picked from commit 3a9b99a4992b9c92a481006c29a58185cd50e056)

Posted by ag...@apache.org.
Change jake reference in code comments to say "grunt"
(cherry picked from commit 3a9b99a4992b9c92a481006c29a58185cd50e056)


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/c56748c9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/c56748c9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/c56748c9

Branch: refs/heads/2.9.x
Commit: c56748c92224e573aa2f1dcc14a33a8f603763d8
Parents: 8407cfb
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Jun 21 15:25:27 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Jun 28 10:13:47 2013 -0400

----------------------------------------------------------------------
 lib/common/argscheck.js | 2 +-
 test/runner.js          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c56748c9/lib/common/argscheck.js
----------------------------------------------------------------------
diff --git a/lib/common/argscheck.js b/lib/common/argscheck.js
index 524b435..5d0cbe7 100644
--- a/lib/common/argscheck.js
+++ b/lib/common/argscheck.js
@@ -63,7 +63,7 @@ function checkArgs(spec, functionName, args, opt_callee) {
     if (errMsg) {
         errMsg += ', but got ' + typeName + '.';
         errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
-        // Don't log when running jake test.
+        // Don't log when running unit tests.
         if (typeof jasmine == 'undefined') {
             console.error(errMsg);
         }

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/c56748c9/test/runner.js
----------------------------------------------------------------------
diff --git a/test/runner.js b/test/runner.js
index 51846ba..97b713a 100644
--- a/test/runner.js
+++ b/test/runner.js
@@ -53,7 +53,7 @@ module.exports = {
             window = document.createWindow();
         } catch (e) {
             //no jsDom (some people don't have compilers)
-            throw new Error("can't run tests in node: run jake btest instead, or install jsdom via: npm install");
+            throw new Error("can't run tests in node: run grunt btest instead, or install jsdom via: npm install");
         }
 
         //Put jasmine in scope


[20/26] js commit: [WP7] DOMStorage is now added/polyfilled via native code

Posted by ag...@apache.org.
[WP7] DOMStorage is now added/polyfilled via native code


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/f96eefcd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/f96eefcd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/f96eefcd

Branch: refs/heads/2.9.x
Commit: f96eefcd37a67e1fb1128676c4e18a26413fed81
Parents: d422f84
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Thu Jun 27 17:33:04 2013 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Thu Jun 27 17:33:04 2013 -0700

----------------------------------------------------------------------
 .../windowsphone/DOMStorage/plugininit.js       | 146 -------------------
 1 file changed, 146 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/f96eefcd/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
----------------------------------------------------------------------
diff --git a/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js b/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
deleted file mode 100644
index c8bd777..0000000
--- a/lib/windowsphone/plugin/windowsphone/DOMStorage/plugininit.js
+++ /dev/null
@@ -1,146 +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.
- *
-*/
-
-(function(win, doc) {
-var docDomain = null;
-try {
-    docDomain = doc.domain;
-} catch (err) {}
-var isIE10 = navigator.userAgent.toUpperCase().indexOf('MSIE 10') > -1;
-if (!isIE10 && (!docDomain || docDomain.length === 0) ) {
-    var DOMStorage = function(type) {
-        if (type == "sessionStorage") {
-            this._type = type;
-        }
-        Object.defineProperty(this, "length", {
-            configurable: true,
-            get: function() {
-                return this.getLength();
-            }
-        });
-    };
-    DOMStorage.prototype = {
-        _type: "localStorage",
-        _result: null,
-        keys: null,
-        onResult: function(key, valueStr) {
-            if (!this.keys) {
-                this.keys = [];
-            }
-            this._result = valueStr;
-        },
-        onKeysChanged: function(jsonKeys) {
-            this.keys = JSON.parse(jsonKeys);
-            var key;
-            for (var n = 0, len = this.keys.length; n < len; n++) {
-                key = this.keys[n];
-                if (!this.hasOwnProperty(key)) {
-                    Object.defineProperty(this, key, {
-                        configurable: true,
-                        get: function() {
-                            return this.getItem(key);
-                        },
-                        set: function(val) {
-                            return this.setItem(key, val);
-                        }
-                    });
-                }
-            }
-        },
-        initialize: function() {
-            window.external.Notify("DOMStorage/" + this._type + "/load/keys");
-        },
-        getLength: function() {
-            if (!this.keys) {
-                this.initialize();
-            }
-            return this.keys.length;
-        },
-        key: function(n) {
-            if (!this.keys) {
-                this.initialize();
-            }
-            if (n >= this.keys.length) {
-                return null;
-            } else {
-                return this.keys[n];
-            }
-        },
-        getItem: function(key) {
-            if (!this.keys) {
-                this.initialize();
-            }
-            var retVal = null;
-            if (this.keys.indexOf(key) > -1) {
-                window.external.Notify("DOMStorage/" + this._type + "/get/" + key);
-                retVal = window.unescape(decodeURIComponent(this._result));
-                this._result = null;
-            }
-            return retVal;
-        },
-        setItem: function(key, value) {
-            if (!this.keys) {
-                this.initialize();
-            }
-            window.external.Notify("DOMStorage/" + this._type + "/set/" + key + "/" + encodeURIComponent(window.escape(value)));
-        },
-        removeItem: function(key) {
-            if (!this.keys) {
-                this.initialize();
-            }
-            var index = this.keys.indexOf(key);
-            if (index > -1) {
-                this.keys.splice(index, 1);
-                window.external.Notify("DOMStorage/" + this._type + "/remove/" + key);
-                delete this[key];
-            }
-        },
-        clear: function() {
-            if (!this.keys) {
-                this.initialize();
-            }
-            for (var n = 0, len = this.keys.length; n < len; n++) {
-                delete this[this.keys[n]];
-            }
-            this.keys = [];
-            window.external.Notify("DOMStorage/" + this._type + "/clear/");
-        }
-    };
-    if (typeof window.localStorage === "undefined") {
-        Object.defineProperty(window, "localStorage", {
-            writable: false,
-            configurable: false,
-            value: new DOMStorage("localStorage")
-        });
-        window.localStorage.initialize();
-    }
-    if (typeof window.sessionStorage === "undefined") {
-        Object.defineProperty(window, "sessionStorage", {
-            writable: false,
-            configurable: false,
-            value: new DOMStorage("sessionStorage")
-        });
-        window.sessionStorage.initialize();
-    }
-}
-})(window, document);
-
-module.exports = null;
\ No newline at end of file