mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 17:59:34 +00:00
Bug 851130 - Part 6 - Fixup view destructors so they don't leak. r=sfoster
This commit is contained in:
parent
1ffc6e2633
commit
67b5c14c84
@ -25,6 +25,9 @@ const kTabThumbnailDelayCapture = 500;
|
||||
|
||||
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
// See grid.xml, we use this to cache style info across loads of the startui.
|
||||
var _richgridTileSizes = {};
|
||||
|
||||
// Override sizeToContent in the main window. It breaks things (bug 565887)
|
||||
window.sizeToContent = function() {
|
||||
Cu.reportError("window.sizeToContent is not allowed in this window");
|
||||
|
@ -58,6 +58,15 @@ BookmarksView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
this._root = aRoot;
|
||||
},
|
||||
|
||||
destruct: function bv_destruct() {
|
||||
this._bookmarkService.removeObserver(this._changes);
|
||||
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||
if (StartUI.chromeWin) {
|
||||
StartUI.chromeWin.removeEventListener('MozAppbarDismissing', this, false);
|
||||
StartUI.chromeWin.removeEventListener('BookmarksNeedsRefresh', this, false);
|
||||
}
|
||||
},
|
||||
|
||||
handleItemClick: function bv_handleItemClick(aItem) {
|
||||
let url = aItem.getAttribute("value");
|
||||
StartUI.goToURI(url);
|
||||
@ -201,13 +210,6 @@ BookmarksView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
this._set.removeItemAt(index, this._inBatch);
|
||||
},
|
||||
|
||||
destruct: function bv_destruct() {
|
||||
this._bookmarkService.removeObserver(this._changes);
|
||||
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||
window.removeEventListener('MozAppbarDismissing', this, false);
|
||||
window.removeEventListener('BookmarksNeedsRefresh', this, false);
|
||||
},
|
||||
|
||||
doActionOnSelectedTiles: function bv_doActionOnSelectedTiles(aActionName, aEvent) {
|
||||
let tileGroup = this._set;
|
||||
let selectedTiles = tileGroup.selectedItems;
|
||||
|
@ -25,6 +25,15 @@ HistoryView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
_set: null,
|
||||
_toRemove: null,
|
||||
|
||||
destruct: function destruct() {
|
||||
this._historyService.removeObserver(this);
|
||||
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||
if (StartUI.chromeWin) {
|
||||
StartUI.chromeWin.removeEventListener('MozAppbarDismissing', this, false);
|
||||
StartUI.chromeWin.removeEventListener('HistoryNeedsRefresh', this, false);
|
||||
}
|
||||
},
|
||||
|
||||
handleItemClick: function tabview_handleItemClick(aItem) {
|
||||
let url = aItem.getAttribute("value");
|
||||
StartUI.goToURI(url);
|
||||
@ -90,13 +99,6 @@ HistoryView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
this._inBatch--;
|
||||
},
|
||||
|
||||
destruct: function destruct() {
|
||||
this._historyService.removeObserver(this);
|
||||
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||
window.removeEventListener('MozAppbarDismissing', this, false);
|
||||
window.removeEventListener('HistoryNeedsRefresh', this, false);
|
||||
},
|
||||
|
||||
addItemToSet: function addItemToSet(aURI, aTitle, aIcon, aPos) {
|
||||
let item = this._set.insertItemAt(aPos || 0, aTitle, aURI, this._inBatch);
|
||||
this._setContextActions(item);
|
||||
|
@ -39,6 +39,16 @@ TopSitesView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
// isUpdating used only for testing currently
|
||||
isUpdating: false,
|
||||
|
||||
destruct: function destruct() {
|
||||
Services.obs.removeObserver(this, "Metro:RefreshTopsiteThumbnail");
|
||||
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||
PageThumbs.removeExpirationFilter(this);
|
||||
NewTabUtils.allPages.unregister(this);
|
||||
if (StartUI.chromeWin) {
|
||||
StartUI.chromeWin.removeEventListener('MozAppbarDismissing', this, false);
|
||||
}
|
||||
},
|
||||
|
||||
handleItemClick: function tabview_handleItemClick(aItem) {
|
||||
let url = aItem.getAttribute("value");
|
||||
StartUI.goToURI(url);
|
||||
@ -214,13 +224,6 @@ TopSitesView.prototype = Util.extend(Object.create(View.prototype), {
|
||||
return prefs.getBoolPref("browser.firstrun.show.localepicker");
|
||||
},
|
||||
|
||||
destruct: function destruct() {
|
||||
Services.obs.removeObserver(this, "Metro:RefreshTopsiteThumbnail");
|
||||
Services.obs.removeObserver(this, "metro_viewstate_changed");
|
||||
PageThumbs.removeExpirationFilter(this);
|
||||
window.removeEventListener('MozAppbarDismissing', this, false);
|
||||
},
|
||||
|
||||
// nsIObservers
|
||||
observe: function (aSubject, aTopic, aState) {
|
||||
switch(aTopic) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user