Skip to content

Commit 17fe483

Browse files
committed
Bug 586799 - Incubator embedding: MozView should auto-connect. r=mark.finkle
1 parent 7eb7cfd commit 17fe483

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

qt/test/test.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,22 @@
4040
#include <QDebug>
4141
#include <QPushButton>
4242
#include <QGraphicsProxyWidget>
43+
#include <nsCOMPtr.h>
44+
#include <nsIIOService.h>
45+
#include <nsNetUtil.h>
4346

4447
#include "test.h"
4548

49+
static nsresult ForceOnline()
50+
{
51+
nsCOMPtr<nsIIOService> ioService = do_GetService(NS_IOSERVICE_CONTRACTID);
52+
if (!ioService)
53+
return NS_ERROR_FAILURE;
54+
55+
ioService->SetOffline(PR_FALSE);
56+
return NS_OK;
57+
}
58+
4659
MyQGraphicsView::MyQGraphicsView(QGraphicsScene* scene, QWidget* parent)
4760
: QGraphicsView(scene, parent)
4861
{
@@ -102,6 +115,9 @@ void MyQGraphicsView::resizeEvent(QResizeEvent* event)
102115

103116
void MyQGraphicsView::loadUri(const QString& uri)
104117
{
118+
// ForceOnline() must be called before any network call
119+
// in order to get connectivity working
120+
ForceOnline();
105121
mozView->loadUri(uri);
106122
}
107123

0 commit comments

Comments
 (0)