Bug 1149880 - Avoid readinglist item races logging unhandled promise exceptions. r=dolske, a=sledru
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 07 Apr 2015 11:43:22 +1000
changeset 266927 2fb9041fcc77a455b9d9109ad5ebac556ab14ab3
parent 266926 f17e9465f810283e3262bde90eb2edab381e45d6
child 266928 62150718ee217ad0e614d77fc5ba9289612d8ab2
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske, sledru
bugs1149880
milestone39.0a2
Bug 1149880 - Avoid readinglist item races logging unhandled promise exceptions. r=dolske, a=sledru
browser/components/readinglist/sidebar.js
--- a/browser/components/readinglist/sidebar.js
+++ b/browser/components/readinglist/sidebar.js
@@ -462,16 +462,19 @@ let RLSidebar = {
     if (msg.topic != "UpdateActiveItem") {
       return;
     }
 
     if (!msg.url) {
       this.activeItem = null;
     } else {
       ReadingList.itemForURL(msg.url).then(item => {
-        this.activeItem = this.itemNodesById.get(item.id);
+        let node;
+        if (item && (node = this.itemNodesById.get(item.id))) {
+          this.activeItem = node;
+        }
       });
     }
   }
 };
 
 
 addEventListener("DOMContentLoaded", () => RLSidebar.init());