Bug 1455737 - Remove the result object from DownloadHistory when removing the view r=Mardak
☠☠ backed out by cf89da716c0b ☠ ☠
authorUrsula Sarracini <usarracini@mozilla.com>
Fri, 20 Apr 2018 16:57:07 -0400
changeset 414730 40c5d3600d35
parent 414729 42f5c08a4d86
child 414731 2ddb032c4520
push id63013
push userusarracini@mozilla.com
push dateFri, 20 Apr 2018 22:41:16 +0000
treeherderautoland@40c5d3600d35 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMardak
bugs1455737
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1455737 - Remove the result object from DownloadHistory when removing the view r=Mardak MozReview-Commit-ID: 5Qb5j30eqFO
toolkit/components/downloads/DownloadHistory.jsm
--- a/toolkit/components/downloads/DownloadHistory.jsm
+++ b/toolkit/components/downloads/DownloadHistory.jsm
@@ -450,16 +450,27 @@ this.DownloadHistoryList.prototype = {
     if (this._result) {
       this._result.root.containerOpen = true;
       PlacesUtils.annotations.addObserver(this);
     }
   },
   _result: null,
 
   /**
+   * Remove the view that belongs to this list via DownloadList's removeView. In
+   * addition, delete the result object to ensure there are no memory leaks.
+   */
+  removeView(aView) {
+    DownloadList.prototype.removeView.call(this, aView);
+
+    // Clean up any active results that might still be observing. See bug 1455737
+    this.result = null;
+  },
+
+  /**
    * Index of the first slot that contains a session download. This is equal to
    * the length of the list when there are no session downloads.
    */
   _firstSessionSlotIndex: 0,
 
   _insertSlot({ slot, index, slotsForUrl }) {
     // Add the slot to the ordered array.
     this._slots.splice(index, 0, slot);