summaryrefslogtreecommitdiff
path: root/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-05-07 11:21:11 +0200
commit2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47 (patch)
tree988e8c5b116dd0466244ae2fe5af8ee9be926d76 /Source/WebKit2/UIProcess/qt/QtWebContext.cpp
parentdd91e772430dc294e3bf478c119ef8d43c0a3358 (diff)
downloadqtwebkit-2cf6c8816a73e0132bd8fa3b509d62d7c51b6e47.tar.gz
Imported WebKit commit 7e538425aa020340619e927792f3d895061fb54b (http://svn.webkit.org/repository/webkit/trunk@116286)
Diffstat (limited to 'Source/WebKit2/UIProcess/qt/QtWebContext.cpp')
-rw-r--r--Source/WebKit2/UIProcess/qt/QtWebContext.cpp45
1 files changed, 44 insertions, 1 deletions
diff --git a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
index a800fef15..30d59c2a4 100644
--- a/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
+++ b/Source/WebKit2/UIProcess/qt/QtWebContext.cpp
@@ -26,6 +26,7 @@
#include "QtWebIconDatabaseClient.h"
#include "WKAPICast.h"
#include "WebContext.h"
+#include "WebInspectorServer.h"
#include "WebPageProxy.h"
#include <WKArray.h>
#include <WKPage.h>
@@ -44,6 +45,46 @@ static HashMap<uint64_t, QtWebContext*> contextMap;
QtWebContext* QtWebContext::s_defaultContext = 0;
+static void initInspectorServer()
+{
+ QString inspectorEnv = QString::fromUtf8(qgetenv("QTWEBKIT_INSPECTOR_SERVER"));
+ if (!inspectorEnv.isEmpty()) {
+ QString bindAddress = QLatin1String("127.0.0.1");
+ QString portStr = inspectorEnv;
+ int port = 0;
+
+ int portColonPos = inspectorEnv.lastIndexOf(':');
+ if (portColonPos != -1) {
+ portStr = inspectorEnv.mid(portColonPos + 1);
+ bindAddress = inspectorEnv.mid(0, portColonPos);
+ }
+
+ bool ok = false;
+ port = portStr.toInt(&ok);
+ if (!ok) {
+ qWarning("Non numeric port for the inspector server \"%s\". Examples of valid input: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface).", qPrintable(portStr));
+ return;
+ }
+
+ bool success = WebInspectorServer::shared().listen(bindAddress, port);
+ if (success) {
+ QString inspectorServerUrl = QString::fromLatin1("http://%1:%2").arg(bindAddress).arg(port);
+ qWarning("Inspector server started successfully. Try pointing a WebKit browser to %s", qPrintable(inspectorServerUrl));
+ } else
+ qWarning("Couldn't start the inspector server on bind address \"%s\" and port \"%d\". In case of invalid input, try something like: \"12345\" or \"192.168.2.14:12345\" (with the address of one of this host's interface).", qPrintable(bindAddress), port);
+ }
+}
+
+static void globalInitialization()
+{
+ static bool initialized = false;
+ if (initialized)
+ return;
+
+ initInspectorServer();
+ initialized = true;
+}
+
QtWebContext::QtWebContext(WebContext* context)
: m_contextID(generateContextID())
, m_context(context)
@@ -63,6 +104,7 @@ QtWebContext::~QtWebContext()
// Used only by WebKitTestRunner. It avoids calling initialize(), so that we don't register any clients.
PassRefPtr<QtWebContext> QtWebContext::create(WebContext* context)
{
+ globalInitialization();
return adoptRef(new QtWebContext(context));
}
@@ -150,4 +192,5 @@ void QtWebContext::didReceiveMessageFromInjectedBundle(WKStringRef messageName,
toImpl(page)->didReceiveMessageFromNavigatorQtObject(toImpl(str)->string());
}
-}
+} // namespace WebKit
+