Bug 955665 - executeSoon calls pile up on addPendingChats, causing jank, r=nhnt11.
--- a/im/components/ibConvStatsService.js
+++ b/im/components/ibConvStatsService.js
@@ -255,23 +255,24 @@ ConvStatsService.prototype = {
}
let possibleConv = new PossibleChat(chat);
let pos = this._getPositionToInsert(possibleConv, this._convs);
this._convs.splice(pos, 0, possibleConv);
chatList.set(chat.name, possibleConv);
}
if (this._pendingChats.length)
executeSoon(this._addPendingChats.bind(this));
+ else
+ delete this._addingPendingChats;
let now = Date.now();
if ((!this._accountsRequestingRoomInfo.size && !this._pendingChats.length) ||
now - this._lastUpdateNotification > 100) {
this._notifyObservers("updated");
this._lastUpdateNotification = now;
}
- delete this._addingPendingChats;
},
_removeChatsForAccount: function(aAccId) {
if (!this._chatsByAccountIdAndName.has(aAccId))
return;
// Keep only convs that either aren't chats or have a different account id.
this._convs = this._convs.filter(function(c)
c.source != "chat" || c.accountId != aAccId);