Closed Bug 766497 Opened 12 years ago Closed 12 years ago

wifiManager.enabled value is not "synced" across the frame

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: timdream, Assigned: mrbkap)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #764682 +++

STR:

1. Install latest Gaia
2. Go to Settings app, try to turn on or off wifi
3. Pull down the Utility Tray from the status bar
4. Observe the Quick Setting buttons of Wifi

Expected:

1. Each time you pull down the tray, the button will sync it's status with wifiManager.enabled. It should be either red or green depend on the same toggle button on Settings app.

Actual:

1. the button will always stay Off or On (red or green) no matter what you do. You can actually get wifiManager.connection.status = 'connected' but wifiManager.enabled = false!

PS:

The reverse does not apply since Settings app use different values to check the status of wifiManager, and you can effectively "sync" the value by kill the Settings app and launch it again.
Attached patch Proposed fix (deleted) — Splinter Review
Getting the "multiple requests at the same time" code was tricky... I have tested this to the best of my ability, and the gaia code will have to take advantage of the new notifications itself.

With this patch, calls to setEnabled will send *two* notifications (one with the request and the event). I'm not terribly happy with that, but given that the request to setEnabled can fail, there is no better solution.
Assignee: nobody → mrbkap
Status: NEW → ASSIGNED
Attachment #637436 - Flags: review?(bent.mozilla)
Attachment #637436 - Flags: review?(bent.mozilla) → review?(gal)
Comment on attachment 637436 [details] [diff] [review]
Proposed fix

Review of attachment 637436 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/wifi/WifiWorker.js
@@ +864,4 @@
>  
>    // Public interface of the wifi service
>    manager.setWifiEnabled = function(enable, callback) {
> +    if ((enable && manager.enabled) ||

enable == manager.enabled
Attachment #637436 - Flags: review?(gal) → review+
https://hg.mozilla.org/mozilla-central/rev/ff38bb1bce5a and
http://hg.mozilla.org/mozilla-central/rev/9c6ad99de47a
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
I'm getting the following in my logcat:

E/GeckoConsole(  252): [JavaScript Error: "enabled is not defined" {file: "jar:file:///system/b2g/omni.ja!/components/WifiWorker.js" line: 867}]

Should the 'enable' in this patch have been 'enabled'?
By "this patch" I mean this commit that landed: http://hg.mozilla.org/mozilla-central/rev/9c6ad99de47a
https://hg.mozilla.org/mozilla-central/rev/155f67c2c578 fixes comment 4. Thanks for pointing it out.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: