incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [5/15] git commit: linting code
Date Fri, 20 Apr 2012 00:21:40 GMT
linting code


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

Branch: refs/heads/master
Commit: 88b2e2fd1ac19ad959d02bf4960b65e70cf81e4c
Parents: f25e975
Author: Fil Maj <maj.fil@gmail.com>
Authored: Wed Apr 18 12:30:57 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Thu Apr 19 17:21:08 2012 -0700

----------------------------------------------------------------------
 lib/android/plugin/android/storage.js            |    2 +-
 lib/blackberry/plugin/blackberry/Contact.js      |   36 +++---
 lib/blackberry/plugin/blackberry/ContactUtils.js |   19 ++--
 lib/blackberry/plugin/blackberry/app.js          |    3 +-
 lib/blackberry/plugin/blackberry/contacts.js     |    2 +-
 lib/blackberry/plugin/blackberry/notification.js |    4 +-
 lib/common/plugin/Camera.js                      |    2 +-
 lib/common/plugin/Contact.js                     |    6 +-
 lib/common/plugin/FileWriter.js                  |    2 +-
 lib/common/plugin/compass.js                     |    2 +-
 lib/errgen/plugin/errgen/device.js               |   20 ++--
 lib/ios/plugin/ios/Contact.js                    |    4 +-
 lib/ios/plugin/ios/FileReader.js                 |    2 +-
 lib/ios/plugin/ios/console.js                    |    2 +-
 lib/ios/plugin/ios/notification.js               |    2 +-
 lib/playbook/plugin/playbook/manager.js          |    3 +-
 lib/scripts/bootstrap-errgen.js                  |    2 +-
 lib/wp7/plugin/wp7/DOMStorage.js                 |  101 ++++++-----------
 lib/wp7/plugin/wp7/XHRPatch.js                   |   32 ++---
 19 files changed, 99 insertions(+), 147 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/android/plugin/android/storage.js
