From 9f197cc0a6743bc0f94432b28139b9883fe315d5 Mon Sep 17 00:00:00 2001 From: Gregor Wagner Date: Fri, 3 May 2013 09:15:55 -0700 Subject: [PATCH] Bug 867043 - Don't ask for more contacts more than once for the same chunk. r=reuben --- dom/contacts/ContactManager.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dom/contacts/ContactManager.js b/dom/contacts/ContactManager.js index 7e66715a3a6..c87302cc874 100644 --- a/dom/contacts/ContactManager.js +++ b/dom/contacts/ContactManager.js @@ -471,6 +471,9 @@ ContactManager.prototype = { let contact = result.shift(); this._pushArray(data.cachedContacts, result); this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact)); + if (!contact) { + this.removeRequest(msg.cursorId); + } } else { if (DEBUG) debug("cursor not waiting, saving"); this._pushArray(data.cachedContacts, result); @@ -680,7 +683,9 @@ ContactManager.prototype = { if (DEBUG) debug("contact in cache"); let contact = data.cachedContacts.shift(); this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact)); - if (data.cachedContacts.length < CONTACTS_SENDMORE_MINIMUM) { + if (!contact) { + this.removeRequest(aCursorId); + } else if (data.cachedContacts.length === CONTACTS_SENDMORE_MINIMUM) { cpmm.sendAsyncMessage("Contacts:GetAll:SendNow", { cursorId: aCursorId }); } } else {