cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dase...@apache.org
Subject cordova-plugin-file git commit: CB-10636 Add JSHint for plugins
Date Wed, 24 Feb 2016 14:32:36 GMT
Repository: cordova-plugin-file
Updated Branches:
  refs/heads/master f231e7c00 -> f6d42aee1


CB-10636 Add JSHint for plugins

Fixed file.spec.115


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

Branch: refs/heads/master
Commit: f6d42aee153e260422786f7b561081247c3975e5
Parents: f231e7c
Author: daserge <v-seshak@microsoft.com>
Authored: Mon Feb 22 19:14:26 2016 +0300
Committer: daserge <v-seshak@microsoft.com>
Committed: Wed Feb 24 13:49:16 2016 +0300

----------------------------------------------------------------------
 .gitignore                                |   1 +
 .jshintrc                                 |  30 +++
 .travis.yml                               |   4 +
 README.md                                 |   2 +
 package.json                              |   9 +-
 src/blackberry10/index.js                 |   3 +
 src/browser/FileProxy.js                  |  48 +++-
 src/firefoxos/FileProxy.js                |  52 +++--
 src/windows/FileProxy.js                  |  39 ++--
 tests/tests.js                            | 292 +++++++++++++------------
 www/Entry.js                              |  14 +-
 www/FileEntry.js                          |   8 +-
 www/FileReader.js                         |   5 +-
 www/FileSystem.js                         |   2 +-
 www/blackberry10/.jshintrc                |   5 +
 www/blackberry10/FileSystem.js            |   1 +
 www/blackberry10/copyTo.js                | 156 ++++++-------
 www/blackberry10/readEntries.js           |   1 -
 www/blackberry10/requestAllFileSystems.js |   2 +-
 www/blackberry10/truncate.js              |   2 +-
 www/blackberry10/write.js                 |   2 +-
 www/browser/Preparing.js                  |   8 +-
 www/fileSystems-roots.js                  |  19 +-
 www/requestFileSystem.js                  |   5 +-
 www/resolveLocalFileSystemURI.js          |   4 +-
 www/ubuntu/FileWriter.js                  |   8 +-
 www/ubuntu/fileSystems-roots.js           |   2 +-
 27 files changed, 428 insertions(+), 296 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 9752a6f..0699492 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ Thumbs.db
 *.user
 
 /.project
+node_modules

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..177bbf9
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,30 @@
+{
+    "browser": true
+  , "devel": true
+  , "bitwise": true
+  , "undef": true
+  , "trailing": true
+  , "quotmark": false
+  , "indent": 4
+  , "unused": "vars"
+  , "latedef": "nofunc"
+  , "globals": {
+        "module": false,
+        "exports": false,
+        "require": false,
+        "cordova": false,
+        "File": true,
+        "FileSystem": true,
+        "FileReader": true,
+        "FileWriter": true,
+        "FileError": true,
+        "LocalFileSystem": true,
+        "Metadata": true,
+        "Flags": true,
+        "DirectoryEntry": true,
+        "resolveLocalFileSystemURL": false,
+        "requestFileSystem": true,
+        "FILESYSTEM_PREFIX": true,
+        "FILESYSTEM_PROTOCOL": true
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..b9af4c5
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,4 @@
+language: node_js
+sudo: false
+node_js:
+  - "4.2"

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 04ac64d..97085be 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,8 @@
 #         under the License.
 -->
 
+[![Build Status](https://travis-ci.org/apache/cordova-plugin-file.svg?branch=master)](https://travis-ci.org/apache/cordova-plugin-file)
+
 # cordova-plugin-file
 
 This plugin implements a File API allowing read/write access to files residing on the device.

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 2d48d89..5f98d0a 100644
--- a/package.json
+++ b/package.json
@@ -38,6 +38,13 @@
     "cordova-windows",
     "cordova-firefoxos"
   ],
+  "scripts": {
+    "test": "npm run jshint",
+    "jshint": "node node_modules/jshint/bin/jshint www && node node_modules/jshint/bin/jshint src && node node_modules/jshint/bin/jshint tests"
+  },
   "author": "Apache Software Foundation",
-  "license": "Apache-2.0"
+  "license": "Apache-2.0",
+  "devDependencies": {
+    "jshint": "^2.6.0"
+  }
 }

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/src/blackberry10/index.js
----------------------------------------------------------------------
diff --git a/src/blackberry10/index.js b/src/blackberry10/index.js
index 913ab30..e995986 100644
--- a/src/blackberry10/index.js
+++ b/src/blackberry10/index.js
@@ -18,6 +18,9 @@
  * under the License.
  *
 */
+
+/* global PluginResult */
+
 module.exports = {
     setSandbox : function (success, fail, args, env) {
         require("lib/webview").setSandbox(JSON.parse(decodeURIComponent(args[0])));

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/src/browser/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/browser/FileProxy.js b/src/browser/FileProxy.js
index 6d5938d..2d937f4 100644
--- a/src/browser/FileProxy.js
+++ b/src/browser/FileProxy.js
@@ -88,7 +88,9 @@
             var size = args[1]; // jshint ignore: line
 
             if (type !== LocalFileSystem.TEMPORARY && type !== LocalFileSystem.PERSISTENT) {
-                errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                }
                 return;
             }
 
@@ -236,7 +238,9 @@
                 isBinary = args[3]; // jshint ignore: line
 
             if (!data) {
-                errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                }
                 return;
             }
 
@@ -520,14 +524,18 @@
             }
 
             if (path.trim()[0] === '/') {
-                errorCallback && errorCallback(FileError.ENCODING_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.ENCODING_ERR);
+                }
                 return;
             }
 
             //support for cdvfile
             if (path.trim().substr(0,7) === "cdvfile") {
                 if (path.indexOf("cdvfile://localhost") === -1) {
-                    errorCallback && errorCallback(FileError.ENCODING_ERR);
+                    if (errorCallback) {
+                        errorCallback(FileError.ENCODING_ERR);
+                    }
                     return;
                 }
 
@@ -540,7 +548,9 @@
                 } else if (indexTemporary !== -1) {
                     path = "file:///temporary" + path.substr(indexTemporary + 9);
                 } else {
-                    errorCallback && errorCallback(FileError.ENCODING_ERR);
+                    if (errorCallback) {
+                        errorCallback(FileError.ENCODING_ERR);
+                    }
                     return;
                 }
             }
@@ -600,12 +610,16 @@
                 };
 
                 xhr.onerror = function () {
-                    errorCallback && errorCallback(FileError.NOT_READABLE_ERR);
+                    if(errorCallback) {
+                        errorCallback(FileError.NOT_READABLE_ERR);
+                    }
                 };
 
                 xhr.send();
             } else {
-                errorCallback && errorCallback(FileError.NOT_FOUND_ERR);
+                if(errorCallback) {
+                    errorCallback(FileError.NOT_FOUND_ERR);
+                }
             }
 
             function writeFile(entry) {
@@ -617,7 +631,9 @@
                         }
                     };
                     fileWriter.onerror = function () {
-                        errorCallback && errorCallback(FileError.NOT_READABLE_ERR);
+                        if (errorCallback) {
+                            errorCallback(FileError.NOT_READABLE_ERR);
+                        }
                     };
                     fileWriter.write(new Blob([xhr.response]));
                 }, errorCallback);
@@ -819,7 +835,9 @@
 
         idb_.get = function(fullPath, successCallback, errorCallback) {
             if (!this.db) {
-                errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                }
                 return;
             }
 
@@ -835,7 +853,9 @@
 
         idb_.getAllEntries = function(fullPath, storagePath, successCallback, errorCallback) {
             if (!this.db) {
-                errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                }
                 return;
             }
 
@@ -896,7 +916,9 @@
 
         idb_['delete'] = function(fullPath, successCallback, errorCallback, isDirectory) {
             if (!idb_.db) {
-                errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                }
                 return;
             }
 
@@ -926,7 +948,9 @@
 
         idb_.put = function(entry, storagePath, successCallback, errorCallback) {
             if (!this.db) {
-                errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.INVALID_MODIFICATION_ERR);
+                }
                 return;
             }
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/src/firefoxos/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/firefoxos/FileProxy.js b/src/firefoxos/FileProxy.js
index 3662edc..946304b 100644
--- a/src/firefoxos/FileProxy.js
+++ b/src/firefoxos/FileProxy.js
@@ -19,6 +19,8 @@
  *
  */
 
+/* global IDBKeyRange */
+
 var LocalFileSystem = require('./LocalFileSystem'),
     FileSystem = require('./FileSystem'),
     FileEntry = require('./FileEntry'),