----------------------------------------------------------------------
diff --git a/lib/android/plugin/android/storage.js b/lib/android/plugin/android/storage.js
index 112f956..14072a0 100644
--- a/lib/android/plugin/android/storage.js
+++ b/lib/android/plugin/android/storage.js
@@ -305,7 +305,7 @@ var CupcakeLocalStorage = function() {
           transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY
KEY, body NVARCHAR(255))');
           transaction.executeSql('SELECT * FROM storage', [], function(tx, result) {
             for(var i = 0; i < result.rows.length; i++) {
-              storage[result.rows.item(i)['id']] =  result.rows.item(i)['body'];
+              storage[result.rows.item(i).id] =  result.rows.item(i).body;
             }
             setLength(result.rows.length);
             channel.initializationComplete("cupcakeStorage");

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/blackberry/plugin/blackberry/Contact.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/Contact.js b/lib/blackberry/plugin/blackberry/Contact.js
index bbc0937..de1ba17 100644
--- a/lib/blackberry/plugin/blackberry/Contact.js
+++ b/lib/blackberry/plugin/blackberry/Contact.js
@@ -153,12 +153,12 @@ var saveToDevice = function(contact) {
 
         var type = null;
         var number = null;
-        for ( var i = 0; i < contact.phoneNumbers.length; i += 1) {
-            if (!contact.phoneNumbers[i] || !contact.phoneNumbers[i].value) {
+        for ( var j = 0; j < contact.phoneNumbers.length; j += 1) {
+            if (!contact.phoneNumbers[j] || !contact.phoneNumbers[j].value) {
                 continue;
             }
-            type = contact.phoneNumbers[i].type;
-            number = contact.phoneNumbers[i].value;
+            type = contact.phoneNumbers[j].type;
+            number = contact.phoneNumbers[j].value;
             if (type === 'home') {
                 if (bbContact.homePhone === "") {
                     bbContact.homePhone = number;
@@ -196,18 +196,16 @@ var saveToDevice = function(contact) {
         var address = null;
         var bbHomeAddress = null;
         var bbWorkAddress = null;
-        for ( var i = 0; i < contact.addresses.length; i += 1) {
-            address = contact.addresses[i];
+        for ( var k = 0; k < contact.addresses.length; k += 1) {
+            address = contact.addresses[k];
             if (!address || address instanceof ContactAddress === false) {
                 continue;
             }
 
-            if (bbHomeAddress === null
-                    && (!address.type || address.type === "home")) {
+            if (bbHomeAddress === null && (!address.type || address.type === "home"))
{
                 bbHomeAddress = createBlackBerryAddress(address);
                 bbContact.homeAddress = bbHomeAddress;
-            } else if (bbWorkAddress === null
-                    && (!address.type || address.type === "work")) {
+            } else if (bbWorkAddress === null && (!address.type || address.type ===
"work")) {
                 bbWorkAddress = createBlackBerryAddress(address);
                 bbContact.workAddress = bbWorkAddress;
             }
@@ -223,8 +221,8 @@ var saveToDevice = function(contact) {
         }
 
         var url = null;
-        for ( var i = 0; i < contact.urls.length; i += 1) {
-            url = contact.urls[i];
+        for ( var m = 0; m < contact.urls.length; m += 1) {
+            url = contact.urls[m];
             if (!url || !url.value) {
                 continue;
             }
@@ -245,8 +243,8 @@ var saveToDevice = function(contact) {
         }
 
         var org = null;
-        for ( var i = 0; i < contact.organizations.length; i += 1) {
-            org = contact.organizations[i];
+        for ( var n = 0; n < contact.organizations.length; n += 1) {
+            org = contact.organizations[n];
             if (!org) {
                 continue;
             }
@@ -262,8 +260,8 @@ var saveToDevice = function(contact) {
     if (contact.categories && contact.categories instanceof Array) {
         bbContact.categories = [];
         var category = null;
-        for ( var i = 0; i < contact.categories.length; i += 1) {
-            category = contact.categories[i];
+        for ( var o = 0; o < contact.categories.length; o += 1) {
+            category = contact.categories[o];
             if (typeof category == "string") {
                 bbContact.categories.push(category);
             }
@@ -277,8 +275,8 @@ var saveToDevice = function(contact) {
     // fail gracefully if photo URL is no good, but log the error
     if (contact.photos && contact.photos instanceof Array) {
         var photo = null;
-        for ( var i = 0; i < contact.photos.length; i += 1) {
-            photo = contact.photos[i];
+        for ( var p = 0; p < contact.photos.length; p += 1) {
+            photo = contact.photos[p];
             if (!photo || !photo.value) {
                 continue;
             }
@@ -383,4 +381,4 @@ module.exports = {
             }
         }
     }
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/blackberry/plugin/blackberry/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/ContactUtils.js b/lib/blackberry/plugin/blackberry/ContactUtils.js
index 3ef7a04..1155564 100644
--- a/lib/blackberry/plugin/blackberry/ContactUtils.js
+++ b/lib/blackberry/plugin/blackberry/ContactUtils.js
@@ -87,8 +87,7 @@ var createContactAddress = function(type, bbAddress) {
     var region = bbAddress.stateProvince || "";
     var postalCode = bbAddress.zipPostal || "";
     var country = bbAddress.country || "";
-    var formatted = streetAddress + ", " + locality + ", " + region + ", "
-            + postalCode + ", " + country;
+    var formatted = streetAddress + ", " + locality + ", " + region + ", " + postalCode +
", " + country;
 
     return new ContactAddress(null, type, formatted, streetAddress, locality,
             region, postalCode, country);
@@ -140,8 +139,7 @@ module.exports = {
         //
         var ciFilter = "";
         for ( var i = 0; i < filter.length; i++) {
-            ciFilter = ciFilter + "[" + filter[i].toLowerCase()
-                    + filter[i].toUpperCase() + "]";
+            ciFilter = ciFilter + "[" + filter[i].toLowerCase() + filter[i].toUpperCase()
+ "]";
         }
 
         // match anything that contains our filter string
@@ -151,14 +149,14 @@ module.exports = {
         var filterExpression = null;
         if (fields && fields instanceof Array) {
             var fe = null;
-            for ( var i in fields) {
-                if (!fields[i]) {
+            for ( var f in fields) {
+                if (!fields[f]) {
                     continue;
                 }
 
                 // retrieve the BlackBerry contact fields that map to the one
                 // specified
-                var bbFields = fieldMappings[fields[i]];
+                var bbFields = fieldMappings[fields[f]];
 
                 // BlackBerry doesn't support the field specified
                 if (!bbFields) {
@@ -209,7 +207,7 @@ module.exports = {
         var contact = new Contact(bbContact.uid, bbContact.user1);
 
         // nothing to do
-        if (!fields || !(fields instanceof Array) || fields.length == 0) {
+        if (!fields || !(fields instanceof Array) || fields.length === 0) {
             return contact;
         } else if (fields.length == 1 && fields[0] === "*") {
             // Cordova enhancement to allow fields value of ["*"] to indicate
@@ -227,8 +225,7 @@ module.exports = {
 
             // name
             if (field.indexOf('name') === 0) {
-                var formattedName = bbContact.title + ' ' + bbContact.firstName
-                        + ' ' + bbContact.lastName;
+                var formattedName = bbContact.title + ' ' + bbContact.firstName + ' ' + bbContact.lastName;
                 contact.name = new ContactName(formattedName,
                         bbContact.lastName, bbContact.firstName, null,
                         bbContact.title, null);
@@ -350,4 +347,4 @@ module.exports = {
 
         return contact;
     }
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/blackberry/plugin/blackberry/app.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/app.js b/lib/blackberry/plugin/blackberry/app.js
index 6c58e30..42b5bc5 100644
--- a/lib/blackberry/plugin/blackberry/app.js
+++ b/lib/blackberry/plugin/blackberry/app.js
@@ -6,8 +6,7 @@ module.exports = {
    * Clear the resource cache.
    */
   clearCache:function() {
-      if (typeof blackberry.widgetcache === "undefined"
-          || blackberry.widgetcache === null) {
+      if (typeof blackberry.widgetcache === "undefined" || blackberry.widgetcache === null)
{
           console.log("blackberry.widgetcache permission not found. Cache clear denied.");
           return;
       }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/blackberry/plugin/blackberry/contacts.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/contacts.js b/lib/blackberry/plugin/blackberry/contacts.js
index 14dcfcd..6a3aec0 100644
--- a/lib/blackberry/plugin/blackberry/contacts.js
+++ b/lib/blackberry/plugin/blackberry/contacts.js
@@ -15,7 +15,7 @@ module.exports = {
         }
 
         // Search qualifier is required and cannot be empty.
-        if (!fields || !(fields instanceof Array) || fields.length == 0) {
+        if (!fields || !(fields instanceof Array) || fields.length === 0) {
             if (typeof fail === 'function') {
                 fail(new ContactError(ContactError.INVALID_ARGUMENT_ERROR));
             }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/blackberry/plugin/blackberry/notification.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/blackberry/notification.js b/lib/blackberry/plugin/blackberry/notification.js
index 83bc77c..87a9744 100644
--- a/lib/blackberry/plugin/blackberry/notification.js
+++ b/lib/blackberry/plugin/blackberry/notification.js
@@ -49,5 +49,5 @@ module.exports = {
      */
     progressValue : function(value) {
         exec(null, null, 'Notification', 'progressValue', [ value ]);
-    },
-};
\ No newline at end of file
+    }
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/common/plugin/Camera.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/Camera.js b/lib/common/plugin/Camera.js
index 7bcdb59..d742974 100644
--- a/lib/common/plugin/Camera.js
+++ b/lib/common/plugin/Camera.js
@@ -100,6 +100,6 @@ cameraExport.getPicture = function(successCallback, errorCallback, options)
{
     }
 
     exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType,
sourceType, targetWidth, targetHeight, encodingType, mediaType, allowEdit, correctOrientation,
saveToPhotoAlbum]);
-}
+};
 
 module.exports = cameraExport;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/common/plugin/Contact.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/Contact.js b/lib/common/plugin/Contact.js
index 3c09fbc..b48e9c2 100644
--- a/lib/common/plugin/Contact.js
+++ b/lib/common/plugin/Contact.js
@@ -14,7 +14,7 @@ function convertIn(contact) {
       console.log("Cordova Contact convertIn error: exception creating date.");
     }
     return contact;
-};
+}
 
 /**
 * Converts Complex objects into primitives
@@ -23,7 +23,7 @@ function convertIn(contact) {
 
 function convertOut(contact) {
     var value = contact.birthday;
-    if (value != null) {
+    if (value !== null) {
         // try to make it a Date object if it is not already
         if (!value instanceof Date){
             try {
@@ -38,7 +38,7 @@ function convertOut(contact) {
         contact.birthday = value;
     }
     return contact;
-};
+}
 
 /**
 * Contains information about a single contact.

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/common/plugin/FileWriter.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/FileWriter.js b/lib/common/plugin/FileWriter.js
index 652240b..643dffa 100644
--- a/lib/common/plugin/FileWriter.js
+++ b/lib/common/plugin/FileWriter.js
@@ -158,7 +158,7 @@ FileWriter.prototype.seek = function(offset) {
         throw new FileError(FileError.INVALID_STATE_ERR);
     }
 
-    if (!offset && offset != 0) {
+    if (!offset && offset !== 0) {
         return;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/common/plugin/compass.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/compass.js b/lib/common/plugin/compass.js
index 06b723c..02444c2 100644
--- a/lib/common/plugin/compass.js
+++ b/lib/common/plugin/compass.js
@@ -32,7 +32,7 @@ var exec = require('cordova/exec'),
             var fail = function(code) {
                 var ce = new CompassError(code);
                 errorCallback(ce);
-            }
+            };
             
             // Get heading
             exec(win, fail, "Compass", "getHeading", [options]);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/errgen/plugin/errgen/device.js
----------------------------------------------------------------------
diff --git a/lib/errgen/plugin/errgen/device.js b/lib/errgen/plugin/errgen/device.js
index 4e05777..a3b8e6c 100644
--- a/lib/errgen/plugin/errgen/device.js
+++ b/lib/errgen/plugin/errgen/device.js
@@ -25,18 +25,18 @@
 
 //------------------------------------------------------------------------------
 function Device() {
-    window.DeviceInfo = {}
+    window.DeviceInfo = {};
     
-    this.platform  = "errgen"
-    this.version   = "any"
-    this.name      = "errgen"
-    this.phonegap  = {}
-    this.gap       = this.phonegap
-    this.uuid      = "1234-5678-9012-3456"
-    this.available = true
+    this.platform  = "errgen";
+    this.version   = "any";
+    this.name      = "errgen";
+    this.phonegap  = {};
+    this.gap       = this.phonegap;
+    this.uuid      = "1234-5678-9012-3456";
+    this.available = true;
     
-    require('cordova/channel').onCordovaInfoReady.fire()
+    require('cordova/channel').onCordovaInfoReady.fire();
 }
 
 //------------------------------------------------------------------------------
-module.exports = window.DeviceInfo = new Device()
+module.exports = window.DeviceInfo = new Device();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/ios/plugin/ios/Contact.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/Contact.js b/lib/ios/plugin/ios/Contact.js
index bc511a5..dcf97cd 100644
--- a/lib/ios/plugin/ios/Contact.js
+++ b/lib/ios/plugin/ios/Contact.js
@@ -17,7 +17,7 @@ module.exports = {
          *        "false" (default) display contact
          */
 
-        if (this.id == null) {
+        if (this.id === null) {
             if (typeof errorCB === "function") {
                 var errorObj = new ContactError(ContactError.UNKNOWN_ERROR);
                 errorCB(errorObj);
@@ -27,4 +27,4 @@ module.exports = {
             exec(null, errorCB, "Contacts","displayContact", [this.id, options]);
         }
     }
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/ios/plugin/ios/FileReader.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/FileReader.js b/lib/ios/plugin/ios/FileReader.js
index 5711393..87b5501 100644
--- a/lib/ios/plugin/ios/FileReader.js
+++ b/lib/ios/plugin/ios/FileReader.js
@@ -84,4 +84,4 @@ module.exports = {
             }, 
         "File", "readAsText", [this.fileName, enc]);
     }
-}
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/ios/plugin/ios/console.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/console.js b/lib/ios/plugin/ios/console.js
index 339f707..2545c56 100644
--- a/lib/ios/plugin/ios/console.js
+++ b/lib/ios/plugin/ios/console.js
@@ -30,7 +30,7 @@ var stringify = function(message) {
     } catch (e) {
         return e.toString();
     }
-}
+};
 
 /**
  * Print a normal log message to the console

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/ios/plugin/ios/notification.js
----------------------------------------------------------------------
diff --git a/lib/ios/plugin/ios/notification.js b/lib/ios/plugin/ios/notification.js
index a49567d..b8f222a 100644
--- a/lib/ios/plugin/ios/notification.js
+++ b/lib/ios/plugin/ios/notification.js
@@ -4,4 +4,4 @@ module.exports = {
     beep:function(count) {
         (new Media('beep.wav')).play();
     }
-}
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/playbook/plugin/playbook/manager.js
----------------------------------------------------------------------
diff --git a/lib/playbook/plugin/playbook/manager.js b/lib/playbook/plugin/playbook/manager.js
index 89fcfae..295f86c 100644
--- a/lib/playbook/plugin/playbook/manager.js
+++ b/lib/playbook/plugin/playbook/manager.js
@@ -24,8 +24,7 @@ var webworks = require('cordova/plugin/webworks/manager'),
                             "isPlugged" : state === 2
                         };
 
-                        if (me._isPlugged !== info.isPlugged
-                                && typeof win === 'function') {
+                        if (me._isPlugged !== info.isPlugged && typeof win === 'function')
{
                             win(info);
                         }
                     }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/scripts/bootstrap-errgen.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-errgen.js b/lib/scripts/bootstrap-errgen.js
index cc479e8..d238a5f 100644
--- a/lib/scripts/bootstrap-errgen.js
+++ b/lib/scripts/bootstrap-errgen.js
@@ -17,4 +17,4 @@
  * under the License.
  */
 
-require('cordova/channel').onNativeReady.fire()
\ No newline at end of file
+require('cordova/channel').onNativeReady.fire();

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/wp7/plugin/wp7/DOMStorage.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/DOMStorage.js b/lib/wp7/plugin/wp7/DOMStorage.js
index db61f4c..4620e80 100644
--- a/lib/wp7/plugin/wp7/DOMStorage.js
+++ b/lib/wp7/plugin/wp7/DOMStorage.js
@@ -1,49 +1,36 @@
-(function()
-{
+(function() {
 
-    var DOMStorage = function(type)
-    {
+    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 = 
-    {
+    DOMStorage.prototype = {
         _type:"localStorage",
         _result:null,
         keys:null,
     
-        onResult:function(key,valueStr)
-        {
-            if(!this.keys)
-            {
+        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); }
@@ -53,18 +40,15 @@
 
         },
 
-        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;
@@ -76,19 +60,14 @@
         (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
-            {
+            } else {
                 return this.keys[n];
             }
         },
@@ -97,16 +76,13 @@
         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 = this._result;
                 this._result = null;
@@ -121,10 +97,8 @@
         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 + "/" + value);
@@ -135,21 +109,17 @@
         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)
-            {
+            if(index > -1) {
                 this.keys.splice(index,1);
                 // TODO: need sanity check for keys ? like 'clear','setItem', ...
                 window.external.Notify("DOMStorage/" + this._type + "/remove/" + key);
                 delete this[key];
             }
-            
         },
 
     /*
@@ -157,15 +127,12 @@
         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++)
-            {
+            for(var n=0,len=this.keys.length; n < len;n++) {
                 // TODO: do we need a sanity check for keys ? like 'clear','setItem', ...
                 delete this[this.keys[n]];
             }
@@ -176,16 +143,14 @@
 
     // initialize DOMStorage
     
-    Object.defineProperty( window, "localStorage", 
-    {
+    Object.defineProperty( window, "localStorage", {
         writable: false,
         configurable: false,
         value:new DOMStorage("localStorage")
     });
     window.localStorage.initialize();
 
-    Object.defineProperty( window, "sessionStorage", 
-    {
+    Object.defineProperty( window, "sessionStorage", {
         writable: false,
         configurable: false,
         value:new DOMStorage("sessionStorage")
@@ -195,4 +160,4 @@
 
 })();
 
-module.exports = null;
\ No newline at end of file
+module.exports = null;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/88b2e2fd/lib/wp7/plugin/wp7/XHRPatch.js
----------------------------------------------------------------------
diff --git a/lib/wp7/plugin/wp7/XHRPatch.js b/lib/wp7/plugin/wp7/XHRPatch.js
index a3a6dd1..2b7d535 100644
--- a/lib/wp7/plugin/wp7/XHRPatch.js
+++ b/lib/wp7/plugin/wp7/XHRPatch.js
@@ -1,17 +1,13 @@
-
-
 (function (win, doc) {
 
 var docDomain = null;
 try {
     docDomain = doc.domain;
-}
-catch (err) 
-{
+} catch (err) {
     //console.log("caught exception trying to access document.domain");
 }
 
-if (!docDomain || docDomain.length == 0) {
+if (!docDomain || docDomain.length === 0) {
 
     var aliasXHR = win.XMLHttpRequest;
 
@@ -23,8 +19,7 @@ if (!docDomain || docDomain.length == 0) {
     win.XMLHttpRequest.LOADING = 3;
     win.XMLHttpRequest.DONE = 4;
 
-    win.XMLHttpRequest.prototype =
-    {
+    win.XMLHttpRequest.prototype = {
         UNSENT: 0,
         OPENED: 1,
         HEADERS_RECEIVED: 2,
@@ -40,7 +35,7 @@ if (!docDomain || docDomain.length == 0) {
         _requestHeaders: null,
         open: function (reqType, uri, isAsync, user, password) {
 
-            if (uri && uri.indexOf("http") == 0) {
+            if (uri && uri.indexOf("http") === 0) {
                 if (!this.wrappedXHR) {
                     this.wrappedXHR = new aliasXHR();
                     var self = this;
@@ -164,26 +159,26 @@ if (!docDomain || docDomain.length == 0) {
 
                 var alias = this;
 
-                function fail(evt) {
+                var fail = function fail(evt) {
                     alias.onError(evt.code);
-                }
+                };
 
-                function gotFile(file) {
+                var gotFile = function gotFile(file) {
                     var reader = new FileReader();
                     reader.onloadend = function (evt) 
                     {
                         alias.onResult.apply(alias,[evt.target.result]);
                     };
                     reader.readAsText(file);
-                }
+                };
 
-                function gotEntry(entry) {
+                var gotEntry = function gotEntry(entry) {
                     entry.file(gotFile, fail);
-                }
+                };
 
-                function gotFS(fs) {
+                var gotFS = function gotFS(fs) {
                     fs.root.getFile(alias._url, null, gotEntry, fail);
-                }
+                };
 
                 window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
 
@@ -194,7 +189,6 @@ if (!docDomain || docDomain.length == 0) {
 } // if doc domain 
 
 // end closure wrap
-})(window, document); 
+})(window, document);
 
 module.exports = null;
-


Mime
View raw message