Bug 646412 - After Connection is established on MeeGo. Browser shows Error Page. r=wolfiR

This commit is contained in:
Oleg Romashin 2011-05-07 11:27:13 +03:00
Родитель ceb21144c4
Коммит 46e3ef201d
4 изменённых файлов: 38 добавлений и 14 удалений

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

@ -61,7 +61,7 @@ nsAutodial::Init()
nsresult
nsAutodial::DialDefault(const PRUnichar* hostName)
{
if (gQtNetworkManager->openConnection(QString::fromUtf16(hostName))) {
if (nsQtNetworkManager::get()->openConnection(QString::fromUtf16(hostName))) {
return NS_OK;
}
@ -71,7 +71,7 @@ nsAutodial::DialDefault(const PRUnichar* hostName)
PRBool
nsAutodial::ShouldDialOnNetworkError()
{
if (gQtNetworkManager->isOnline()) {
if (nsQtNetworkManager::get()->isOnline()) {
return PR_FALSE;
}

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

@ -58,14 +58,14 @@ nsQtNetworkLinkService::~nsQtNetworkLinkService()
NS_IMETHODIMP
nsQtNetworkLinkService::GetIsLinkUp(PRBool* aIsUp)
{
*aIsUp = gQtNetworkManager->isOnline();
*aIsUp = nsQtNetworkManager::get()->isOnline();
return NS_OK;
}
NS_IMETHODIMP
nsQtNetworkLinkService::GetLinkStatusKnown(PRBool* aIsKnown)
{
*aIsKnown = gQtNetworkManager->isOnline();
*aIsKnown = nsQtNetworkManager::get()->isOnline();
return NS_OK;
}
@ -76,8 +76,7 @@ nsQtNetworkLinkService::Observe(nsISupports* aSubject,
{
if (!strcmp(aTopic, "xpcom-shutdown")) {
Shutdown();
delete gQtNetworkManager;
gQtNetworkManager = 0;
nsQtNetworkManager::get()->destroy();
}
if (!strcmp(aTopic, "browser-lastwindow-close-granted")) {
@ -96,8 +95,7 @@ nsQtNetworkLinkService::Init(void)
return NS_ERROR_FAILURE;
}
delete gQtNetworkManager;
gQtNetworkManager = new nsQtNetworkManager();
nsQtNetworkManager::create();
nsresult rv;
rv = observerService->AddObserver(this, "xpcom-shutdown", PR_FALSE);
@ -117,6 +115,6 @@ nsQtNetworkLinkService::Init(void)
nsresult
nsQtNetworkLinkService::Shutdown()
{
gQtNetworkManager->closeSession();
nsQtNetworkManager::get()->closeSession();
return NS_OK;
}

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

@ -48,6 +48,27 @@
#include <QHostAddress>
#include <QTime>
nsQtNetworkManager* nsQtNetworkManager::gQtNetworkManager = nsnull;
void nsQtNetworkManager::create()
{
if (!gQtNetworkManager) {
gQtNetworkManager = new nsQtNetworkManager();
connect(gQtNetworkManager, SIGNAL(openConnectionSignal()),
gQtNetworkManager, SLOT(openSession()),
Qt::BlockingQueuedConnection);
connect(&gQtNetworkManager->networkConfigurationManager,
SIGNAL(onlineStateChanged(bool)), gQtNetworkManager,
SLOT(onlineStateChanged(bool)));
}
}
void nsQtNetworkManager::destroy()
{
delete gQtNetworkManager;
gQtNetworkManager = nsnull;
}
nsQtNetworkManager::nsQtNetworkManager(QObject* parent)
: QObject(parent), networkSession(0)
{
@ -141,7 +162,7 @@ nsQtNetworkManager::openSession()
// this only means we did not shutdown before...
// renew Session every time
// fix/workaround for prestart bug
if (!networkSession) {
if (networkSession) {
networkSession->close();
networkSession->deleteLater();
}
@ -168,7 +189,7 @@ nsQtNetworkManager::openSession()
void
nsQtNetworkManager::closeSession()
{
if (!networkSession) {
if (networkSession) {
networkSession->close();
}
}

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

@ -47,16 +47,18 @@
class nsQtNetworkManager;
static nsQtNetworkManager* gQtNetworkManager = nsnull;
class nsQtNetworkManager : public QObject
{
Q_OBJECT
public:
explicit nsQtNetworkManager(QObject* parent = 0);
static void create();
static void destroy();
virtual ~nsQtNetworkManager();
static nsQtNetworkManager* get() { return gQtNetworkManager; }
static PRBool IsConnected();
static PRBool GetLinkStatusKnown();
static void enableInstance();
@ -73,6 +75,9 @@ class nsQtNetworkManager : public QObject
void openSession();
private:
explicit nsQtNetworkManager(QObject* parent = 0);
static nsQtNetworkManager* gQtNetworkManager;
QNetworkSession* networkSession;
QNetworkConfiguration networkConfiguration;
QNetworkConfigurationManager networkConfigurationManager;