Fix leaks by removing preference observers. b=386665 r=tony@ponderer.org

This commit is contained in:
dbaron@dbaron.org 2007-07-09 13:53:01 -07:00
Родитель 1446a2ddd6
Коммит f9254c5f95
2 изменённых файлов: 12 добавлений и 0 удалений

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

@ -174,6 +174,7 @@ PROT_PhishingWarden.prototype.QueryInterface = function(iid) {
* Cleanup on shutdown.
*/
PROT_PhishingWarden.prototype.shutdown = function() {
this.prefs_.removeAllObservers();
this.progressListener_.callback = null;
this.progressListener_ = null;
this.listManager_ = null;

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

@ -209,6 +209,17 @@ G_Preferences.prototype.removeObserver = function(which, callback) {
this.prefs_.removeObserver(which, observer);
}
/**
* Remove all preference observers registered through this object.
*/
G_Preferences.prototype.removeAllObservers = function() {
for (var which in this.observers_) {
for each (var observer in this.observers_[which].observers) {
this.prefs_.removeObserver(which, observer);
}
}
this.observers_ = {};
}
/**
* Helper class that knows how to observe preference changes and