Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-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 C1996105CE for ; Tue, 1 Apr 2014 08:53:41 +0000 (UTC) Received: (qmail 22234 invoked by uid 500); 1 Apr 2014 08:52:28 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 21876 invoked by uid 500); 1 Apr 2014 08:52:19 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 21375 invoked by uid 99); 1 Apr 2014 08:52:09 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Apr 2014 08:52:09 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 8DC4F91B217; Tue, 1 Apr 2014 08:52:07 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kxepal@apache.org To: commits@couchdb.apache.org Date: Tue, 01 Apr 2014 08:52:52 -0000 Message-Id: <1c2c7b1a4b0345e781facd552e7d44ed@git.apache.org> In-Reply-To: <9b1fa52a5b7c4e23a6ef348e7963b27c@git.apache.org> References: <9b1fa52a5b7c4e23a6ef348e7963b27c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [47/50] jquery-couch commit: updated refs/heads/import-master to 66dbcbf jquery.couch.js: db.changes().stop() should abort XMLHTTPRequest Project: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/commit/620562c9 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/tree/620562c9 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/diff/620562c9 Branch: refs/heads/import-master Commit: 620562c9865c52b45ada5de864583e1010b99534 Parents: b99d71e Author: Fedor Indutny Authored: Tue Dec 10 17:29:16 2013 +0400 Committer: Alexander Shorin Committed: Tue Dec 10 17:29:16 2013 +0400 ---------------------------------------------------------------------- jquery.couch.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-jquery-couch/blob/620562c9/jquery.couch.js ---------------------------------------------------------------------- diff --git a/jquery.couch.js b/jquery.couch.js index db4e8ef..1a4c3b7 100644 --- a/jquery.couch.js +++ b/jquery.couch.js @@ -412,6 +412,7 @@ // set up the promise object within a closure for this handler var timeout = 100, db = this, active = true, listeners = [], + xhr = null, promise = /** @lends $.couch.db.changes */ { /** * Add a listener callback @@ -428,6 +429,9 @@ */ stop : function() { active = false; + if (xhr){ + xhr.abort(); + } } }; // call each listener when there is a change @@ -458,7 +462,7 @@ feed : "longpoll", since : since }); - ajax( + xhr = ajax( {url: db.uri + "_changes"+encodeOptions(opts)}, options, "Error connecting to "+db.uri+"/_changes." @@ -976,7 +980,7 @@ ajaxOptions = $.extend(defaultAjaxOpts, ajaxOptions); errorMessage = errorMessage || "Unknown error"; timeStart = (new Date()).getTime(); - $.ajax($.extend($.extend({ + return $.ajax($.extend($.extend({ type: "GET", dataType: "json", cache : maybeUseCache(), beforeSend: function(xhr){ if(ajaxOptions && ajaxOptions.headers){