Bug 1149869 - Prevent duplicate readinglist items from appearing in the sidebar in some cases. r=Unfocused, a=sledru
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 01 Apr 2015 17:03:53 +1100
changeset 265489 a6f8ea1578689e91b7f6ff5ab02b5800b3bc92a9
parent 265488 7f5a0e2cdb00c6f3cea0968e053118e7a58de258
child 265490 f30e59dc03c365cd0285efabdb73792ecf87c532
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersUnfocused, sledru
bugs1149869
milestone39.0a2
Bug 1149869 - Prevent duplicate readinglist items from appearing in the sidebar in some cases. r=Unfocused, a=sledru
browser/components/readinglist/sidebar.js
--- a/browser/components/readinglist/sidebar.js
+++ b/browser/components/readinglist/sidebar.js
@@ -113,20 +113,22 @@ let RLSidebar = {
   /**
    * Handle an item being deleted from the ReadingList.
    * @param {ReadingListItem} item - Item that was deleted.
    */
   onItemDeleted(item) {
     log.trace(`onItemDeleted: ${item}`);
 
     let itemNode = this.itemNodesById.get(item.id);
+
+    this.itemNodesById.delete(item.id);
+    this.itemsById.delete(item.id);
+
     itemNode.addEventListener('transitionend', (event) => {
       if (event.propertyName == "max-height") {
-        this.itemNodesById.delete(item.id);
-        this.itemsById.delete(item.id);
         itemNode.remove();
 
         // TODO: ensureListItems doesn't yet cope with needing to add one item.
         //this.ensureListItems();
 
         this.emptyListInfo.hidden = (this.numItems > 0);
       }
     }, false);