Bug 791910 - Deal with dead managers in our list. r=cjones
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 18 Sep 2012 16:50:53 -0700
changeset 107553 ff173f01271596b70cdbafe68e5f935328f6f076
parent 107552 8c813f40ea4edb31135712f80c5a574f6a456889
child 107554 6c85aa92f4abc466790c728997d435cc5c7cab8f
push id23490
push userMs2ger@gmail.com
push dateThu, 20 Sep 2012 11:22:06 +0000
treeherdermozilla-central@6a2d1a3556b9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscjones
bugs791910
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 791910 - Deal with dead managers in our list. r=cjones
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -1943,18 +1943,25 @@ WifiWorker.prototype = {
       }
     }
   },
 
   // nsIWifi
 
   _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;
+      }
     });
   },
 
   _sendMessage: function(message, success, data, msg) {
     msg.manager.sendAsyncMessage(message + (success ? ":OK" : ":NO"),
                                  { data: data, rid: msg.rid, mid: msg.mid });
   },