Bug 972628 - Remove redundant network while loading network config. r=vchang
authorChuck Lee <chulee@mozilla.com>
Mon, 10 Mar 2014 16:48:13 +0800
changeset 173416 e574778a856384fea69bfd29b7d4ddcc7458960a
parent 173415 3da8eb5d5378405308796e4b1314f846c5e723dc
child 173417 f351db5f11896ea30eaa2d30634fadfd5d75dee7
push id41000
push userryanvm@gmail.com
push dateThu, 13 Mar 2014 19:35:12 +0000
treeherdermozilla-inbound@6247f6502793 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvchang
bugs972628
milestone30.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 972628 - Remove redundant network while loading network config. r=vchang
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -2299,27 +2299,32 @@ WifiWorker.prototype = {
         return;
       }
 
       this._highestPriority = -1;
 
       // Convert between netId-based and ssid-based indexing.
       for (let net in networks) {
         let network = networks[net];
+        delete networks[net];
+
         if (!network.ssid) {
-          delete networks[net]; // TODO support these?
+          WifiManager.removeNetwork(network.netId, function() {});
           continue;
         }
 
         if (network.priority && network.priority > this._highestPriority)
           this._highestPriority = network.priority;
 
         let networkKey = getNetworkKey(network);
+        // Accept latest config of same network(same SSID and same security).
+        if (networks[networkKey]) {
+          WifiManager.removeNetwork(networks[networkKey].netId, function() {});
+        }
         networks[networkKey] = network;
-        delete networks[net];
       }
 
       this.configuredNetworks = networks;
       callback(true);
     }).bind(this));
   },
 
   // Important side effect: calls WifiManager.saveConfig.