зеркало из https://github.com/mozilla/gecko-dev.git
Fix leaks by removing preference observers. b=386665 r=tony@ponderer.org
This commit is contained in:
Родитель
1446a2ddd6
Коммит
f9254c5f95
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче