Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B83110FF7 for ; Fri, 11 Oct 2013 23:18:45 +0000 (UTC) Received: (qmail 8746 invoked by uid 500); 11 Oct 2013 23:18:45 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 8725 invoked by uid 500); 11 Oct 2013 23:18:45 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 8648 invoked by uid 99); 11 Oct 2013 23:18:45 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Oct 2013 23:18:45 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C1EC8915E47; Fri, 11 Oct 2013 23:18:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: purplecabbage@apache.org To: commits@cordova.apache.org Date: Fri, 11 Oct 2013 23:18:45 -0000 Message-Id: <65822ecbe19d4b8c9e4a4a692aa90134@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [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 Authored: Tue Sep 24 19:17:17 2013 -0400 Committer: purplecabbage 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"); + } } };