Bug 1447705 - Make BackgroundPageThumbs._destroy actually called. Fix leak from BackgroundPageThumbs.jsm. r=kmag.

--HG--
extra : rebase_source : 6b49b19c6ad8ce3dcec09f0a1456480a598b43ec
This commit is contained in:
Peter Van der Beken 2018-02-26 17:48:35 +01:00
Родитель 1de062f3aa
Коммит 532140c6e7
1 изменённых файлов: 4 добавлений и 7 удалений

Просмотреть файл

@ -217,12 +217,15 @@ const BackgroundPageThumbs = {
}, },
_init() { _init() {
Services.prefs.addObserver(ABOUT_NEWTAB_SEGREGATION_PREF, this);
Services.obs.addObserver(this, "profile-before-change"); Services.obs.addObserver(this, "profile-before-change");
}, },
observe(subject, topic, data) { observe(subject, topic, data) {
if (topic == "profile-before-change") { if (topic == "profile-before-change") {
this._destroy(); this._destroy();
} else if (topic == "nsPref:changed" && data == ABOUT_NEWTAB_SEGREGATION_PREF) {
BackgroundPageThumbs.renewThumbnailBrowser();
} }
}, },
@ -368,13 +371,7 @@ const BackgroundPageThumbs = {
_destroyBrowserTimeout: DESTROY_BROWSER_TIMEOUT, _destroyBrowserTimeout: DESTROY_BROWSER_TIMEOUT,
}; };
Services.prefs.addObserver(ABOUT_NEWTAB_SEGREGATION_PREF, BackgroundPageThumbs._init();
function(aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed" && aData == ABOUT_NEWTAB_SEGREGATION_PREF) {
BackgroundPageThumbs.renewThumbnailBrowser();
}
});
Object.defineProperty(this, "BackgroundPageThumbs", { Object.defineProperty(this, "BackgroundPageThumbs", {
value: BackgroundPageThumbs, value: BackgroundPageThumbs,
enumerable: true, enumerable: true,