author | Blake Kaplan <mrbkap@gmail.com> |
Wed, 27 Jun 2012 17:09:16 +0200 | |
changeset 97800 | cfd1ef196425b2b6981f3103f03ba2a596a6fd37 |
parent 97799 | 7ef9568fbd406af676c546f48d14763257fb2e1f |
child 97801 | c64440f55c79cff78f953ef06292da8036ac7e9e |
push id | 11227 |
push user | mrbkap@mozilla.com |
push date | Wed, 27 Jun 2012 15:53:52 +0000 |
treeherder | mozilla-inbound@cfd1ef196425 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | gal |
bugs | 768905 |
milestone | 16.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
|
--- a/dom/wifi/WifiWorker.js +++ b/dom/wifi/WifiWorker.js @@ -495,20 +495,32 @@ var WifiManager = (function() { if (handler) { if (!eventObject) eventObject = ({}); handler.call(eventObject); } } function notifyStateChange(fields) { + // If we're already in the COMPLETED state, we might receive events from + // the supplicant that tell us that we're re-authenticating or reminding + // us that we're associated to a network. In those cases, we don't need to + // do anything, so just ignore them. + if (manager.state === "COMPLETED" && + fields.state !== "DISCONNECTED" && + fields.state !== "INTERFACE_DISABLED" && + fields.state !== "INACTIVE" && + fields.state !== "SCANNING") { + return false; + } fields.prevState = manager.state; manager.state = fields.state; notify("statechange", fields); + return true; } function parseStatus(status, reconnected) { if (status === null) { debug("Unable to get wpa supplicant's status"); return; } @@ -739,18 +751,21 @@ var WifiManager = (function() { manager.connectionInfo.ssid = null; manager.connectionInfo.id = -1; return true; } if (eventData.indexOf("CTRL-EVENT-CONNECTED") === 0) { // Format: CTRL-EVENT-CONNECTED - Connection to 00:1e:58:ec:d5:6d completed (reauth) [id=1 id_str=] var bssid = eventData.split(" ")[4]; var id = eventData.substr(eventData.indexOf("id=")).split(" ")[0]; - notifyStateChange({ state: "CONNECTED", BSSID: bssid, id: id }); - onconnected(false); + + // Don't call onconnected if we ignored this state change (since we were + // already connected). + if (notifyStateChange({ state: "CONNECTED", BSSID: bssid, id: id })) + onconnected(false); return true; } if (eventData.indexOf("CTRL-EVENT-SCAN-RESULTS") === 0) { debug("Notifying of scan results available"); notify("scanresultsavailable"); return true; } // unknown event