cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/3] cordova-windows git commit: Fix for callback invocation with NO_RESULT
Date Fri, 13 Mar 2015 18:33:34 GMT
Repository: cordova-windows
Updated Branches:
  refs/heads/master a0c041698 -> 3a0d13241


Fix for callback invocation with NO_RESULT

Due to the enumeration of cordova.callbackStatus (NO_RESULT = 0 and OK = 1), the logic used
for defaulting to cordova.callbackStatus.OK will always default to cordova.callbackStatus.OK
when the callbackStatus is set to cordova.callbackStatus.NO_RESULT.

This change addresses this issue by first checking if callbackOptions.status is null and defaulting
to cordova.callbackStatus.OK, otherwise it will accept the callbackOptions.status value provided
by the user.

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

Branch: refs/heads/master
Commit: 1e4b5330103af18a75dd82772eab3541b6436f19
Parents: a0c0416
Author: CJRChang <CJRChang@users.noreply.github.com>
Authored: Thu Mar 12 11:14:38 2015 +1000
Committer: CJRChang <CJRChang@users.noreply.github.com>
Committed: Thu Mar 12 11:14:38 2015 +1000

----------------------------------------------------------------------
 cordova-js-src/exec.js | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-windows/blob/1e4b5330/cordova-js-src/exec.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
index 04a9458..d7f0c0f 100644
--- a/cordova-js-src/exec.js
+++ b/cordova-js-src/exec.js
@@ -60,18 +60,32 @@ module.exports = function (success, fail, service, action, args) {
             // CB-5806 [Windows8] Add keepCallback support to proxy
             onSuccess = function (result, callbackOptions) {
                 callbackOptions = callbackOptions || {};
+                var callbackStatus;
+                if (callbackOptions.status !== null) {
+                    callbackStatus = callbackOptions.status;
+                }
+                else {
+                    callbackStatus = cordova.callbackStatus.OK;
+                }
                 cordova.callbackSuccess(callbackOptions.callbackId || callbackId,
                     {
-                        status: callbackOptions.status || cordova.callbackStatus.OK,
+                        status: callbackStatus,
                         message: result,
                         keepCallback: callbackOptions.keepCallback || false
                     });
             };
             onError = function (err, callbackOptions) {
                 callbackOptions = callbackOptions || {};
+                var callbackStatus;
+                if (callbackOptions.status !== null) {
+                    callbackStatus = callbackOptions.status;
+                }
+                else {
+                    callbackStatus = cordova.callbackStatus.OK;
+                }
                 cordova.callbackError(callbackOptions.callbackId || callbackId,
                     {
-                        status: callbackOptions.status || cordova.callbackStatus.ERROR,
+                        status: callbackStatus,
                         message: err,
                         keepCallback: callbackOptions.keepCallback || false
                     });
@@ -86,4 +100,4 @@ module.exports = function (success, fail, service, action, args) {
             fail("Missing Command Error");
         }
     }
-};
\ No newline at end of file
+};


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


Mime
View raw message