@@ -67,10 +69,12 @@ QUIRKS:
 
     exports.requestFileSystem = function(successCallback, errorCallback, args) {
         var type = args[0];
-        var size = args[1];
+        //var size = args[1];
 
         if (type !== LocalFileSystem.TEMPORARY && type !== LocalFileSystem.PERSISTENT) {
-            errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            }
             return;
         }
 
@@ -206,11 +210,13 @@ QUIRKS:
     exports.write = function(successCallback, errorCallback, args) {
         var fileName = args[0],
             data = args[1],
-            position = args[2],
-            isBinary = args[3];
+            position = args[2];
+            //isBinary = args[3];
 
         if (!data) {
-            errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            }
             return;
         }
 
@@ -393,8 +399,8 @@ QUIRKS:
 
     exports.moveTo = function(successCallback, errorCallback, args) {
         var srcPath = args[0];
-        var parentFullPath = args[1];
-        var name = args[2];
+        //var parentFullPath = args[1];
+        //var name = args[2];
 
         exports.copyTo(function (fileEntry) {
 
@@ -449,12 +455,16 @@ QUIRKS:
             };
 
             xhr.onerror = function () {
-                errorCallback && errorCallback(FileError.NOT_READABLE_ERR);
+                if (errorCallback) {
+                    errorCallback(FileError.NOT_READABLE_ERR);
+                }
             };
 
             xhr.send();
         } else {
-            errorCallback && errorCallback(FileError.NOT_FOUND_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.NOT_FOUND_ERR);
+            }
         }
 
         function writeFile(entry) {
@@ -466,7 +476,9 @@ QUIRKS:
                     }
                 };
                 fileWriter.onerror = function () {
-                    errorCallback && errorCallback(FileError.NOT_READABLE_ERR);
+                    if (errorCallback) {
+                        errorCallback(FileError.NOT_READABLE_ERR);
+                    }
                 };
                 fileWriter.write(new Blob([xhr.response]));
             }, errorCallback);
@@ -640,7 +652,7 @@ QUIRKS:
             self.db.onerror = onError;
 
             if (!self.db.objectStoreNames.contains(FILE_STORE_)) {
-                var store = self.db.createObjectStore(FILE_STORE_/*,{keyPath: 'id', autoIncrement: true}*/);
+                self.db.createObjectStore(FILE_STORE_/*,{keyPath: 'id', autoIncrement: true}*/);
             }
         };
 
@@ -660,7 +672,9 @@ QUIRKS:
 
     idb_.get = function(fullPath, successCallback, errorCallback) {
         if (!this.db) {
-            errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            }
             return;
         }
 
@@ -679,7 +693,9 @@ QUIRKS:
 
     idb_.getAllEntries = function(fullPath, storagePath, successCallback, errorCallback) {
         if (!this.db) {
-            errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            }
             return;
         }
 
@@ -689,7 +705,7 @@ QUIRKS:
             storagePath = storagePath.substring(0, storagePath.length - 1);
         }
 
