cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [2/3] js commit: [CB-4905] CordovaJS on Windows8 has memoryleak on exec.js
Date Fri, 11 Oct 2013 23:12:07 GMT
[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/668d79fc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/668d79fc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/668d79fc

Branch: refs/heads/3.1.x
Commit: 668d79fcc89ae04d0102dc27526b07709b9688d8
Parents: 55d6354
Author: Carlos Santana <csantana23@gmail.com>
Authored: Tue Sep 24 19:17:17 2013 -0400
Committer: Carlos Santana <csantana23@gmail.com>
Committed: Tue Sep 24 19:17:17 2013 -0400

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


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/668d79fc/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");
+        }
     }
 };


Mime
View raw message