Last Comment Bug 620472 - "Work offline" shouldn't be managed by Firefox, only by the user
: "Work offline" shouldn't be managed by Firefox, only by the user
Status: RESOLVED FIXED
:
Product: Firefox
Classification: Client Software
Component: General (show other bugs)
: Trunk
: All All
: -- normal with 4 votes (vote)
: Firefox 4.0b11
Assigned To: Frank Yan (:fryn)
:
Mentors:
: 502659 (view as bug list)
Depends on: 565564 598719 87717 88218 627332 636148 644035 720320
Blocks: cuts-cruft 578009 631885
  Show dependency treegraph
 
Reported: 2010-12-20 12:17 PST by Alex Limi (:limi) — Firefox UX Team
Modified: 2014-10-27 06:21 PDT (History)
26 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
-


Attachments
patch (1.06 KB, patch)
2010-12-20 12:22 PST, Frank Yan (:fryn)
roc: review+
mbeltzner: approval2.0+
Details | Diff | Splinter Review
Startup dialog erroneously reporting offline (39.34 KB, image/png)
2011-01-11 12:05 PST, Frank Yan (:fryn)
no flags Details
hg export of above patch (1.31 KB, text/plain)
2011-01-18 16:40 PST, Frank Yan (:fryn)
no flags Details

Description Alex Limi (:limi) — Firefox UX Team 2010-12-20 12:17:47 PST
So, I had no idea that we have a preference for this, but we do. 

Right now, Firefox tries to guess whether you are offline, and frequently gets it wrong. I posit that the only people that really want/need the offline mode are fine with triggering it manually.

To do this, we should flip network.manage-offline-status to "False", so Firefox
doesn't do this for you without you asking for it.

I'm fine with shipping with Work Offline available in a menu (for now), but I don't think we should do it for you automatically. That's what I'm trying to fix with this bug. :)
Comment 1 Frank Yan (:fryn) 2010-12-20 12:22:41 PST
Created attachment 498800 [details] [diff] [review]
patch

