Skip to content
Browse files

Bug 823783 - Handle various combinations of settings events and wifi …

…events more correctly.
  • Loading branch information...
1 parent 6eaab8f commit d029e72b4798972c7ac3dca1afe351801301f2c0 @mrbkap mrbkap committed Jan 9, 2013
Showing with 21 additions and 2 deletions.
  1. +21 −2 apps/settings/js/wifi.js
View
23 apps/settings/js/wifi.js
@@ -81,14 +81,33 @@ onLocalized(function wifiSettings() {
};
gWifiManager.onenabled = function onWifiEnabled() {
- // enable UI toogle
+ // enable UI toggle
+ if (!lastMozSettingValue) {
+ // Wifi just came up, but the last known value of the setting was false.
+ // This either means that some external force turned it on (in which
+ // case we need to update the setting) or we simply haven't received the
+ // settings change event. Do that now and update our
+ // lastMozSettingValue. This will have the side-effect of not disabling
+ // the checkbox.
+ settings.createLock().set({ 'wifi.enabled': true });
+ lastMozSettingValue = true;
+ setMozSettingsEnabled(lastMozSettingValue);
+ }
+
gWifiCheckBox.disabled = false;
updateNetworkState();
gNetworkList.scan();
};
gWifiManager.ondisabled = function onWifiDisabled() {
- // enable UI toogle
+ // enable UI toggle
+ if (lastMozSettingValue) {
+ // See the comment in onWifiEnabled for why we do this.
+ settings.createLock().set({ 'wifi.enabled': false });
+ lastMozSettingValue = false;
+ setMozSettingsEnabled(lastMozSettingValue);
+ }
+
gWifiCheckBox.disabled = false;
gWifiInfoBlock.textContent = _('disabled');
gNetworkList.clear(false);

0 comments on commit d029e72

Please sign in to comment.
Something went wrong with that request. Please try again.