Bug 768905 - Don't react to 'connecting' events when we're already connected. r=gal DONTBUILD

--HG--
extra : rebase_source : b285eb7d2d09721dc72031ae4ee3137e8d0e1f72
This commit is contained in:
Blake Kaplan 2012-06-27 17:09:16 +02:00
Родитель 664f618be3
Коммит 8902ae6e1f
1 изменённых файлов: 17 добавлений и 2 удалений

Просмотреть файл

@ -500,10 +500,22 @@ var WifiManager = (function() {
}
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) {
@ -744,8 +756,11 @@ var WifiManager = (function() {
// 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) {