Explicitly sets the pref to false.
Comment 2 :Gavin Sharp [email: gavin@gavinsharp.com] 2010-12-20 12:34:40 PST
Offline support isn't just a convenience thing, there are web-exposed APIs that make use of that state. I think it's a bit premature to give up on the idea of autodetection because it sometimes causes issues - ideally we should try to figure out what those issues are...
Comment 3 Frank Yan (:fryn) 2010-12-20 12:38:48 PST
(In reply to comment #2)

Oh true. I forgot about this:
https://developer.mozilla.org/en/online_and_offline_events
It looks like there's code out there that uses these. :\
Comment 4 Frank Yan (:fryn) 2010-12-21 17:38:36 PST
Unassigning self until API implications are resolved.
Comment 5 Frank Yan (:fryn) 2011-01-07 16:00:36 PST
The navigator.onLine property seems to be highly unreliable already, and I couldn't find any case where it breaks due to navigator.onLine over-reporting itself as true.

By fixing this bug, we still conform to the HTML5 spec described here:
http://www.whatwg.org/specs/web-apps/current-work/#browser-state
Comment 6 Frank Yan (:fryn) 2011-01-07 16:24:59 PST
(In reply to comment #2)
> Offline support isn't just a convenience thing, there are web-exposed APIs that
> make use of that state. I think it's a bit premature to give up on the idea of
> autodetection because it sometimes causes issues - ideally we should try to
> figure out what those issues are...

We aren't giving up the idea. We're just disabling autodetection until we can make it reliable, which is an adjective we could not truthfully use to describe it now.
Comment 7 Alex Limi (:limi) — Firefox UX Team 2011-01-07 16:42:56 PST
To summarize:

* We shouldn't let our broken detection of online/offline potentially get our entire user base inconvenienced to support a few web apps out there that make use of this
* No other browser is supporting autodetection of this at the moment
* We aren't removing Work Offline, you can still trigger it if you have use for it
* The offline spec doesn't require any autodetection

I'm going to request blocking for this because:

* This is one of the top ten papercut issues identified frior to Firefox 4
* It has a patch that just changes one of our default settings
* We shouldn't let the edge case of detecting offline and magically setting the user as offline when our code to do this is known to be deficient. We can reconsider enabling the autodetection when we are confident that it actually works.
Comment 8 Dietrich Ayala (:dietrich) 2011-01-10 11:44:42 PST
This is a long-standing papercut that we've shipped with before. We should not hold back Firefox 4 on fixing it now. Blocking-. If the patch gets completed and reviewed and tryserver'd, then maybe ask for approval on it?
Comment 9 Frank Yan (:fryn) 2011-01-11 11:56:50 PST
(In reply to comment #8)

Patch completed and passed all non-random-orange tests on tryserver!
Comment 10 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-01-11 12:02:24 PST
Comment on attachment 498800 [details] [diff] [review]
patch

I would like to know what the issues with autodetection are. AFAIK it defaults to "online" in the cases where it's uncertain/wrong ... erroneously reporting "offline" should be rare.
Comment 11 Frank Yan (:fryn) 2011-01-11 12:05:59 PST
Created attachment 502886 [details]
Startup dialog erroneously reporting offline

I just started up Minefield and found this. I was connected to wifi, with two other browsers (Firefox 4 beta 8 and Chrome) loading pages from the network normally.
Comment 12 Ben Bucksch (:BenB) 2011-01-11 12:10:53 PST
Recently, we had a bug that we started as offline when the network manager is not available, fixed in bug 616520 and bug 617389.
Comment 13 Frank Yan (:fryn) 2011-01-11 12:16:59 PST
(In reply to comment #12)
> Recently, we had a bug that we started as offline when the network manager is
> not available, fixed in bug 616520 and bug 617389.

This seems to be neither of those bugs, as I'm building a tip-of-tree (as of yesterday) Minefield without any special compile-time flags.
Comment 14 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-01-11 12:34:22 PST
Comment on attachment 498800 [details] [diff] [review]
patch

Actually I changed my mind here.

If autodetection is unreliable, the correct solution is to fix it or disable it on the platform(s) where it's unreliable. Frank says it's unreliable on Mac, so we should disable it there and file a new bug to make it reliable and reenable it. That's what we did for NetworkManager on Linux. Do we have reports of it being unreliable on Windows?

Note that the autodetection code is allowed to report "unknown" anytime it wants:
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsINetworkLinkService.idl
so "reliable" just means "don't report 'online' or 'offline' unless you're really sure".
Comment 15 Alex Limi (:limi) — Firefox UX Team 2011-01-11 12:49:31 PST
I see it being unreliable on Windows setups at home all the time. Some of the Dell laptops there have somewhat flaky wifi cards, and every once in a while FF drops into offline mode, and doesn't come back out.

Not sure what else I can do to convince you here, I still think this hurts a lot of users for very marginal side benefits (especially since we're keeping Work Offline, just disabling the autodetect).
Comment 16 Alex Limi (:limi) — Firefox UX Team 2011-01-11 12:50:43 PST
See Input, for example:

https://input.mozilla.com/en-US/search/?product=firefox&q=offline

Net usually disconnects while browsing. firefox goes in offline mode. When refresh page, remains offline . I have to restart to connect.

(13 hours ago, Windows XP English (US))
Comment 17 Alex Limi (:limi) — Firefox UX Team 2011-01-11 12:56:33 PST
To cover the variants, sorry for not including them in the previous comment:

"Firefox is in "offline" mode and I can't continue surfing the web :("
(1 day ago, Windows 7, English (US))

"I put my computer to sleep last night. I woke it up this morning. Firefox was in offline mode. I never put it offline mode."
(3 days ago, Windows 7, English (US))

"every other time i open it, it say try again, working offline. not cool! i need to work... and i have wi-fi !"
(5 days ago, Windows XP, English (US))
Comment 18 :Gavin Sharp [email: gavin@gavinsharp.com] 2011-01-11 16:01:08 PST
Do we have any indication that flipping this pref solves the problems?
Comment 19 Frank Yan (:fryn) 2011-01-11 16:24:49 PST
(In reply to comment #18)
> Do we have any indication that flipping this pref solves the problems?

Yes; flipping the pref prevents Firefox from automatically putting itself in Work Offline mode without the user explicitly doing so, e.g. from the File menu.
Comment 20 :Gavin Sharp [email: gavin@gavinsharp.com] 2011-01-11 17:04:21 PST
(In reply to comment #19)
> Yes; flipping the pref prevents Firefox from automatically putting itself in
> Work Offline mode without the user explicitly doing so, e.g. from the File
> menu.

I know that it does that theoretically, but what if there are other bugs that cause these symptoms to occur, that aren't related to link autodetection? Has someone who regularly sees this problem confirmed that things improved with the pref flipped?
Comment 21 Frank Yan (:fryn) 2011-01-11 17:11:20 PST
(In reply to comment #20)

According to the comments for the following add-on that simply exposes this hidden pref, yes.
https://addons.mozilla.org/addon/13152/
Comment 22 Alex Faaborg [:faaborg] (Firefox UX) 2011-01-11 17:33:00 PST
>I see it being unreliable on Windows setups at home all the time. Some of the
>Dell laptops there have somewhat flaky wifi cards, and every once in a while FF
>drops into offline mode, and doesn't come back out.

This is the same as my experience, it reliably goes into offline mode (the connection has in fact dropped), but it doesn't bring itself back out of it when the connection is back, it just provides the user with information about how they can go to a menu and try to manually re-enable it.
Comment 23 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-01-12 01:12:08 PST
Why don't we just disable all the auto-detection code if all the platform interfaces are unreliable?
Comment 24 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-01-12 01:14:20 PST
I mean, there's no point in even building the implementations of nsINetworkLinkService in netwerk/system if they're all too unreliable to use.
Comment 25 Alex Limi (:limi) — Firefox UX Team 2011-01-12 01:32:06 PST
Fair enough, I don't know what the best / least risky option is. Happy with any of the approaches if the end result is the same, and it lands. :)
Comment 26 Alex Limi (:limi) — Firefox UX Team 2011-01-12 01:34:00 PST
(and whether any other code uses nsINetworkLinkService and would break)
Comment 27 Robert O'Callahan (:roc) (Exited; email my personal email if necessary) 2011-01-12 01:36:17 PST
If any other code uses nsINetworkLinkService, presumably it gets horked too when the service produces incorrect results.

But I think for now we should just use the pref. That way people can turn it back on again if they actually need this feature. And we can turn it on for testing if/when we want to fix the bugs in the link detection.
Comment 28 Alex Limi (:limi) — Firefox UX Team 2011-01-12 01:40:55 PST
(In reply to comment #27)
> But I think for now we should just use the pref. That way people can turn it
> back on again if they actually need this feature. And we can turn it on for
> testing if/when we want to fix the bugs in the link detection.

…aka. review+? ;)
Comment 29 Alex Limi (:limi) — Firefox UX Team 2011-01-12 11:38:31 PST
Comment on attachment 498800 [details] [diff] [review]
patch

Asking for approval to land this now that beta9 is tagged.
Comment 30 Mike Beltzner [:beltzner, not reading bugmail] 2011-01-15 19:23:51 PST
Comment on attachment 498800 [details] [diff] [review]
patch

a=beltzner
Comment 31 Frank Yan (:fryn) 2011-01-18 16:40:54 PST
Created attachment 504904 [details]
hg export of above patch
Comment 32 Boris Zbarsky [:bz] 2011-01-18 21:32:13 PST
Pushed http://hg.mozilla.org/mozilla-central/rev/c0547fd3a3cc
Comment 33 Martin Stránský 2011-01-20 05:53:34 PST
The network detection works as expected on Linux/3.6.x. It's enabled by default in Fedora and we don't have reported any issues. 

But the nsNetworkManagerListener component is broken in beta9,
nsNetworkManagerListener is not registered so:

mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID);

always return NULL.
Comment 34 Henrik Skupin (:whimboo) 2011-01-20 08:06:21 PST
Could that be the reason of bug 627332?
Comment 35 Martin Stránský 2011-01-20 08:12:25 PST
(In reply to comment #34)
> Could that be the reason of bug 627332?

I don't think so. When mNetworkLinkService is NULL, firefox does not manage online/offline status and starts online by default, see:

http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/nsIOService.cpp#271
Comment 36 Alex Limi (:limi) — Firefox UX Team 2011-01-20 09:51:19 PST
(In reply to comment #33)
> The network detection works as expected on Linux/3.6.x. It's enabled by default
> in Fedora and we don't have reported any issues. 

Automatically putting you offline has other issues, like taking localhost offline too — this change just disables the autodetection until we have figured out the edge cases that we're currently not handling, since the bad behavior is confusing and affecting people right now. It's also notoriously unreliable on both OS X and Windows in my personal experience, Linux might be better here.

> But the nsNetworkManagerListener component is broken in beta9,
> nsNetworkManagerListener is not registered so:
> 
> mNetworkLinkService = do_GetService(NS_NETWORK_LINK_SERVICE_CONTRACTID);
> 
> always return NULL.

Interesting. Can you file a separate bug for that?
Comment 37 Helder "Lthere" Magalhães 2011-01-20 14:28:31 PST
(In reply to comment #36)
> Automatically putting you offline has other issues, like taking localhost
> offline too [...]

Yup, the issue that's been annoying me for a while until I've found this issue. Trying to develop applications in a local web server and every now and then noticing things break just because I temporarily fully disconnected from the network (no ethernet cable nor wireless, during a network environment changeover - like home to company or the way around) feels just broken, although I could thing of good reasons for this to happen for the average user.

Even when the issues are reduced, adding a user preference to allow disabling the automatic toggle would be nice (if it doesn't exist already).
Comment 38 Alex Limi (:limi) — Firefox UX Team 2011-01-20 14:30:37 PST
(In reply to comment #37)
> Even when the issues are reduced, adding a user preference to allow disabling
> the automatic toggle would be nice (if it doesn't exist already).

That's what we did. There's a toggle for making Firefox automatically manage it for you, and we turned that off by default — so you can turn it on if you want it. :)
Comment 39 Martin Stránský 2011-01-21 02:28:36 PST
The nsNetworkManagerListener registration bug is filed as Bug 627672
Comment 40 :Gavin Sharp [email: gavin@gavinsharp.com] 2011-01-21 11:14:33 PST
I backed this out to address bug 627332 for beta 10.
Comment 41 Brett 2011-01-27 00:04:16 PST
I see auto online/offline fail in Firefox fail for me often in Windows 7 on my Laptop.

I setup PABX's through their web interfaces with my laptop I drag around site to site. Lots of PABX's have various issues with different browsers forcing you to remember what current browser works for what settings page.

Anyways:
1)take laptop to some random network and connect to LAN
2)static assign or DHCP get an IP/gateway
3)due to local security measures on network the laptop is unable to connect to the internet. Could be any number or random security measures local IT has put in place. Network icon in Windows systray shows with yellow exclamation mark noting the issue with accessing the WAN.
4)navigate to local PABX address in browser eg 10.10.10.2
5)Windows requests for dialup to my default dialup account previously set
6)ignore dialup window, moving simply out of view and configuration of PABX on 10.10.10.2 works fine
OR
6)close/cancel or click "work offline" for dialup request, all putting the machine into "offline" mode. Config on 10.10.10.2 is impossible with any browser until taken out of offline mode.

I think this issue stems from some Windows bug as the same thing affects IE8 exactly the same.

This annoys me at least several times a month.
Comment 42 Frank Yan (:fryn) 2011-01-27 16:24:37 PST
Pushed again.

https://hg.mozilla.org/mozilla-central/rev/81d830ef76fd
Comment 43 Louis-Rémi BABE 2011-04-20 07:35:10 PDT
This property has been switched to false, waiting for the online/offline detection to be fixed.
I'm wondering if we should reopen bug 426932 then: "navigator.onLine doesn't correctly update when network connectivity changes".
Comment 45 marcusjt 2012-07-16 12:08:24 PDT
See also https://bugzilla.mozilla.org/show_bug.cgi?id=756364
Comment 46 Nickolay_Ponomarev 2014-10-26 11:15:32 PDT
*** Bug 502659 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.