Bug 371667. When checking autodial status to see if we should put the browser offline, check whether a dial number is actually configured and allow the browser to go offline if no number is configured. r+sr=biesi, patch by Chris Double

This commit is contained in:
roc+%cs.cmu.edu 2007-03-20 01:58:19 +00:00
Родитель 15e056867b
Коммит e3d0dcf50a
3 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -70,6 +70,10 @@
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
#if defined(XP_WIN)
#include "nsNativeConnectionHelper.h"
#endif
#define PORT_PREF_PREFIX "network.security.ports."
#define PORT_PREF(x) PORT_PREF_PREFIX x
#define AUTODIAL_PREF "network.autodial-helper.enabled"
@ -913,10 +917,21 @@ nsIOService::TrackNetworkLinkStatusForOffline()
if (mSocketTransportService) {
PRBool autodialEnabled = PR_FALSE;
mSocketTransportService->GetAutodialEnabled(&autodialEnabled);
// If autodialing-on-link-down is enabled, then pretend the link is
// If autodialing-on-link-down is enabled, check if the OS auto dial
// option is set to always autodial. If so, then we are
// always up for the purposes of offline management.
if (autodialEnabled)
if (autodialEnabled) {
#if defined(XP_WIN)
// On Windows, need to do some registry checking to see if
// autodial is enabled at the OS level. Only if that is
// enabled are we always up for the purposes of offline
// management.
if(nsNativeConnectionHelper::IsAutodialEnabled())
return SetOffline(PR_FALSE);
#else
return SetOffline(PR_FALSE);
#endif
}
}
PRBool isUp;

Просмотреть файл

@ -53,3 +53,11 @@ nsNativeConnectionHelper::OnConnectionFailed(const char* hostName)
else
return PR_FALSE;
}
PRBool
nsNativeConnectionHelper::IsAutodialEnabled()
{
nsRASAutodial autodial;
return autodial.Init() == NS_OK && autodial.ShouldDialOnNetworkError();
}

Просмотреть файл

@ -51,6 +51,13 @@ public:
* Return PR_TRUE if the connection should be re-attempted.
*/
static PRBool OnConnectionFailed(const char* hostName);
/**
* IsAutoDialEnabled
*
* Return PR_TRUE if autodial is enabled in the operating system.
*/
static PRBool IsAutodialEnabled();
};
#endif // !nsNativeConnectionHelper_h__