You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2012/10/25 18:07:11 UTC

js commit: Add support for null exec payloads.

Updated Branches:
  refs/heads/master 1ded2d3a1 -> c8f9ab67f


Add support for null exec payloads.

https://issues.apache.org/jira/browse/CB-1744


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

Branch: refs/heads/master
Commit: c8f9ab67faaed0e402530e3c9621c245e4614249
Parents: 1ded2d3
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Oct 25 11:59:04 2012 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Oct 25 12:06:58 2012 -0400

----------------------------------------------------------------------
 lib/android/exec.js       |    2 ++
 test/android/test.exec.js |    5 +++++
 2 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c8f9ab67/lib/android/exec.js
----------------------------------------------------------------------
diff --git a/lib/android/exec.js b/lib/android/exec.js
index bc9083a..bd5fc7b 100644
--- a/lib/android/exec.js
+++ b/lib/android/exec.js
@@ -169,6 +169,8 @@ function processMessage(message) {
                 payload = true;
             } else if (payloadKind == 'f') {
                 payload = false;
+            } else if (payloadKind == 'N') {
+                payload = null;
             } else if (payloadKind == 'n') {
                 payload = +message.slice(nextSpaceIdx + 2);
             } else {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/c8f9ab67/test/android/test.exec.js
----------------------------------------------------------------------
diff --git a/test/android/test.exec.js b/test/android/test.exec.js
index 97fbb10..5ce1f38 100644
--- a/test/android/test.exec.js
+++ b/test/android/test.exec.js
@@ -58,6 +58,11 @@ describe('exec.processMessages', function () {
             exec.processMessages(messages);
             expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, true, true);
         });
+        it('should handle payloads of null', function() {
+            var messages = createCallbackMessage(true, true, 1, 'id', 'N');
+            exec.processMessages(messages);
+            expect(callbackSpy).toHaveBeenCalledWith('id', true, 1, null, true);
+        });
         it('should handle payloads of numbers', function() {
             var messages = createCallbackMessage(true, true, 1, 'id', 'n-3.3');
             exec.processMessages(messages);