-        range = IDBKeyRange.bound(
+        var range = IDBKeyRange.bound(
                 storagePath + DIR_SEPARATOR, storagePath + DIR_OPEN_BOUND, false, true);
 
         var tx = this.db.transaction([FILE_STORE_], 'readonly');
@@ -730,7 +746,9 @@ QUIRKS:
 
     idb_['delete'] = function(fullPath, successCallback, errorCallback) {
         if (!this.db) {
-            errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            }
             return;
         }
 
@@ -746,7 +764,9 @@ QUIRKS:
 
     idb_.put = function(entry, storagePath, successCallback, errorCallback) {
         if (!this.db) {
-            errorCallback && errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            if (errorCallback) {
+                errorCallback(FileError.INVALID_MODIFICATION_ERR);
+            }
             return;
         }
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/src/windows/FileProxy.js
----------------------------------------------------------------------
diff --git a/src/windows/FileProxy.js b/src/windows/FileProxy.js
index 11604f5..79a7f41 100644
--- a/src/windows/FileProxy.js
+++ b/src/windows/FileProxy.js
@@ -19,7 +19,8 @@
  *
 */
 
-var cordova = require('cordova');
+/* global Windows, WinJS, MSApp */
+
 var File = require('./File'),
     FileError = require('./FileError'),
     Flags = require('./Flags'),
@@ -181,8 +182,6 @@ var AllFileSystems;
 
 function getAllFS() {
     if (!AllFileSystems) {
-        var storageFolderPermanent = Windows.Storage.ApplicationData.current.localFolder.path,
-            storageFolderTemporary = Windows.Storage.ApplicationData.current.temporaryFolder.path;
         AllFileSystems = {
             'persistent':
             Object.freeze(new WinFS('persistent', { 
@@ -352,23 +351,23 @@ function copyFolder(src,dst,name) {
                 }
                 var todo = the.files.length;
                 var copyfolders = function() {
-                    if (!todo--) {
+                    if (!(todo--)) {
                         complete();
                         return;
                     }
                     copyFolder(the.folders[todo],dst)
-                    .done(function() {copyfolders(); }, failed);
+                    .done(function() { copyfolders(); }, failed);
                 };
                 var copyfiles = function() {
-                    if (!todo--) {
+                    if (!(todo--)) {
                         todo = the.folders.length;
                         copyfolders();
                         return;
                     }
                     the.files[todo].copyAsync(the.fld)
-                    .done(function() {copyfiles(); }, failed);
+                    .done(function() { copyfiles(); }, failed);
                 };
-                copyfiles();                
+                copyfiles();
             },
             failed
         );
@@ -378,11 +377,10 @@ function copyFolder(src,dst,name) {
 function moveFolder(src,dst,name) {
     name = name?name:src.name;
     return new WinJS.Promise(function (complete,failed) {
-        var pending = [];
         WinJS.Promise.join({
-            fld:dst.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists),
-            files:src.getFilesAsync(),
-            folders:src.getFoldersAsync()
+            fld: dst.createFolderAsync(name, Windows.Storage.CreationCollisionOption.openIfExists),
+            files: src.getFilesAsync(),
+            folders: src.getFoldersAsync()
         }).done(
             function(the) {
                 if (!(the.files.length || the.folders.length)) {
@@ -391,7 +389,7 @@ function moveFolder(src,dst,name) {
                 }
                 var todo = the.files.length;
                 var movefolders = function() {
-                    if (!todo--) {
+                    if (!(todo--)) {
                         src.deleteAsync().done(complete,failed);
                         return;
                     }
@@ -399,15 +397,15 @@ function moveFolder(src,dst,name) {
                     .done(movefolders,failed); 
                 };
                 var movefiles = function() {
-                    if (!todo--) {
+                    if (!(todo--)) {
                         todo = the.folders.length;
                         movefolders();
                         return;
                     }
                     the.files[todo].moveAsync(the.fld)
-                    .done(function() {movefiles(); }, failed);
+                    .done(function() { movefiles(); }, failed);
                 };
-                movefiles();                
+                movefiles();
             },
             failed
         );
@@ -449,10 +447,9 @@ function transport(success, fail, args, ops) { // ["fullPath","parent", "newName
                 fail(FileError.NOT_FOUND_ERR);
                 return;
             }
-            if (   (the.src.folder && the.tgt.file) 
-                || (the.src.file && the.tgt.folder)
-                || (the.tgt.folder && (the.tgt.files.length || the.tgt.folders.length))) 
-            {
+            if ((the.src.folder && the.tgt.file) ||
+                (the.src.file && the.tgt.folder) ||
+                (the.tgt.folder && (the.tgt.files.length || the.tgt.folders.length))) {
                 fail(FileError.INVALID_MODIFICATION_ERR);
                 return;
             }
@@ -1094,7 +1091,6 @@ module.exports = {
                 if (Number(size) >= 0) {
                     Windows.Storage.FileIO.readTextAsync(storageFile, Windows.Storage.Streams.UnicodeEncoding.utf8).then(function (fileContent) {
                         fileContent = fileContent.substr(0, size);
-                        var fullPath = storageFile.path;
                         var name = storageFile.name;
                         storageFile.deleteAsync().then(function () {
                             return getFolderFromPathAsync(dirwpath);
@@ -1170,7 +1166,6 @@ module.exports = {
     resolveLocalFileSystemURI: function (success, fail, args) {
 
         var uri = args[0];
-        var inputURL;
 
         var path = pathFromURL(uri);
         var fs = getFilesystemFromURL(uri);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/tests/tests.js
----------------------------------------------------------------------
diff --git a/tests/tests.js b/tests/tests.js
index c4c9012..29279de 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -18,9 +18,8 @@
  *
  */
 
-/*global cordova, exports*/
-/*jshint jasmine: true*/
-/*global FileError, LocalFileSystem, Metadata, Flags*/
+/* jshint jasmine: true */
+/* global WebKitBlobBuilder */
 
 exports.defineAutoTests = function () {
     var isBrowser = (cordova.platformId === "browser");
@@ -172,12 +171,12 @@ exports.defineAutoTests = function () {
                 }, success, error);
             }, error);
         };
-        var failed = function (done, msg, error) {
+        function failed(done, msg, error) {
             var info = typeof msg == 'undefined' ? 'Unexpected error callback' : msg;
             var codeMsg = (error && error.code) ? (': ' + fileErrorMap[error.code]) : '';
             expect(true).toFailWithMessage(info + '\n' + JSON.stringify(error) + codeMsg);
             done();
-        };
+        }
         var succeed = function (done, msg) {
             var info = typeof msg == 'undefined' ? 'Unexpected success callback' : msg;
             expect(true).toFailWithMessage(info);
@@ -221,8 +220,11 @@ exports.defineAutoTests = function () {
                     var win = function (fileSystem) {
                         expect(fileSystem).toBeDefined();
                         expect(fileSystem.name).toBeDefined();
-                        isChrome ? expect(fileSystem.name).toContain("Persistent")
-                            : expect(fileSystem.name).toBe("persistent");
+                        if (isChrome) {
+                            expect(fileSystem.name).toContain("Persistent");
+                        } else {
+                            expect(fileSystem.name).toBe("persistent");
+                        }
                         expect(fileSystem.root).toBeDefined();
                         expect(fileSystem.root.filesystem).toBeDefined();
                         // Shouldn't use cdvfile by default.
@@ -241,8 +243,11 @@ exports.defineAutoTests = function () {
                 it("file.spec.5 should be able to retrieve a TEMPORARY file system", function (done) {
                     var win = function (fileSystem) {
                         expect(fileSystem).toBeDefined();
-                        isChrome ? expect(fileSystem.name).toContain("Temporary")
-                            : expect(fileSystem.name).toBe("temporary");
+                        if (isChrome) { 
+                            expect(fileSystem.name).toContain("Temporary");
+                        } else {
+                            expect(fileSystem.name).toBe("temporary");
+                        }
                         expect(fileSystem.root).toBeDefined();
                         expect(fileSystem.root.filesystem).toBeDefined();
                         expect(fileSystem.root.filesystem).toBe(fileSystem);
@@ -339,8 +344,8 @@ exports.defineAutoTests = function () {
                     }, failed.bind(null, done, 'createFile - Error creating file: ' + fileName));
                 });
                 it("file.spec.11 should error (NOT_FOUND_ERR) when resolving (non-existent) invalid file name", function (done) {
-                    var fileName = cordova.platformId === 'windowsphone' ? root.toURL() + "/" + "this.is.not.a.valid.file.txt" : joinURL(root.toURL(), "this.is.not.a.valid.file.txt");
-                    fail = function (error) {
+                    var fileName = cordova.platformId === 'windowsphone' ? root.toURL() + "/" + "this.is.not.a.valid.file.txt" : joinURL(root.toURL(), "this.is.not.a.valid.file.txt"),
+                        fail = function (error) {
                         expect(error).toBeDefined();
                         expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
                         done();
@@ -350,7 +355,7 @@ exports.defineAutoTests = function () {
                 });
                 it("file.spec.12 should error (ENCODING_ERR) when resolving invalid URI with leading /", function (done) {
                     var fileName = "/this.is.not.a.valid.url",
-                    fail = function (error) {
+                        fail = function (error) {
                         expect(error).toBeDefined();
                         expect(error).toBeFileError(FileError.ENCODING_ERR);
                         done();
@@ -404,7 +409,6 @@ exports.defineAutoTests = function () {
         describe('DirectoryEntry', function () {
             it("file.spec.16 getFile: get Entry for file that does not exist", function (done) {
                 var fileName = "de.no.file",
-                filePath = joinURL(root.fullPath, fileName),
                 fail = function (error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
@@ -452,14 +456,9 @@ exports.defineAutoTests = function () {
             });
             it("file.spec.19 getFile: create file that already exists", function (done) {
                 var fileName = "de.create.existing.file",
-                filePath = joinURL(root.fullPath, fileName),
-                getFile = function (file) {
-                    // create:true, exclusive:false, file exists
-                    root.getFile(fileName, {
-                        create : true
-                    }, win, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
-                },
-                win = function (entry) {
+                filePath = joinURL(root.fullPath, fileName);
+
+                function win(entry) {
                     expect(entry).toBeDefined();
                     expect(entry.isFile).toBe(true);
                     expect(entry.isDirectory).toBe(false);
@@ -467,26 +466,25 @@ exports.defineAutoTests = function () {
                     expect(entry.fullPath).toCanonicallyMatch(filePath);
                     // cleanup
                     deleteEntry(entry.name, done);
-                };
+                }
+
+                function getFile(file) {
+                    // create:true, exclusive:false, file exists
+                    root.getFile(fileName, {
+                        create : true
+                    }, win, failed.bind(null, done, 'root.getFile - Error creating file: ' + fileName));
+                }
+
                 // create file to kick off it
                 root.getFile(fileName, {
                     create : true
                 }, getFile, failed.bind(null, done, 'root.getFile - Error on initial creating file: ' + fileName));
             });
             it("file.spec.20 getFile: create file that already exists (exclusive)", function (done) {
-
                 var fileName = "de.create.exclusive.existing.file",
-                filePath = joinURL(root.fullPath, fileName),
-                existingFile,
-                getFile = function (file) {
-                    existingFile = file;
-                    // create:true, exclusive:true, file exists
-                    root.getFile(fileName, {
-                        create : true,
-                        exclusive : true
-                    }, succeed.bind(null, done, 'root.getFile - getFile function - Error unexpected callback, file should exists: ' + fileName), fail);
-                },
-                fail = function (error) {
+                existingFile;
+
+                function fail(error) {
                     expect(error).toBeDefined();
                     if (isChrome) {
                         /*INVALID_MODIFICATION_ERR (code: 9) is thrown instead of PATH_EXISTS_ERR(code: 12)
@@ -497,7 +495,17 @@ exports.defineAutoTests = function () {
                     }
                     // cleanup
                     deleteEntry(existingFile.name, done);
-                };
+                }
+
+                function getFile(file) {
+                    existingFile = file;
+                    // create:true, exclusive:true, file exists
+                    root.getFile(fileName, {
+                        create : true,
+                        exclusive : true
+                    }, succeed.bind(null, done, 'root.getFile - getFile function - Error unexpected callback, file should exists: ' + fileName), fail);
+                }
+
                 // create file to kick off it
                 root.getFile(fileName, {
                     create : true
@@ -549,7 +557,6 @@ exports.defineAutoTests = function () {
             });
             it("file.spec.23 DirectoryEntry.getDirectory: get Entry for directory that does not exist", function (done) {
                 var dirName = "de.no.dir",
-                dirPath = joinURL(root.fullPath, dirName),
                 fail = function (error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
@@ -561,16 +568,9 @@ exports.defineAutoTests = function () {
                 }, succeed.bind(null, done, 'root.getDirectory - Error unexpected callback, directory should not exists: ' + dirName), fail);
             });
             it("file.spec.24 DirectoryEntry.getDirectory: create new dir with space then resolveLocalFileSystemURL", function (done) {
-                var dirName = "de create dir",
-                dirPath = joinURL(root.fullPath, encodeURIComponent(dirName)),
-                getDir = function (dirEntry) {
-                    expect(dirEntry.filesystem).toBeDefined();
-                    expect(dirEntry.filesystem).toBe(root.filesystem);
-                    var dirURI = dirEntry.toURL();
-                    // now encode URI and try to resolve
-                    window.resolveLocalFileSystemURL(dirURI, win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - getDir function - Error resolving directory: ' + dirURI));
-                },
-                win = function (directory) {
+                var dirName = "de create dir";
+
+                function win(directory) {
                     expect(directory).toBeDefined();
                     expect(directory.isFile).toBe(false);
                     expect(directory.isDirectory).toBe(true);
@@ -578,7 +578,16 @@ exports.defineAutoTests = function () {
                     expect(directory.fullPath).toCanonicallyMatch(joinURL(root.fullPath, dirName));
                     // cleanup
                     deleteEntry(directory.name, done);
-                };
+                }
+
+                function getDir(dirEntry) {
+                    expect(dirEntry.filesystem).toBeDefined();
+                    expect(dirEntry.filesystem).toBe(root.filesystem);
+                    var dirURI = dirEntry.toURL();
+                    // now encode URI and try to resolve
+                    window.resolveLocalFileSystemURL(dirURI, win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - getDir function - Error resolving directory: ' + dirURI));
+                }
+
                 // create:true, exclusive:false, directory does not exist
                 root.getDirectory(dirName, {
                     create : true
@@ -592,13 +601,9 @@ exports.defineAutoTests = function () {
             // backend.
             xit("file.spec.25 DirectoryEntry.getDirectory: create new dir with space resolveLocalFileSystemURL with encoded URI", function (done) {
                 var dirName = "de create dir2",
-                dirPath = joinURL(root.fullPath, dirName),
-                getDir = function (dirEntry) {
-                    var dirURI = dirEntry.toURL();
-                    // now encode URI and try to resolve
-                    window.resolveLocalFileSystemURL(encodeURI(dirURI), win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - getDir function - Error resolving directory: ' + dirURI));
-                },
-                win = function (directory) {
+                dirPath = joinURL(root.fullPath, dirName);
+
+                function win(directory) {
                     expect(directory).toBeDefined();
                     expect(directory.isFile).toBe(false);
                     expect(directory.isDirectory).toBe(true);
@@ -606,7 +611,14 @@ exports.defineAutoTests = function () {
                     expect(directory.fullPath).toCanonicallyMatch(dirPath);
                     // cleanup
                     deleteEntry(directory.name, done);
-                };
+                }
+
+                function getDir(dirEntry) {
+                    var dirURI = dirEntry.toURL();
+                    // now encode URI and try to resolve
+                    window.resolveLocalFileSystemURL(encodeURI(dirURI), win, failed.bind(null, done, 'window.resolveLocalFileSystemURL - getDir function - Error resolving directory: ' + dirURI));
+                }
+
                 // create:true, exclusive:false, directory does not exist
                 root.getDirectory(dirName, {
                     create : true
@@ -675,7 +687,6 @@ exports.defineAutoTests = function () {
             it("file.spec.29 DirectoryEntry.getDirectory: create directory that already exists (exclusive)", function (done) {
 
                 var dirName = "de.create.exclusive.existing.dir",
-                dirPath = joinURL(root.fullPath, dirName),
                 existingDir,
                 fail = function (error) {
                     expect(error).toBeDefined();
@@ -743,7 +754,6 @@ exports.defineAutoTests = function () {
             it("file.spec.32 DirectoryEntry.getDirectory: get DirectoryEntry for existing file", function (done) {
                 var fileName = "de.existing.file",
                 existingFile,
-                filePath = joinURL(root.fullPath, fileName),
                 fail = function (error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR);
@@ -763,7 +773,6 @@ exports.defineAutoTests = function () {
             it("file.spec.33 DirectoryEntry.getFile: get FileEntry for existing directory", function (done) {
                 var dirName = "de.existing.dir",
                 existingDir,
-                dirPath = joinURL(root.fullPath, dirName),
                 fail = function (error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.TYPE_MISMATCH_ERR);
@@ -783,8 +792,6 @@ exports.defineAutoTests = function () {
             it("file.spec.34 DirectoryEntry.removeRecursively on directory", function (done) {
                 var dirName = "de.removeRecursively",
                 subDirName = "dir",
-                dirPath = joinURL(root.fullPath, dirName),
-                subDirPath = joinURL(dirPath, subDirName),
                 dirExists = function (error) {
                     expect(error).toBeDefined();
                     expect(error).toBeFileError(FileError.NOT_FOUND_ERR);
@@ -899,8 +906,7 @@ exports.defineAutoTests = function () {
                 });
             });
             it("file.spec.38 should read contents of directory that has been removed", function (done) {
-                var dirName = "de.createReader.notfound",
-                dirPath = joinURL(root.fullPath, dirName);
+                var dirName = "de.createReader.notfound";
                 // create a new directory entry to kick off it
                 root.getDirectory(dirName, {
                     create : true
@@ -1560,7 +1566,6 @@ exports.defineAutoTests = function () {
                 var file1 = "file1",
                 srcDir = "entry.move.dsp.srcDir",
                 dstDir = "entry.move.dsp.dstDir",
-                srcPath = joinURL(root.fullPath, srcDir),
                 dstPath = joinURL(root.fullPath, dstDir),
                 filePath = joinURL(dstPath, file1);
                 // ensure destination directory is cleaned up before it
@@ -1610,7 +1615,6 @@ exports.defineAutoTests = function () {
                 var file1 = "file1",
                 srcDir = "entry.move.dsp.srcDir",
                 dstDir = "entry.move.dsp.srcDir-backup",
-                srcPath = joinURL(root.fullPath, srcDir),
                 dstPath = joinURL(root.fullPath, dstDir),
                 filePath = joinURL(dstPath, file1);
                 // ensure destination directory is cleaned up before it
@@ -1660,7 +1664,6 @@ exports.defineAutoTests = function () {
                 var file1 = "file1",
                 srcDir = "entry.move.dnp.srcDir",
                 dstDir = "entry.move.dnp.dstDir",
-                srcPath = joinURL(root.fullPath, srcDir),
                 dstPath = joinURL(root.fullPath, dstDir),
                 filePath = joinURL(dstPath, file1);
                 // ensure destination directory is cleaned up before it
@@ -1775,8 +1778,7 @@ exports.defineAutoTests = function () {
                 }
 
                 var srcDir = "entry.move.dis.srcDir",
-                dstDir = "entry.move.dis.srcDir-backup",
-                srcPath = joinURL(root.fullPath, srcDir);
+                dstDir = "entry.move.dis.srcDir-backup";
                 // create a new directory entry to kick off it
                 createDirectory(srcDir, function (srcDirEntry) {
                 deleteEntry(dstDir, function () {
@@ -1998,7 +2000,6 @@ exports.defineAutoTests = function () {
             it("file.spec.77 moveTo: file replace existing file", function (done) {
                 var file1 = "entry.move.frf.file1",
                 file2 = "entry.move.frf.file2",
-                file1Path = joinURL(root.fullPath, file1),
                 file2Path = joinURL(root.fullPath, file2);
                 // create a new directory entry to kick off it
                 createFile(file1, function (entry) {
@@ -2044,7 +2045,6 @@ exports.defineAutoTests = function () {
                 var file1 = "file1",
                 srcDir = "entry.move.drd.srcDir",
                 dstDir = "entry.move.drd.dstDir",
-                srcPath = joinURL(root.fullPath, srcDir),
                 dstPath = joinURL(root.fullPath, dstDir),
                 filePath = dstPath + '/' + file1;
                 // ensure destination directory is cleaned up before it
@@ -2098,7 +2098,7 @@ exports.defineAutoTests = function () {
                 // create a new file entry to kick off it
                 createFile(file1, function (entry) {
                     // move file to directory that does not exist
-                    directory = new DirectoryEntry();
+                    var directory = new DirectoryEntry();
                     directory.filesystem = root.filesystem;
                     directory.fullPath = dstPath;
                     entry.moveTo(directory, null, succeed.bind(null, done, 'entry.moveTo - Unexpected success callback, parent directory: ' + dstPath + ' should not exists'), function (error) {
@@ -2219,19 +2219,23 @@ exports.defineAutoTests = function () {
                 fileData = fileContents !== undefined ? fileContents :
                     '\u20AC\xEB - There is an exception to every rule. Except this one.',
                 fileDataAsBinaryString = fileContents !== undefined ? fileContents :
-                    '\xe2\x82\xac\xc3\xab - There is an exception to every rule. Except this one.',
-                createWriter = function (fe) {
+                    '\xe2\x82\xac\xc3\xab - There is an exception to every rule. Except this one.';
+
+                function createWriter(fe) {
                     fileEntry = fe;
                     fileEntry.createWriter(writeFile, failed.bind(null, done, 'fileEntry.createWriter - Error reading file: ' + fileName));
-                }, // writes file and reads it back in
-                writeFile = function (writer) {
+                }
+
+                // writes file and reads it back in
+                function writeFile(writer) {
                     writer.onwriteend = function () {
                         fileEntry.file(function (f) {
                             callback(fileEntry, f, fileData, fileDataAsBinaryString);
                         }, failed.bind(null, done, 'writer.onwriteend - Error writing data on file: ' + fileName));
                     };
                     writer.write(fileData);
-                };
+                }
+
                 fileData += writeBinary ? 'bin:\x01\x00' : '';
                 fileDataAsBinaryString += writeBinary ? 'bin:\x01\x00' : '';
                 // create a file, write to it, and read it in again
@@ -2414,7 +2418,7 @@ exports.defineAutoTests = function () {
                     // writes initial file content
                     fileEntry.createWriter(function (writer) {
                         //Verifiers declaration
-                        var verifier = function (evt) {
+                        function verifier(evt) {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             // Append some more data
@@ -2422,20 +2426,21 @@ exports.defineAutoTests = function () {
                             length += exception.length;
                             writer.seek(writer.length);
                             writer.write(exception);
-                        },
-                        secondVerifier = function (evt) {
+                        }
+                        function secondVerifier(evt) {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             var reader = new FileReader();
                             reader.onloadend = thirdVerifier;
                             reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
                             fileEntry.file(function(f){reader.readAsText(f);});
-                        },
-                        thirdVerifier = function (evt) {
+                        }
+                        function thirdVerifier(evt) {
                             expect(evt.target.result).toBe(content+exception);
                             // cleanup
                             deleteFile(fileName, done);
-                        };
+                        }
+
                         //Write process
                         writer.onwriteend = verifier;
                         writer.write(content);
@@ -2452,7 +2457,7 @@ exports.defineAutoTests = function () {
                 }, function (fileEntry) {
                     fileEntry.createWriter(function (writer) {
                         //Verifiers declaration
-                        var verifier = function () {
+                        function verifier() {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             // Append some more data
@@ -2460,20 +2465,21 @@ exports.defineAutoTests = function () {
                             length += exception.length;
                             writer.seek(writer.length);
                             writer.write(exception);
-                        },
-                        secondVerifier = function () {
+                        }
+                        function secondVerifier() {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             var reader = new FileReader();
                             reader.onloadend = thirdVerifier;
                             reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
                             fileEntry.file(function(f){reader.readAsText(f);});
-                        },
-                        thirdVerifier = function (evt) {
+                        }
+                        function thirdVerifier(evt) {
                             expect(evt.target.result).toBe(content+exception);
                             // cleanup
                             deleteFile(fileName, done);
-                        };
+                        }
+
                         //Write process
                         writer.onwriteend = verifier;
                         writer.write(content);
@@ -2489,7 +2495,7 @@ exports.defineAutoTests = function () {
                 createFile(fileName, function (fileEntry) {
                     fileEntry.createWriter(function (writer) {
                         //Verifiers declaration
-                        var verifier = function (evt) {
+                        function verifier(evt) {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             // Append some more data
@@ -2497,20 +2503,21 @@ exports.defineAutoTests = function () {
                             length = 12 + exception.length;
                             writer.seek(12);
                             writer.write(exception);
-                        },
-                        secondVerifier = function (evt) {
+                        }
+                        function secondVerifier(evt) {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             var reader = new FileReader();
                             reader.onloadend = thirdVerifier;
                             reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
                             fileEntry.file(function(f){reader.readAsText(f);});
-                        },
-                        thirdVerifier = function (evt) {
+                        }
+                        function thirdVerifier(evt) {
                             expect(evt.target.result).toBe(content.substr(0,12)+exception);
                             // cleanup
                             deleteFile(fileName, done);
-                        };
+                        }
+
                         //Write process
                         writer.onwriteend = verifier;
                         writer.write(content);
@@ -2532,7 +2539,7 @@ exports.defineAutoTests = function () {
                 createFile(fileName, function (fileEntry) {
                     fileEntry.createWriter(function (writer) {
                         // Verifiers declaration
-                        var verifier = function (evt) {
+                        function verifier(evt) {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             // Append some more data
@@ -2540,20 +2547,21 @@ exports.defineAutoTests = function () {
                             length = 8 + exception.length;
                             writer.seek(8);
                             writer.write(exception);
-                        },
-                        secondVerifier = function (evt) {
+                        }
+                        function secondVerifier(evt) {
                             expect(writer.length).toBe(length);
                             expect(writer.position).toBe(length);
                             var reader = new FileReader();
                             reader.onloadend = thirdVerifier;
                             reader.onerror = failed.bind(null, done, 'reader.onerror - Error reading file: ' + fileName);
                             fileEntry.file(function(f){reader.readAsText(f);});
-                        },
-                        thirdVerifier = function (evt) {
+                        }
+                        function thirdVerifier(evt) {
                             expect(evt.target.result).toBe(content.substr(0,8)+exception);
                             // cleanup
                             deleteFile(fileName, done);
-                        };
+                        }
+
                         //Write process
                         writer.onwriteend = verifier;
                         writer.write(content);
@@ -2667,7 +2675,7 @@ exports.defineAutoTests = function () {
                 data = new ArrayBuffer(32),
                 dataView = new Int8Array(data), // for verifying file length
                 length = 32;
-                for (i = 0; i < dataView.length; i++) {
+                for (var i = 0; i < dataView.length; i++) {
                     dataView[i] = i;
                 }
                 // creates file, then write content
@@ -2699,7 +2707,7 @@ exports.defineAutoTests = function () {
                 dataView = new Int8Array(data),
                 blob, // for verifying file length
                 length = 32;
-                for (i = 0; i < dataView.length; i++) {
+                for (var i = 0; i < dataView.length; i++) {
                     dataView[i] = i;
                 }
                 try {
@@ -2747,9 +2755,8 @@ exports.defineAutoTests = function () {
                 },
                 writeFile = function (fileName, fileData, win) {
                     var theWriter,
-                    filePath = joinURL(root.fullPath, fileName), // writes file content to new file
                     write_file = function (fileEntry) {
-                        writerEntry = fileEntry;
+                        // writes file content to new file
                         fileEntry.createWriter(function (writer) {
                             theWriter = writer;
                             writer.onwriteend = function (ev) {
@@ -2789,9 +2796,8 @@ exports.defineAutoTests = function () {
                 },
                 writeFile = function (fileName, fileData, win) {
                     var theWriter,
-                    filePath = joinURL(root.fullPath, fileName), // writes file content to new file
                     write_file = function (fileEntry) {
-                        writerEntry = fileEntry;
+                        // writes file content to new file
                         fileEntry.createWriter(function (writer) {
                             theWriter = writer;
                             writer.onwriteend = function (ev) {
@@ -2841,9 +2847,8 @@ exports.defineAutoTests = function () {
                 },
                 writeFile = function (fileName, fileData, win) {
                     var theWriter,
-                    filePath = joinURL(root.fullPath, fileName), // writes file content to new file
                     write_file = function (fileEntry) {
-                        writerEntry = fileEntry;
+                        // writes file content to new file
                         fileEntry.createWriter(function (writer) {
                             theWriter = writer;
                             writer.onwriteend = function (ev) {
@@ -2866,7 +2871,7 @@ exports.defineAutoTests = function () {
                         fileEntry.file(callback, failed.bind(null, done, 'fileEntry.file - Error reading file using fileEntry: ' + fileEntry.name));
                     }, failed.bind(null, done, 'root.getFile - Error getting file: ' + fileName));
                 };
-                for (i = 0; i < dataView.length; i++) {
+                for (var i = 0; i < dataView.length; i++) {
                     dataView[i] = i;
                 }
                 try {
@@ -3020,9 +3025,6 @@ exports.defineAutoTests = function () {
                     expect(entry.name).toCanonicallyMatch(fileName);
                     expect(typeof entry.toNativeURL).toBe('function');
                     var nativeURL = entry.toNativeURL();
-                    var indexOfRoot = isWindows ? nativeURL.indexOf(":") :
-                                      isChrome ? 'filesystem:file://'.length : // Chrome uses own prefix for all filesystem urls
-                                      7; //default value - length of 'file://' string
                     expect(typeof nativeURL).toBe("string");
                     expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect);
                     expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName);
@@ -3033,6 +3035,7 @@ exports.defineAutoTests = function () {
             it("file.spec.115 DirectoryReader should return entries with toNativeURL method", function (done) {
                 var dirName = 'nativeEntries.dir',
                 fileName = 'nativeEntries.file',
+                directory,
                 checkEntries = function (entries) {
                     expect(entries).toBeDefined();
                     expect(entries instanceof Array).toBe(true);
@@ -3040,9 +3043,6 @@ exports.defineAutoTests = function () {
                     expect(entries[0].toNativeURL).toBeDefined();
                     expect(typeof entries[0].toNativeURL).toBe('function');
                     var nativeURL = entries[0].toNativeURL();
-                    var indexOfRoot = isWindows ? nativeURL.indexOf(":") :
-                                      isChrome ? 'filesystem:file://'.length : // Chrome uses own prefix for all filesystem urls
-                                      7; //default value - length of 'file://' string
                     expect(typeof nativeURL).toBe("string");
                     expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect);
                     expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName);
@@ -3053,7 +3053,8 @@ exports.defineAutoTests = function () {
                 // create a new file entry
                 root.getDirectory(dirName, {
                     create : true
-                }, function (directory) {
+                }, function (dir) {
+                    directory = dir;
                     directory.getFile(fileName, {
                         create : true
                     }, function (fileEntry) {
@@ -3071,9 +3072,6 @@ exports.defineAutoTests = function () {
                         expect(entry.name).toCanonicallyMatch(fileName);
                         expect(typeof entry.toNativeURL).toBe('function');
                         var nativeURL = entry.toNativeURL();
-                        var indexOfRoot = isWindows ? nativeURL.indexOf(":") :
-                                      isChrome ? 'filesystem:file://'.length : // Chrome uses own prefix for all filesystem urls
-                                      7; //default value - length of 'file://' string
                         expect(typeof nativeURL).toBe("string");
                         expect(nativeURL.substring(0, pathExpect.length)).toEqual(pathExpect);
                         expect(nativeURL.substring(nativeURL.length - fileName.length)).toEqual(fileName);
@@ -3184,8 +3182,11 @@ exports.defineAutoTests = function () {
                     expect(entry.name).toCanonicallyMatch(file2);
                     expect(entry.fullPath).toCanonicallyMatch(fullPath);
                     expect(entry.filesystem).toBeDefined();
-                    isChrome ? expect(entry.filesystem.name).toContain("Persistent")
-                        : expect(entry.filesystem.name).toEqual("persistent");
+                    if (isChrome) {
+                        expect(entry.filesystem.name).toContain("Persistent");
+                    } else {
+                        expect(entry.filesystem.name).toEqual("persistent");
+                    }
                     // cleanup
                     deleteEntry(entry.name);
                     deleteEntry(sourceEntry.name, done);
@@ -3195,8 +3196,11 @@ exports.defineAutoTests = function () {
                         create : true
                     }, function (entry) {
                         expect(entry.filesystem).toBeDefined();
-                        isChrome ? expect(entry.filesystem.name).toContain("Temporary")
-                            : expect(entry.filesystem.name).toEqual("temporary");
+                        if (isChrome) {
+                            expect(entry.filesystem.name).toContain("Temporary");
+                        } else {
+                            expect(entry.filesystem.name).toEqual("temporary");
+                        }
                         sourceEntry = entry;
                         // Save for later cleanup
                         entry.copyTo(persistent_root, file2, validateFile, failed.bind(null, done, 'entry.copyTo - Error copying file: ' + file1 + ' to PERSISTENT root as: ' + file2));
@@ -3218,8 +3222,11 @@ exports.defineAutoTests = function () {
                     expect(entry.isDirectory).toBe(false);
                     expect(entry.name).toCanonicallyMatch(file2);
                     expect(entry.fullPath).toCanonicallyMatch(fullPath);
-                    isChrome ? expect(entry.filesystem.name).toContain("Temporary")
-                        : expect(entry.filesystem.name).toEqual("temporary");
+                    if (isChrome) {
+                        expect(entry.filesystem.name).toContain("Temporary");
+                    } else {
+                        expect(entry.filesystem.name).toEqual("temporary");
+                    }
                     // cleanup
                     deleteEntry(entry.name);
                     deleteEntry(sourceEntry.name, done);
@@ -3230,8 +3237,11 @@ exports.defineAutoTests = function () {
                     }, function (entry) {
                         expect(entry).toBeDefined();
                         expect(entry.filesystem).toBeDefined();
-                        isChrome ? expect(entry.filesystem.name).toContain("Persistent")
-                            : expect(entry.filesystem.name).toEqual("persistent");
+                        if (isChrome) {
+                            expect(entry.filesystem.name).toContain("Persistent");
+                        } else {
+                            expect(entry.filesystem.name).toEqual("persistent");
+                        }
                         sourceEntry = entry;
                         // Save for later cleanup
                         entry.copyTo(temp_root, file2, validateFile, failed.bind(null, done, 'entry.copyTo - Error copying file: ' + file1 + ' to TEMPORAL root as: ' + file2));
@@ -3255,8 +3265,11 @@ exports.defineAutoTests = function () {
                     expect(entry.name).toCanonicallyMatch(file2);
                     expect(entry.fullPath).toCanonicallyMatch(fullPath);
                     expect(entry.filesystem).toBeDefined();
-                    isChrome ? expect(entry.filesystem.name).toContain("Persistent")
-                        : expect(entry.filesystem.name).toEqual("persistent");
+                    if (isChrome) {
+                        expect(entry.filesystem.name).toContain("Persistent");
+                    } else {
+                        expect(entry.filesystem.name).toEqual("persistent");
+                    }
                     // cleanup
                     deleteEntry(entry.name);
                     deleteEntry(sourceEntry.name, done);
@@ -3266,8 +3279,11 @@ exports.defineAutoTests = function () {
                         create : true
                     }, function (entry) {
                         expect(entry.filesystem).toBeDefined();
-                        isChrome ? expect(entry.filesystem.name).toContain("Temporary")
-                            : expect(entry.filesystem.name).toEqual("temporary");
+                        if (isChrome) {
+                            expect(entry.filesystem.name).toContain("Temporary");
+                        } else {
+                            expect(entry.filesystem.name).toEqual("temporary");
+                        }
                         sourceEntry = entry;
                         // Save for later cleanup
                         entry.moveTo(persistent_root, file2, validateFile, failed.bind(null, done, 'entry.moveTo - Error moving file: ' + file1 + ' to PERSISTENT root as: ' + file2));
@@ -3289,8 +3305,11 @@ exports.defineAutoTests = function () {
                     expect(entry.isDirectory).toBe(false);
                     expect(entry.name).toCanonicallyMatch(file2);
                     expect(entry.fullPath).toCanonicallyMatch(fullPath);
-                    isChrome ? expect(entry.filesystem.name).toContain("Temporary")
-                        : expect(entry.filesystem.name).toEqual("temporary");
+                    if(isChrome) {
+                        expect(entry.filesystem.name).toContain("Temporary");
+                    } else {
+                        expect(entry.filesystem.name).toEqual("temporary");
+                    }
                     // cleanup
                     deleteEntry(entry.name);
                     deleteEntry(sourceEntry.name, done);
@@ -3301,8 +3320,11 @@ exports.defineAutoTests = function () {
                     }, function (entry) {
                         expect(entry).toBeDefined();
                         expect(entry.filesystem).toBeDefined();
-                        isChrome ? expect(entry.filesystem.name).toContain("Persistent")
-                            : expect(entry.filesystem.name).toEqual("persistent");
+                        if (isChrome) {
+                            expect(entry.filesystem.name).toContain("Persistent");
+                        } else {
+                            expect(entry.filesystem.name).toEqual("persistent");
+                        }
                         sourceEntry = entry;
                         // Save for later cleanup
                         entry.moveTo(temp_root, file2, validateFile, failed.bind(null, done, 'entry.moveTo - Error moving file: ' + file1 + ' to TEMPORAL root as: ' + file2));
@@ -3637,7 +3659,7 @@ exports.defineManualTests = function (contentEl, createActionButton) {
     }
 
     function testPrivateURL() {
-        requestFileSystem(TEMPORARY, 0, function (fileSystem) {
+        requestFileSystem(LocalFileSystem.TEMPORARY, 0, function (fileSystem) {
             logMessage("Temporary root is at " + fileSystem.root.toNativeURL());
             fileSystem.root.getFile("testfile", {
                 create : true

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/Entry.js
----------------------------------------------------------------------
diff --git a/www/Entry.js b/www/Entry.js
index 9cdc877..00ee023 100644
--- a/www/Entry.js
+++ b/www/Entry.js
@@ -109,8 +109,7 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
     var fail = errorCallback && function(code) {
         errorCallback(new FileError(code));
     };
-    var filesystem = this.filesystem,
-        srcURL = this.toInternalURL(),
+    var srcURL = this.toInternalURL(),
         // entry name
         name = newName || this.name,
         success = function(entry) {
@@ -125,7 +124,9 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
             }
             else {
                 // no Entry object returned
-                fail && fail(FileError.NOT_FOUND_ERR);
+                if (fail) {
+                    fail(FileError.NOT_FOUND_ERR);
+                }
             }
         };
 
@@ -150,8 +151,7 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
     var fail = errorCallback && function(code) {
         errorCallback(new FileError(code));
     };
-    var filesystem = this.filesystem,
-        srcURL = this.toInternalURL(),
+    var srcURL = this.toInternalURL(),
         // entry name
         name = newName || this.name,
         // success callback
@@ -167,7 +167,9 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
             }
             else {
                 // no Entry object returned
-                fail && fail(FileError.NOT_FOUND_ERR);
+                if (fail) {
+                    fail(FileError.NOT_FOUND_ERR);
+                }
             }
         };
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/FileEntry.js
----------------------------------------------------------------------
diff --git a/www/FileEntry.js b/www/FileEntry.js
index 59a9dc3..a03e37f 100644
--- a/www/FileEntry.js
+++ b/www/FileEntry.js
@@ -52,9 +52,13 @@ FileEntry.prototype.createWriter = function(successCallback, errorCallback) {
         var writer = new FileWriter(filePointer);
 
         if (writer.localURL === null || writer.localURL === "") {
-            errorCallback && errorCallback(new FileError(FileError.INVALID_STATE_ERR));
+            if (errorCallback) {
+                errorCallback(new FileError(FileError.INVALID_STATE_ERR));
+            }
         } else {
-            successCallback && successCallback(writer);
+            if (successCallback) {
+                successCallback(writer);
+            }
         }
     }, errorCallback);
 };

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/FileReader.js
----------------------------------------------------------------------
diff --git a/www/FileReader.js b/www/FileReader.js
index 5c523aa..30c9825 100644
--- a/www/FileReader.js
+++ b/www/FileReader.js
@@ -22,7 +22,6 @@
 var exec = require('cordova/exec'),
     modulemapper = require('cordova/modulemapper'),
     utils = require('cordova/utils'),
-    File = require('./File'),
     FileError = require('./FileError'),
     ProgressEvent = require('./ProgressEvent'),
     origFileReader = modulemapper.getOriginalSymbol(window, 'FileReader');
@@ -91,7 +90,9 @@ function initRead(reader, file) {
         return true;
     }
 
-    reader.onloadstart && reader.onloadstart(new ProgressEvent("loadstart", {target:reader}));
+    if (reader.onloadstart) {
+        reader.onloadstart(new ProgressEvent("loadstart", {target:reader}));
+    }
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/FileSystem.js b/www/FileSystem.js
index 907e585..82f9175 100644
--- a/www/FileSystem.js
+++ b/www/FileSystem.js
@@ -50,6 +50,6 @@ FileSystem.encodeURIPath = function(path) {
     // Because # is a valid filename character, it must be encoded to prevent part of the
     // path from being parsed as a URI fragment.
     return encodeURI(path).replace(/#/g, '%23');
-}
+};
 
 module.exports = FileSystem;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/.jshintrc
----------------------------------------------------------------------
diff --git a/www/blackberry10/.jshintrc b/www/blackberry10/.jshintrc
new file mode 100644
index 0000000..85ccb32
--- /dev/null
+++ b/www/blackberry10/.jshintrc
@@ -0,0 +1,5 @@
+{
+    "globals": {
+        "requestAnimationFrame": true
+    }
+}

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/FileSystem.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/FileSystem.js b/www/blackberry10/FileSystem.js
index 518a9aa..255f904 100644
--- a/www/blackberry10/FileSystem.js
+++ b/www/blackberry10/FileSystem.js
@@ -29,6 +29,7 @@ var info = require("cordova-plugin-file.bb10FileSystemInfo");
 
 module.exports = {
     __format__: function(fullPath) {
+        var path;
         switch (this.name) {
             case 'temporary':
                 path = info.temporaryPath + FileSystem.encodeURIPath(fullPath);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/copyTo.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/copyTo.js b/www/blackberry10/copyTo.js
index 5a86fcd..26f2708 100644
--- a/www/blackberry10/copyTo.js
+++ b/www/blackberry10/copyTo.js
@@ -40,91 +40,93 @@ module.exports = function (success, fail, args, move) {
     var uri = args[0],
         destination = args[1],
         fileName = args[2],
-        copiedEntry,
-        onSuccess = function () {
-            resolve(
-                function (entry) {
-                    if (typeof(success) === 'function') {
-                        success(entry);
-                    }
-                },
-                onFail,
-                [destination + copiedEntry.name]
-            );
-        },
-        onFail = function (error) {
-            if (typeof(fail) === 'function') {
-                if (error && error.code) {
-                    //set error codes expected by mobile spec
-                    if (uri === destination) {
-                        fail(FileError.INVALID_MODIFICATION_ERR);
-                    } else if (error.code === FileError.SECURITY_ERR) {
-                        fail(FileError.INVALID_MODIFICATION_ERR);
-                    } else {
-                        fail(error.code);
-                    }
+        copiedEntry;
+
+    function onSuccess() {
+        resolve(
+            function (entry) {
+                if (typeof(success) === 'function') {
+                    success(entry);
+                }
+            },
+            onFail,
+            [destination + copiedEntry.name]
+        );
+    }
+    function onFail(error) {
+        if (typeof(fail) === 'function') {
+            if (error && error.code) {
+                //set error codes expected by mobile spec
+                if (uri === destination) {
+                    fail(FileError.INVALID_MODIFICATION_ERR);
+                } else if (error.code === FileError.SECURITY_ERR) {
+                    fail(FileError.INVALID_MODIFICATION_ERR);
                 } else {
-                    fail(error);
+                    fail(error.code);
                 }
+            } else {
+                fail(error);
             }
-        },
-        writeFile = function (fileEntry, blob, entry) {
-            copiedEntry = fileEntry;
-            fileEntry.createWriter(function (fileWriter) {
-                fileWriter.onwriteend = function () {
-                    if (move) {
-                        entry.nativeEntry.remove(onSuccess, function () {
-                            console.error("Move operation failed. Files may exist at both source and destination");
+        }
+    }
+    function writeFile(fileEntry, blob, entry) {
+        copiedEntry = fileEntry;
+        fileEntry.createWriter(function (fileWriter) {
+            fileWriter.onwriteend = function () {
+                if (move) {
+                    entry.nativeEntry.remove(onSuccess, function () {
+                        console.error("Move operation failed. Files may exist at both source and destination");
+                    });
+                } else {
+                    onSuccess();
+                }
+            };
+            fileWriter.onerror = onFail;
+            fileWriter.write(blob);
+        }, onFail);
+    }
+    function copyFile(entry) {
+        if (entry.nativeEntry.file) {
+            entry.nativeEntry.file(function (file) {
+                var reader = new FileReader()._realReader;
+                reader.onloadend = function (e) {
+                    var contents = new Uint8Array(this.result),
+                        blob = new Blob([contents]);
+                    resolve(function (destEntry) {
+                        requestAnimationFrame(function () {
+                            destEntry.nativeEntry.getFile(fileName, {create: true}, function (fileEntry) {
+                                writeFile(fileEntry, blob, entry);
+                            }, onFail);
                         });
-                    } else {
-                        onSuccess();
-                    }
+                    }, onFail, [destination]);   
                 };
-                fileWriter.onerror = onFail;
-                fileWriter.write(blob);
+                reader.onerror = onFail;
+                reader.readAsArrayBuffer(file);
             }, onFail);
-        },
-        copyFile = function (entry) {
-            if (entry.nativeEntry.file) {
-                entry.nativeEntry.file(function (file) {
-                    var reader = new FileReader()._realReader;
-                    reader.onloadend = function (e) {
-                        var contents = new Uint8Array(this.result),
-                            blob = new Blob([contents]);
-                        resolve(function (destEntry) {
-                            requestAnimationFrame(function () {
-                                destEntry.nativeEntry.getFile(fileName, {create: true}, function (fileEntry) {
-                                    writeFile(fileEntry, blob, entry);
-                                }, onFail);
-                            });
-                        }, onFail, [destination]);   
-                    };
-                    reader.onerror = onFail;
-                    reader.readAsArrayBuffer(file);
-                }, onFail);
-            } else {
+        } else {
+            onFail(FileError.INVALID_MODIFICATION_ERR);
+        }
+    }
+    function copyDirectory(entry) {
+        resolve(function (destEntry) {
+            if (entry.filesystemName !== destEntry.filesystemName) {
+                console.error("Copying directories between filesystems is not supported on BB10");
                 onFail(FileError.INVALID_MODIFICATION_ERR);
+            } else {
+                entry.nativeEntry.copyTo(destEntry.nativeEntry, fileName, function () {
+                    resolve(function (copiedDir) {
+                        copiedEntry = copiedDir;
+                        if (move) {
+                            entry.nativeEntry.removeRecursively(onSuccess, onFail);
+                        } else {
+                            onSuccess();
+                        }
+                    }, onFail, [destination + fileName]);
+                }, onFail);
             }
-        },
-        copyDirectory = function (entry) {
-            resolve(function (destEntry) {
-                if (entry.filesystemName !== destEntry.filesystemName) {
-                    console.error("Copying directories between filesystems is not supported on BB10");
-                    onFail(FileError.INVALID_MODIFICATION_ERR);   
-                } else {
-                    entry.nativeEntry.copyTo(destEntry.nativeEntry, fileName, function () {
-                        resolve(function (copiedDir) {
-                            copiedEntry = copiedDir;
-                            if (move) {
-                                entry.nativeEntry.removeRecursively(onSuccess, onFail);
-                            } else {
-                                onSuccess();
-                            }
-                        }, onFail, [destination + fileName]);
-                    }, onFail);
-                }
-            }, onFail, [destination]); 
-        };
+        }, onFail, [destination]); 
+    }
+
     if (destination + fileName === uri) {
         onFail(FileError.INVALID_MODIFICATION_ERR);
     } else if (fileName.indexOf(':') > -1) {

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/readEntries.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/readEntries.js b/www/blackberry10/readEntries.js
index 3b982de..6dcb6da 100644
--- a/www/blackberry10/readEntries.js
+++ b/www/blackberry10/readEntries.js
@@ -31,7 +31,6 @@
  */
 
 var resolve = cordova.require('cordova-plugin-file.resolveLocalFileSystemURIProxy'),
-    info = require('cordova-plugin-file.bb10FileSystemInfo'),
     requestAnimationFrame = cordova.require('cordova-plugin-file.bb10RequestAnimationFrame'),
     createEntryFromNative = cordova.require('cordova-plugin-file.bb10CreateEntryFromNative');
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/requestAllFileSystems.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/requestAllFileSystems.js b/www/blackberry10/requestAllFileSystems.js
index a7774dd..d023beb 100644
--- a/www/blackberry10/requestAllFileSystems.js
+++ b/www/blackberry10/requestAllFileSystems.js
@@ -39,4 +39,4 @@ module.exports = function (success, fail, args) {
         { filesystemName: 'temporary', name: 'temporary', fullPath: '/', nativeURL: info.temporaryPath + '/' },
         { filesystemName: 'root', name: 'root', fullPath: '/', nativeURL: 'file:///' }
     ]);
-}
+};

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/truncate.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/truncate.js b/www/blackberry10/truncate.js
index e616152..fe43b7e 100644
--- a/www/blackberry10/truncate.js
+++ b/www/blackberry10/truncate.js
@@ -56,7 +56,7 @@ module.exports = function (success, fail, args) {
             fs.nativeEntry.file(function (file) {
                 var reader = new FileReader()._realReader;
                 reader.onloadend = function () {
-                    var contents = new Uint8Array(this.result).subarray(0, length);
+                    var contents = new Uint8Array(this.result).subarray(0, length),
                         blob = new Blob([contents]);
                     window.requestAnimationFrame(function () {
                         fs.nativeEntry.createWriter(function (fileWriter) {

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/blackberry10/write.js
----------------------------------------------------------------------
diff --git a/www/blackberry10/write.js b/www/blackberry10/write.js
index 689b39b..b2ed261 100644
--- a/www/blackberry10/write.js
+++ b/www/blackberry10/write.js
@@ -40,7 +40,7 @@ module.exports = function (success, fail, args) {
     var uri = args[0],
         data = args[1],
         offset = args[2],
-        isBinary = args[3],
+        //isBinary = args[3],
         onSuccess = function (data) {
             if (typeof success === 'function') {
                 success(data.loaded);

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/browser/Preparing.js
----------------------------------------------------------------------
diff --git a/www/browser/Preparing.js b/www/browser/Preparing.js
index 2f94c70..7845f9e 100644
--- a/www/browser/Preparing.js
+++ b/www/browser/Preparing.js
@@ -98,7 +98,9 @@
             }
 
             // cdvfile other than local file resource is not supported
-            fail && fail(new FileError(FileError.ENCODING_ERR));
+            if (fail) {
+                fail(new FileError(FileError.ENCODING_ERR));
+            }
         } else {
             nativeResolveLocalFileSystemURL(url, win, fail);
         }
@@ -135,7 +137,9 @@
             };
 
             entryType.setMetadata = function(win, fail /*, metadata*/) {
-                fail && fail("Not supported");
+                if (fail) {
+                    fail("Not supported");
+                }
             };
 
             fileEntry.createWriter(function(writer) {

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/fileSystems-roots.js
----------------------------------------------------------------------
diff --git a/www/fileSystems-roots.js b/www/fileSystems-roots.js
index ff77d94..107a9b8 100644
--- a/www/fileSystems-roots.js
+++ b/www/fileSystems-roots.js
@@ -26,19 +26,20 @@ var exec = require('cordova/exec');
 
 // Overridden by Android, BlackBerry 10 and iOS to populate fsMap.
 require('./fileSystems').getFs = function(name, callback) {
+    function success(response) {
+        fsMap = {};
+        for (var i = 0; i < response.length; ++i) {
+            var fsRoot = response[i];
+            var fs = new FileSystem(fsRoot.filesystemName, fsRoot);
+            fsMap[fs.name] = fs;
+        }
+        callback(fsMap[name]);
+    }
+
     if (fsMap) {
         callback(fsMap[name]);
     } else {
         exec(success, null, "File", "requestAllFileSystems", []);
-        function success(response) {
-            fsMap = {};
-            for (var i = 0; i < response.length; ++i) {
-                var fsRoot = response[i];
-                var fs = new FileSystem(fsRoot.filesystemName, fsRoot);
-                fsMap[fs.name] = fs;
-            }
-            callback(fsMap[name]);
-        }
     }
 };
 

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/requestFileSystem.js
----------------------------------------------------------------------
diff --git a/www/requestFileSystem.js b/www/requestFileSystem.js
index 1c6c5f4..300937e 100644
--- a/www/requestFileSystem.js
+++ b/www/requestFileSystem.js
@@ -18,6 +18,7 @@
  * under the License.
  *
 */
+
 (function() {
     //For browser platform: not all browsers use this file.
     function checkBrowser() {
@@ -47,7 +48,9 @@
     var requestFileSystem = function(type, size, successCallback, errorCallback) {
         argscheck.checkArgs('nnFF', 'requestFileSystem', arguments);
         var fail = function(code) {
-            errorCallback && errorCallback(new FileError(code));
+            if (errorCallback) {
+                errorCallback(new FileError(code));
+            }
         };
 
         if (type < 0) {

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/resolveLocalFileSystemURI.js
----------------------------------------------------------------------
diff --git a/www/resolveLocalFileSystemURI.js b/www/resolveLocalFileSystemURI.js
index 4761222..bfa3b07 100644
--- a/www/resolveLocalFileSystemURI.js
+++ b/www/resolveLocalFileSystemURI.js
@@ -48,7 +48,9 @@
         argscheck.checkArgs('sFF', 'resolveLocalFileSystemURI', arguments);
         // error callback
         var fail = function(error) {
-            errorCallback && errorCallback(new FileError(error));
+            if (errorCallback) {
+                errorCallback(new FileError(error));
+            }
         };
         // sanity check for 'not:valid:filename' or '/not:valid:filename'
         // file.spec.12 window.resolveLocalFileSystemURI should error (ENCODING_ERR) when resolving invalid URI with leading /.

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/ubuntu/FileWriter.js
----------------------------------------------------------------------
diff --git a/www/ubuntu/FileWriter.js b/www/ubuntu/FileWriter.js
index a75506b..5428cb2 100644
--- a/www/ubuntu/FileWriter.js
+++ b/www/ubuntu/FileWriter.js
@@ -63,10 +63,10 @@ function write(data) {
 
     if (data instanceof ArrayBuffer || data.buffer instanceof ArrayBuffer) {
         data = new Uint8Array(data);
-	var binary = "";
-	for (var i = 0; i < data.byteLength; i++) {
+    var binary = "";
+    for (var i = 0; i < data.byteLength; i++) {
             binary += String.fromCharCode(data[i]);
-	}
+    }
         data = binary;
     }
 
@@ -126,7 +126,7 @@ function write(data) {
                 me.onwriteend(new ProgressEvent("writeend", {"target":me}));
             }
         }, "File", "write", [path, data, this.position, isBinary]);
-};
+}
 
 module.exports = {
     write: write

http://git-wip-us.apache.org/repos/asf/cordova-plugin-file/blob/f6d42aee/www/ubuntu/fileSystems-roots.js
----------------------------------------------------------------------
diff --git a/www/ubuntu/fileSystems-roots.js b/www/ubuntu/fileSystems-roots.js
index e132a95..d2c6857 100644
--- a/www/ubuntu/fileSystems-roots.js
+++ b/www/ubuntu/fileSystems-roots.js
@@ -28,7 +28,7 @@ var requestFileSystem = function(type, size, successCallback) {
     var success = function(file_system) {
         if (file_system) {
             if (successCallback) {
-                fs = new FileSystem(file_system.name, file_system.root);
+                var fs = new FileSystem(file_system.name, file_system.root);
                 successCallback(fs);
             }
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message