Permalink
Browse files

Bug 819947 - No WiFi networks detected during FTU experience. Add mor…

…e debug. r=vingtetun
  • Loading branch information...
1 parent 567878d commit f3de829f7e5c53cff3e81c7bc4c42d37203eb50b @mrbkap mrbkap committed with vingtetun Jan 7, 2013
Showing with 25 additions and 3 deletions.
  1. +1 −0 apps/communications/ftu/js/tutorial.js
  2. +1 −0 apps/communications/ftu/js/ui.js
  3. +23 −3 apps/communications/ftu/js/wifi.js
View
1 apps/communications/ftu/js/tutorial.js
@@ -54,6 +54,7 @@ var Tutorial = {
this.tutorialFinish.addEventListener('click', function ftuEnd() {
self.tutorialFinish.removeEventListener('click', ftuEnd);
+ WifiManager.finish();
window.close();
});
window.addEventListener('hashchange', this);
View
1 apps/communications/ftu/js/ui.js
@@ -82,6 +82,7 @@ var UIManager = {
});
this.skipTutorialButton.addEventListener('click', function() {
+ WifiManager.finish();
window.close();
});
this.letsGoButton.addEventListener('click', function() {
View
26 apps/communications/ftu/js/wifi.js
@@ -6,6 +6,11 @@ var WifiManager = {
if ('mozWifiManager' in window.navigator) {
this.api = window.navigator.mozWifiManager;
this.changeStatus();
+ // Ensure that wifi is on.
+ var lock = window.navigator.mozSettings.createLock();
+ this.enable(lock);
+ this.enableDebugging(lock);
+
this.gCurrentNetwork = this.api.connection.network;
if (this.gCurrentNetwork !== null) {
this.api.forget(this.gCurrentNetwork);
@@ -76,9 +81,24 @@ var WifiManager = {
callback(fakeNetworks);
}
},
- enable: function wn_enable(firstTime) {
- var settings = window.navigator.mozSettings;
- settings.createLock().set({'wifi.enabled': true});
+ enable: function wn_enable(lock) {
+ lock.set({'wifi.enabled': true});
+ },
+ enableDebugging: function wn_enableDebugging(lock) {
+ // For bug 819947: turn on wifi debugging output to help track down a bug
+ // in wifi. We turn on wifi output only while the FTU app is active.
+ this._prevDebuggingValue = false;
+ var req = lock.get('wifi.debugging.enabled');
+ req.onsuccess = function wn_getDebuggingSuccess() {
+ this._prevDebuggingValue = req.result['wifi.debugging.enabled'];
+ };
+ lock.set({ 'wifi.debugging.enabled': true });
+ },
+ finish: function wn_finish() {
+ if (!this._prevDebuggingValue) {
+ var resetLock = window.navigator.mozSettings.createLock();
+ resetLock.set({'wifi.debugging.enabled': false});
+ }
},
getNetwork: function wm_gn(ssid) {
var network;

0 comments on commit f3de829

Please sign in to comment.