Comment 25 for bug 367531

Revision history for this message
In , Adam Dane (unusualtears) wrote :

Created attachment 573692
Implements offline-mode with respect for loopback.

This doesn't give network zones, but it does rework offline mode to let loopback stay live.

It's not completely network-silent, as DNS requests are still attempted (and succeed if the network is available). Suggestions welcome.

The changes:

 + nsIOService no longer shuts down DNS and the socket service when going offline, it only does that on shutdown. Needs a few more changes, about what observers to notify and when.

 + nsHttpChannel no longer allows only cached pages to load. Non-local pages in cache should still load from cache.

 + nsSocketTransport2 will now balk (with NS_ERROR_OFFLINE) if offline and the address isn't loopback.

 + nsHttpHandler now observes the NS_IOSERVICE_GOING_OFFLINE_TOPIC and clears existing connections (otherwise, after going offline you could load pages only from domains with reusable connections). This was not needed for FTP, as it already did that. Not sure, but probably will be needed for websockets?

 + NSPRPUB's PR_IsNetAddrType() needed to modify its checks for IPv4 loopback prefix rather than for just the typical address of 127.0.0.1