Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21093 from chuck-lee/bug-1010252_reconnect_issue_1.4
Browse files Browse the repository at this point in the history
Bug 1010252 - Only forget connectingfail network triggered by user. r=ejchen a=1.3+
  • Loading branch information
rvandermeulen committed Jul 7, 2014
2 parents 5c9e1e4 + 6064bf8 commit bef41d5
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions apps/settings/js/wifi.js
Expand Up @@ -979,19 +979,44 @@ navigator.mozL10n.ready(function wifiSettings() {
// update network state, called only when wifi enabled.
function updateNetworkState() {
var networkStatus = gWifiManager.connection.status;
/**
* gCurrentNetwork : user activated current network
* gWifiManager.connection.network : system activated current network
*
* Main difference between |gCurrentNetwork| and |gWifiManager.connection.
* network| is that we can't tell if network is known while connecting by
* |gWifiManager.connection.network.known| because it will always be true.
* Instead, we use |gCurrentNetwork| to indicate if current connecting
* network is new or known network.
*
* When system connect to network by user's tap on UI, |gCurrentNetwork|
* will point to same network as |gWifiManager.connection.network|.
* On the other hand, if system connect to network automatically under
* conditions like wifi enable, move into AP's range, or reconnect to
* other network after delete current connected network, |gCurrentNetwork|
* will be null, while |gWifiManager.connection.network| contains
* information about current network.
*/
var currentNetwork = gCurrentNetwork || gWifiManager.connection.network;
var networkProp = currentNetwork ? {ssid: currentNetwork.ssid} : null;

// networkStatus has one of the following values:
// connecting, associated, connected, connectingfailed, disconnected.
gNetworkList.display(gCurrentNetwork, networkStatus);
gNetworkList.display(currentNetwork, networkStatus);

gWifiInfoBlock.textContent =
_('fullStatus-' + networkStatus, gWifiManager.connection.network);
_('fullStatus-' + networkStatus, networkProp);

if (networkStatus === 'connectingfailed' && gCurrentNetwork) {
settings.createLock().set({'wifi.connect_via_settings': false});
// connection has failed, probably an authentication issue...
delete(gCurrentNetwork.password);
gWifiManager.forget(gCurrentNetwork); // force a new authentication dialog
if (gCurrentNetwork.known === false) {
// Connection fail on user-activated unknown network, should be wrong
// password, delete network and force a new authentication dialog.
delete(gCurrentNetwork.password);
gWifiManager.forget(gCurrentNetwork);
}
gCurrentNetwork = null;
} else if (networkStatus === 'disconnected') {
gCurrentNetwork = null;
}

Expand Down

0 comments on commit bef41d5

Please sign in to comment.