Bug 791910 - Deal with dead managers in our list. r=cjones

--HG--
extra : rebase_source : 3a3bda33a7cecd7336b84ad4939aa55de2e5d0dd
This commit is contained in:
Blake Kaplan 2012-09-18 16:50:53 -07:00
Родитель af1edb60ea
Коммит 74f0b6aa6b
1 изменённых файлов: 9 добавлений и 2 удалений

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

@ -1948,8 +1948,15 @@ WifiWorker.prototype = {
_domManagers: [],
_fireEvent: function(message, data) {
this._domManagers.forEach(function(obj) {
obj.manager.sendAsyncMessage("WifiManager:" + message, data);
// TODO (bug 791911): Managers don't correctly tell us when they're getting
// destroyed, so prune dead managers here.
this._domManagers = this._domManagers.filter(function(obj) {
try {
obj.manager.sendAsyncMessage("WifiManager:" + message, data);
return true;
} catch(e) {
return false;
}
});
},