Closed Bug 806965 Opened 10 years ago Closed 10 years ago

B2G Network Manager: navigator.onLine starts true even if false


(Firefox OS Graveyard :: General, defect, P3)



(blocking-basecamp:+, firefox18 fixed)

blocking-basecamp +
Tracking Status
firefox18 --- fixed


(Reporter: ranbena, Assigned: mrbkap)


(Depends on 1 open bug)



(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4

Steps to reproduce:

Once the device boots and connection is offline by default

Actual results:

navigator.onLine returns true

Expected results:

navigator.onLine returns false.

Only after connecting and disconnecting does the property return false as expected.
blocking-basecamp: --- → ?
Ever confirmed: true
blocking-basecamp: ? → +
Priority: -- → P3
Does this impact WiFi connections for users or is it just the flag that is off?
Just a flag
It's critical though to Evme.
When Evme thinks it's connected but really isn't - neither results nor an appropriate message are displayed.
Fixing this is also needed for FB integration. UX has advised to disable FB options is the user is not onLine.
Blocks: 808534
Assignee: nobody → mrbkap
(In reply to Ran Ben Aharon ( from comment #2)
> Just a flag

This is exactly a flag but also a HTML5 feature. With navigator.onLine the web gains the status of network connection and then could do something specially if they knows they are at offline mode now.
Many thanks to Andrea for helping me look at this yesterday.
Attached patch Proposed fixSplinter Review
The actual fix here is pretty straightforward: nsIOService assumes that we're online until told otherwise. Bug 552829 added notifications to tell child processes that when the online/offline state changed, however didn't do anything to initialize the state on process startup.

There are two questions of taste to address though: is calling a Recv method directly poor form? I named the new state getter pretty generically. I could rename it to something more specific until we're sure we have to add other stuff to it.
Attachment #679803 - Flags: review?(justin.lebar+bug)
Comment on attachment 679803 [details] [diff] [review]
Proposed fix

Written just for you:

Anyway, this seems fine to me.  Maybe ask cjones if he's OK delegating the review to me?  I don't have explicit review powers here.
Attachment #679803 - Flags: review?(justin.lebar+bug) → review+
(I spoke to cjones and he was fine with jlebar reviewing here).
Closed: 10 years ago
Resolution: --- → FIXED
Blocks: 869384
Depends on: 956228
You need to log in before you can comment on or make changes to this bug.