You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2013/03/27 19:45:09 UTC

[2/6] js commit: Fix all lint warnings.

Fix all lint warnings.


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

Branch: refs/heads/2.6.x
Commit: 188648bfa74650f7692d71f9ba6a1fa69e1a3877
Parents: 9a65e32
Author: Andrew Grieve <ag...@chromium.org>
Authored: Sat Mar 23 13:05:45 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Sat Mar 23 13:05:45 2013 -0400

----------------------------------------------------------------------
 lib/blackberry/plugin/qnx/file.js         |    1 +
 lib/blackberry/plugin/qnx/fileTransfer.js |    1 +
 lib/common/plugin/FileTransfer.js         |   18 +++++-------------
 lib/common/plugin/InAppBrowser.js         |    2 +-
 lib/osx/exec.js                           |    6 +++---
 lib/tizen/plugin/tizen/ContactUtils.js    |    7 +------
 lib/webos/platform.js                     |    2 ++
 7 files changed, 14 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/blackberry/plugin/qnx/file.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/qnx/file.js b/lib/blackberry/plugin/qnx/file.js
index 8bf9b86..d611daf 100644
--- a/lib/blackberry/plugin/qnx/file.js
+++ b/lib/blackberry/plugin/qnx/file.js
@@ -20,6 +20,7 @@
 */
 
 /*global WebKitBlobBuilder:false */
+/*global Blob:false */
 var cordova = require('cordova'),
     FileError = require('cordova/plugin/FileError'),
     DirectoryEntry = require('cordova/plugin/DirectoryEntry'),

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/blackberry/plugin/qnx/fileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry/plugin/qnx/fileTransfer.js b/lib/blackberry/plugin/qnx/fileTransfer.js
index 7148e17..6848516 100644
--- a/lib/blackberry/plugin/qnx/fileTransfer.js
+++ b/lib/blackberry/plugin/qnx/fileTransfer.js
@@ -19,6 +19,7 @@
  *
 */
 
+/*global Blob:false */
 var cordova = require('cordova'),
     FileEntry = require('cordova/plugin/FileEntry'),
     FileTransferError = require('cordova/plugin/FileTransferError'),

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/common/plugin/FileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/FileTransfer.js b/lib/common/plugin/FileTransfer.js
index 2e4c980..20c0eb2 100644
--- a/lib/common/plugin/FileTransfer.js
+++ b/lib/common/plugin/FileTransfer.js
@@ -45,7 +45,7 @@ function getBasicAuthHeader(urlString) {
         var origin = protocol + url.host;
 
         // check whether there are the username:password credentials in the url
-        if (url.href.indexOf(origin) != 0) { // credentials found
+        if (url.href.indexOf(origin) !== 0) { // credentials found
             var atIndex = url.href.indexOf("@");
             credentials = url.href.substring(protocol.length, atIndex);
         }
@@ -97,12 +97,8 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro
 
     var basicAuthHeader = getBasicAuthHeader(server);
     if (basicAuthHeader) {
-        if (!options) {
-            options = new FileUploadOptions();
-        }
-        if (!options.headers) {
-            options.headers = {};
-        }
+        options = options || {};
+        options.headers = options.headers || {};
         options.headers[basicAuthHeader.name] = basicAuthHeader.value;
     }
 
@@ -155,12 +151,8 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro
 
     var basicAuthHeader = getBasicAuthHeader(source);
     if (basicAuthHeader) {
-        if (!options) {
-            options = {};
-        }
-        if (!options.headers) {
-            options.headers = {};
-        }
+        options = options || {};
+        options.headers = options.headers || {};
         options.headers[basicAuthHeader.name] = basicAuthHeader.value;
     }
 

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/common/plugin/InAppBrowser.js
----------------------------------------------------------------------
diff --git a/lib/common/plugin/InAppBrowser.js b/lib/common/plugin/InAppBrowser.js
index 6e0b79b..618befd 100644
--- a/lib/common/plugin/InAppBrowser.js
+++ b/lib/common/plugin/InAppBrowser.js
@@ -67,7 +67,7 @@ InAppBrowser.prototype = {
         var script,
             sourceString;
         if (injectDetails.code) {
-       	    sourceString = JSON.stringify(injectDetails.code);
+            sourceString = JSON.stringify(injectDetails.code);
             script = "(function(d) { var c = d.createElement('style'); c.innerHTML = " + sourceString + "; d.body.appendChild(c); })(document)";
             exec(cb, null, "InAppBrowser", "injectScriptCode", [script]);
         } else if (injectDetails.file) {

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/osx/exec.js
----------------------------------------------------------------------
diff --git a/lib/osx/exec.js b/lib/osx/exec.js
index 0e9faf7..6eebb7b 100644
--- a/lib/osx/exec.js
+++ b/lib/osx/exec.js
@@ -114,9 +114,9 @@ function OSXExec() {
 
 
 OSXExec.nativeCallback = function(callbackId, status, message, keepCallback) {
-	var success = status === 0 || status === 1;
-	var args = convertMessageToArgsNativeToJs(message);
-	cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
+    var success = status === 0 || status === 1;
+    var args = convertMessageToArgsNativeToJs(message);
+    cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
 };
 
 module.exports = OSXExec;

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/tizen/plugin/tizen/ContactUtils.js
----------------------------------------------------------------------
diff --git a/lib/tizen/plugin/tizen/ContactUtils.js b/lib/tizen/plugin/tizen/ContactUtils.js
index 7ac05f3..de1c7aa 100644
--- a/lib/tizen/plugin/tizen/ContactUtils.js
+++ b/lib/tizen/plugin/tizen/ContactUtils.js
@@ -61,15 +61,10 @@ var fieldMappings = {
  */
 var allFields = [];
 
-(function initializeAllFieldsMapping() {
-
+(function() {
     for ( var key in fieldMappings) {
         allFields.push(key);
     }
-    // as we want it to be executed once
-    function initializeAllFieldsMapping() {
-    }
-
 })();
 
 /**

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188648bf/lib/webos/platform.js
----------------------------------------------------------------------
diff --git a/lib/webos/platform.js b/lib/webos/platform.js
index 69626d0..f59ab5b 100644
--- a/lib/webos/platform.js
+++ b/lib/webos/platform.js
@@ -19,6 +19,8 @@
  *
 */
 
+/*global Mojo:false */
+
 var service=require('cordova/plugin/webos/service'),
     cordova = require('cordova');