Bug 783976 - WiFi list can't displayed after enabling/disabling WiFi repeatedly. r=mrbkap
authorVincent Chang <vchang@mozilla.com>
Sun, 26 Aug 2012 22:29:46 -0400
changeset 103520 fe06529df13550deb4fa63b116e4d054a7750077
parent 103519 64980ac7c48b3fc1fe72c5830cdb42e4f819a2fc
child 103521 317b3811087c23c40d4f9e7673fda57bb28b9a09
push id23355
push userMs2ger@gmail.com
push dateMon, 27 Aug 2012 08:52:59 +0000
treeherdermozilla-central@5c49d6790357 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs783976
milestone17.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 783976 - WiFi list can't displayed after enabling/disabling WiFi repeatedly. r=mrbkap
dom/wifi/WifiWorker.js
--- a/dom/wifi/WifiWorker.js
+++ b/dom/wifi/WifiWorker.js
@@ -891,21 +891,21 @@ var WifiManager = (function() {
       });
     }
 
     setProperty("ctl.stop", "wpa_supplicant", tick);
   }
 
   function didConnectSupplicant(reconnected, callback) {
     waitForEvent();
-    notify("supplicantconnection");
 
     // Load up the supplicant state.
     statusCommand(function(status) {
       parseStatus(status, reconnected);
+      notify("supplicantconnection");
       callback();
     });
   }
 
   function prepareForStartup(callback) {
     // First, check to see if there's a wpa_supplicant running that we can
     // connect to.
     getProperty(SUPP_PROP, "stopped", function (value) {
@@ -1940,17 +1940,17 @@ WifiWorker.prototype = {
 
         break;
       }
     }
   },
 
   getNetworks: function(msg) {
     const message = "WifiManager:getNetworks:Return";
-    if (WifiManager.state === "UNINITIALIZED") {
+    if (!WifiManager.enabled) {
       this._sendMessage(message, false, "Wifi is disabled", msg);
       return;
     }
 
     this.waitForScan((function (networks) {
       this._sendMessage(message, networks !== null, networks, msg);
     }).bind(this));
     WifiManager.scan(true, function() {});
@@ -2018,17 +2018,17 @@ WifiWorker.prototype = {
     if (this._stateRequests.length === 1)
       WifiManager.setWifiEnabled(msg.enabled, this._setWifiEnabledCallback.bind(this));
   },
 
   associate: function(msg) {
     const MAX_PRIORITY = 9999;
     const message = "WifiManager:associate:Return";
     let network = msg.data;
-    if (WifiManager.state === "UNINITIALIZED") {
+    if (!WifiManager.enabled) {
       this._sendMessage(message, false, "Wifi is disabled", msg);
       return;
     }
 
     let privnet = network;
     let self = this;
     function networkReady() {
       // saveConfig now before we disable most of the other networks.
@@ -2088,17 +2088,17 @@ WifiWorker.prototype = {
         networkReady();
       }).bind(this));
     }
   },
 
   forget: function(msg) {
     const message = "WifiManager:forget:Return";
     let network = msg.data;
-    if (WifiManager.state === "UNINITIALIZED") {
+    if (!WifiManager.enabled) {
       this._sendMessage(message, false, "Wifi is disabled", msg);
       return;
     }
 
     let ssid = network.ssid;
     if (!(ssid in this.configuredNetworks)) {
       this._sendMessage(message, false, "Trying to forget an unknown network", msg);
       return;