You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/05/14 20:33:12 UTC

[30/33] js commit: [BlackBerry10] Fix Entry.moveTo check for valid success function

[BlackBerry10] Fix Entry.moveTo check for valid success function

Reviewed by Hasan Ahmad <ha...@blackberry.com>


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

Branch: refs/heads/master
Commit: 188c17d64400770a1dcba7294aed38244aa1d811
Parents: 369e1af
Author: Bryan Higgins <bh...@blackberry.com>
Authored: Mon Apr 22 10:42:57 2013 -0400
Committer: Bryan Higgins <bh...@blackberry.com>
Committed: Fri May 3 09:50:05 2013 -0400

----------------------------------------------------------------------
 lib/blackberry10/plugin/Entry.js |   20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/188c17d6/lib/blackberry10/plugin/Entry.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/Entry.js b/lib/blackberry10/plugin/Entry.js
index f80e879..cf971fe 100644
--- a/lib/blackberry10/plugin/Entry.js
+++ b/lib/blackberry10/plugin/Entry.js
@@ -50,20 +50,17 @@ Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataO
 
 Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallback) {
     argscheck.checkArgs('oSFF', 'Entry.moveTo', arguments);
-    var fail = errorCallback && function(code) {
-            errorCallback(new FileError(code));
-        },
-        srcPath = this.fullPath,
+    var srcPath = this.fullPath,
         name = newName || this.name,
         success = function(entry) {
             if (entry) {
-                if (successCallback === 'function') {
+                if (typeof successCallback === 'function') {
                     successCallback(fileUtils.createEntry(entry));
                 }
             }
             else {
-                if (typeof fail === 'function') {
-                    fail(FileError.NOT_FOUND_ERR);
+                if (typeof errorCallback === 'function') {
+                    errorCallback(new FileError(FileError.NOT_FOUND_ERR));
                 }
             }
         };
@@ -73,10 +70,7 @@ Entry.prototype.moveTo = function(parent, newName, successCallback, errorCallbac
 
 Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallback) {
     argscheck.checkArgs('oSFF', 'Entry.copyTo', arguments);
-    var fail = errorCallback && function(code) {
-            errorCallback(new FileError(code));
-        },
-        srcPath = this.fullPath,
+    var srcPath = this.fullPath,
         name = newName || this.name,
         success = function(entry) {
             if (entry) {
@@ -85,8 +79,8 @@ Entry.prototype.copyTo = function(parent, newName, successCallback, errorCallbac
                 }
             }
             else {
-                if (typeof fail === 'function') {
-                    fail(FileError.NOT_FOUND_ERR);
+                if (typeof errorCallback === 'function') {
+                    errorCallback(new FileError(FileError.NOT_FOUND_ERR));
                 }
             }
         };