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 190573 e574778a856384fea69bfd29b7d4ddcc7458960a
parent 190572 3da8eb5d5378405308796e4b1314f846c5e723dc
child 190574 f351db5f11896ea30eaa2d30634fadfd5d75dee7
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [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.