From a13a915a4b387f31f4f87ac6a7fc73d763bf8b06 Mon Sep 17 00:00:00 2001 From: Ursula Sarracini Date: Fri, 20 Apr 2018 16:57:07 -0400 Subject: [PATCH] Bug 1455737 - Remove the result object from DownloadHistory when removing the view r=Mardak MozReview-Commit-ID: 5Qb5j30eqFO --HG-- extra : rebase_source : 5a01b533acd7ceee70c23f063bdc889daf7f8311 --- toolkit/components/downloads/DownloadHistory.jsm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/toolkit/components/downloads/DownloadHistory.jsm b/toolkit/components/downloads/DownloadHistory.jsm index 40ce09d9a91f..d1501e6294cd 100644 --- a/toolkit/components/downloads/DownloadHistory.jsm +++ b/toolkit/components/downloads/DownloadHistory.jsm @@ -454,6 +454,17 @@ this.DownloadHistoryList.prototype = { }, _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.