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

[2/2] js commit: [CB-4905] CordovaJS on Windows8 has memoryleak on exec.js

[CB-4905] CordovaJS on Windows8 has memoryleak on exec.js


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

Branch: refs/heads/master
Commit: 4e7d30d264a530e747e9846947f1771588efaad0
Parents: 0c17849
Author: Carlos Santana <cs...@gmail.com>
Authored: Tue Sep 24 19:17:17 2013 -0400
Committer: purplecabbage <pu...@gmail.com>
Committed: Fri Oct 11 16:17:49 2013 -0700

----------------------------------------------------------------------
 lib/windows8/exec.js | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/4e7d30d2/lib/windows8/exec.js
----------------------------------------------------------------------
diff --git a/lib/windows8/exec.js b/lib/windows8/exec.js
index c4858dd..a8717a3 100644
--- a/lib/windows8/exec.js
+++ b/lib/windows8/exec.js
@@ -42,7 +42,9 @@ var commandProxy = require('cordova/windows8/commandProxy');
 module.exports = function (success, fail, service, action, args) {
 
     var proxy = commandProxy.get(service, action),
-        callbackId;
+        callbackId,
+        onSuccess,
+        onError;
 
     if (proxy) {
         callbackId = service + cordova.callbackId++;
@@ -51,11 +53,28 @@ module.exports = function (success, fail, service, action, args) {
             cordova.callbacks[callbackId] = {success: success, fail: fail};
         }
         try {
-            proxy(success, fail, args);
+            onSuccess = function (result) {
+                cordova.callbackSuccess(callbackId,
+                        {
+                        status: cordova.callbackStatus.OK,
+                        message: result
+                    });
+            };
+            onError = function (err) {
+                cordova.callbackError(callbackId,
+                        {
+                        status: cordova.callbackStatus.ERROR,
+                        message: err
+                    });
+            };
+            proxy(onSuccess, onError, args);
+
         } catch (e) {
             console.log("Exception calling native with command :: " + service + " :: " + action  + " ::exception=" + e);
         }
     } else {
-        return (fail && fail("Missing Command Error"));
+        if (typeof fail === "function") {
+            fail("Missing Command Error");
+        }
     }
 };