Diff
Modified: trunk/Source/WebKit2/ChangeLog (113027 => 113028)
--- trunk/Source/WebKit2/ChangeLog 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/ChangeLog 2012-04-03 13:24:56 UTC (rev 113028)
@@ -1,3 +1,53 @@
+2012-04-02 Jocelyn Turcotte <[email protected]>
+
+ Enable and connect the WebInspectorServer with WebKit2 pages.
+ https://bugs.webkit.org/show_bug.cgi?id=73094
+
+ Reviewed by Simon Hausmann.
+
+ Pages are registered/unregistered as they are created/destroyed, if they have
+ developer extras enabled. The server is run on the UI process and communicates
+ with the web process through IPC for each message between the inspector
+ controller and the remote frontend.
+
+ Includes the server spawning logic for the Qt port, the server is
+ started through an environment variable specifying the interface and
+ port to bind the server to, by default on 127.0.0.1.
+
+ * UIProcess/WebInspectorProxy.cpp:
+ (WebKit::WebInspectorProxy::WebInspectorProxy):
+ (WebKit::WebInspectorProxy::invalidate):
+ (WebKit):
+ (WebKit::WebInspectorProxy::enableRemoteInspection):
+ (WebKit::WebInspectorProxy::remoteFrontendConnected):
+ (WebKit::WebInspectorProxy::remoteFrontendDisconnected):
+ (WebKit::WebInspectorProxy::dispatchMessageFromRemoteFrontend):
+ (WebKit::WebInspectorProxy::sendMessageToRemoteFrontend):
+ * UIProcess/WebInspectorProxy.h:
+ (WebInspectorProxy):
+ * UIProcess/WebInspectorProxy.messages.in:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::initializeWebPage):
+ (WebKit::WebPageProxy::preferencesDidChange):
+ * UIProcess/qt/QtWebContext.cpp:
+ (WebKit::initInspectorServer):
+ (WebKit):
+ (WebKit::globalInitialization):
+ (WebKit::QtWebContext::create):
+ * WebProcess/WebCoreSupport/WebInspectorClient.cpp:
+ (WebKit::WebInspectorClient::sendMessageToFrontend):
+ * WebProcess/WebPage/WebInspector.cpp:
+ (WebKit::WebInspector::WebInspector):
+ (WebKit):
+ (WebKit::WebInspector::sendMessageToRemoteFrontend):
+ (WebKit::WebInspector::dispatchMessageFromRemoteFrontend):
+ (WebKit::WebInspector::remoteFrontendConnected):
+ (WebKit::WebInspector::remoteFrontendDisconnected):
+ * WebProcess/WebPage/WebInspector.h:
+ (WebInspector):
+ (WebKit::WebInspector::hasRemoteFrontendConnected):
+ * WebProcess/WebPage/WebInspector.messages.in:
+
2012-03-29 Joseph Pecoraro <[email protected]> and Jocelyn Turcotte <[email protected]>
WebInspectorServer for WebKit2.
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp (113027 => 113028)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.cpp 2012-04-03 13:24:56 UTC (rev 113028)
@@ -39,6 +39,9 @@
#include "WebProcessProxy.h"
#include "WebURLRequest.h"
+#if ENABLE(INSPECTOR_SERVER)
+#include "WebInspectorServer.h"
+#endif
#if PLATFORM(WIN)
#include "WebView.h"
#endif
@@ -81,6 +84,9 @@
, m_inspectorView(0)
, m_inspectorWindow(0)
#endif
+#if ENABLE(INSPECTOR_SERVER)
+ , m_remoteInspectionPageId(0)
+#endif
{
}
@@ -90,6 +96,11 @@
void WebInspectorProxy::invalidate()
{
+#if ENABLE(INSPECTOR_SERVER)
+ if (m_remoteInspectionPageId)
+ WebInspectorServer::shared().unregisterPage(m_remoteInspectionPageId);
+#endif
+
m_page->close();
didClose();
@@ -256,6 +267,29 @@
webInspectorProxy->page()->loadURLRequest(toImpl(requestRef));
}
+#if ENABLE(INSPECTOR_SERVER)
+void WebInspectorProxy::enableRemoteInspection()
+{
+ if (!m_remoteInspectionPageId)
+ m_remoteInspectionPageId = WebInspectorServer::shared().registerPage(this);
+}
+
+void WebInspectorProxy::remoteFrontendConnected()
+{
+ m_page->process()->send(Messages::WebInspector::RemoteFrontendConnected(), m_page->pageID());
+}
+
+void WebInspectorProxy::remoteFrontendDisconnected()
+{
+ m_page->process()->send(Messages::WebInspector::RemoteFrontendDisconnected(), m_page->pageID());
+}
+
+void WebInspectorProxy::dispatchMessageFromRemoteFrontend(const String& message)
+{
+ m_page->process()->send(Messages::WebInspector::DispatchMessageFromRemoteFrontend(message), m_page->pageID());
+}
+#endif
+
// Called by WebInspectorProxy messages
void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters)
{
@@ -348,6 +382,14 @@
return inspectorPageGroup()->preferences()->inspectorStartsAttached() && canAttach();
}
+#if ENABLE(INSPECTOR_SERVER)
+void WebInspectorProxy::sendMessageToRemoteFrontend(const String& message)
+{
+ ASSERT(m_remoteInspectionPageId);
+ WebInspectorServer::shared().sendMessageOverConnection(m_remoteInspectionPageId, message);
+}
+#endif
+
} // namespace WebKit
#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h (113027 => 113028)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.h 2012-04-03 13:24:56 UTC (rev 113028)
@@ -123,6 +123,13 @@
String inspectorPageURL() const;
String inspectorBaseURL() const;
+#if ENABLE(INSPECTOR_SERVER)
+ void enableRemoteInspection();
+ void remoteFrontendConnected();
+ void remoteFrontendDisconnected();
+ void dispatchMessageFromRemoteFrontend(const String& message);
+#endif
+
private:
WebInspectorProxy(WebPageProxy* page);
@@ -146,6 +153,10 @@
void bringToFront();
void inspectedURLChanged(const String&);
+#if ENABLE(INSPECTOR_SERVER)
+ void sendMessageToRemoteFrontend(const String& message);
+#endif
+
bool canAttach();
bool shouldOpenAttached();
@@ -194,6 +205,9 @@
GtkWidget* m_inspectorView;
GtkWidget* m_inspectorWindow;
#endif
+#if ENABLE(INSPECTOR_SERVER)
+ int m_remoteInspectionPageId;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in (113027 => 113028)
--- trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/UIProcess/WebInspectorProxy.messages.in 2012-04-03 13:24:56 UTC (rev 113028)
@@ -32,6 +32,10 @@
Attach()
Detach()
SetAttachedWindowHeight(unsigned height)
+
+#if ENABLE(INSPECTOR_SERVER)
+ SendMessageToRemoteFrontend(WTF::String message)
+#endif
}
#endif
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (113027 => 113028)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2012-04-03 13:24:56 UTC (rev 113028)
@@ -339,6 +339,11 @@
m_drawingArea = m_pageClient->createDrawingAreaProxy();
ASSERT(m_drawingArea);
+#if ENABLE(INSPECTOR_SERVER)
+ if (m_pageGroup->preferences()->developerExtrasEnabled())
+ inspector()->enableRemoteInspection();
+#endif
+
process()->send(Messages::WebProcess::CreateWebPage(m_pageID, creationParameters()), 0);
}
@@ -1571,6 +1576,11 @@
if (!isValid())
return;
+#if ENABLE(INSPECTOR_SERVER)
+ if (m_pageGroup->preferences()->developerExtrasEnabled())
+ inspector()->enableRemoteInspection();
+#endif
+
// FIXME: It probably makes more sense to send individual preference changes.
// However, WebKitTestRunner depends on getting a preference change notification
// even if nothing changed in UI process, so that overrides get removed.
Modified: trunk/Source/WebKit2/UIProcess/qt/QtWebContext.cpp (113027 => 113028)
--- trunk/Source/WebKit2/UIProcess/qt/QtWebContext.cpp 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/UIProcess/qt/QtWebContext.cpp 2012-04-03 13:24:56 UTC (rev 113028)
@@ -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 @@
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 @@
// 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));
}
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp (113027 => 113028)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebInspectorClient.cpp 2012-04-03 13:24:56 UTC (rev 113028)
@@ -89,10 +89,19 @@
WebInspector* inspector = m_page->inspector();
if (!inspector)
return false;
+
+#if ENABLE(INSPECTOR_SERVER)
+ if (inspector->hasRemoteFrontendConnected()) {
+ inspector->sendMessageToRemoteFrontend(message);
+ return true;
+ }
+#endif
+
WebPage* inspectorPage = inspector->inspectorPage();
- if (!inspectorPage)
- return false;
- return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
+ if (inspectorPage)
+ return doDispatchMessageOnFrontendPage(inspectorPage->corePage(), message);
+
+ return false;
}
void WebInspectorClient::pageOverlayDestroyed(PageOverlay*)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp (113027 => 113028)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.cpp 2012-04-03 13:24:56 UTC (rev 113028)
@@ -50,6 +50,9 @@
: m_page(page)
, m_inspectorPage(0)
, m_frontendClient(0)
+#if ENABLE(INSPECTOR_SERVER)
+ , m_remoteFrontendConnected(false)
+#endif
{
}
@@ -236,6 +239,36 @@
m_frontendClient->setDockingUnavailable(!m_frontendClient->canAttachWindow());
}
+#if ENABLE(INSPECTOR_SERVER)
+void WebInspector::sendMessageToRemoteFrontend(const String& message)
+{
+ ASSERT(m_remoteFrontendConnected);
+ WebProcess::shared().connection()->send(Messages::WebInspectorProxy::SendMessageToRemoteFrontend(message), m_page->pageID());
+}
+
+void WebInspector::dispatchMessageFromRemoteFrontend(const String& message)
+{
+ m_page->corePage()->inspectorController()->dispatchMessageFromFrontend(message);
+}
+
+void WebInspector::remoteFrontendConnected()
+{
+ ASSERT(!m_remoteFrontendConnected);
+ // Switching between in-process and remote inspectors isn't supported yet.
+ ASSERT(!m_inspectorPage);
+
+ m_page->corePage()->inspectorController()->connectFrontend();
+ m_remoteFrontendConnected = true;
+}
+
+void WebInspector::remoteFrontendDisconnected()
+{
+ ASSERT(m_remoteFrontendConnected);
+ m_page->corePage()->inspectorController()->disconnectFrontend();
+ m_remoteFrontendConnected = false;
+}
+#endif
+
} // namespace WebKit
#endif // ENABLE(INSPECTOR)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h (113027 => 113028)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.h 2012-04-03 13:24:56 UTC (rev 113028)
@@ -61,6 +61,14 @@
void startPageProfiling();
void stopPageProfiling();
+#if ENABLE(INSPECTOR_SERVER)
+ bool hasRemoteFrontendConnected() const { return m_remoteFrontendConnected; }
+ void sendMessageToRemoteFrontend(const String& message);
+ void dispatchMessageFromRemoteFrontend(const String& message);
+ void remoteFrontendConnected();
+ void remoteFrontendDisconnected();
+#endif
+
#if PLATFORM(MAC)
void setInspectorUsesWebKitUserInterface(bool);
#endif
@@ -111,6 +119,9 @@
#if PLATFORM(MAC)
String m_localizedStringsURL;
#endif
+#if ENABLE(INSPECTOR_SERVER)
+ bool m_remoteFrontendConnected;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in (113027 => 113028)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebInspector.messages.in 2012-04-03 13:24:56 UTC (rev 113028)
@@ -34,6 +34,12 @@
StopJavaScriptProfiling()
StartPageProfiling()
StopPageProfiling()
+
+#if ENABLE(INSPECTOR_SERVER)
+ DispatchMessageFromRemoteFrontend(WTF::String message)
+ RemoteFrontendConnected()
+ RemoteFrontendDisconnected()
+#endif
}
#endif
Modified: trunk/Tools/ChangeLog (113027 => 113028)
--- trunk/Tools/ChangeLog 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Tools/ChangeLog 2012-04-03 13:24:56 UTC (rev 113028)
@@ -1,3 +1,14 @@
+2012-04-02 Jocelyn Turcotte <[email protected]>
+
+ Enable and connect the WebInspectorServer with WebKit2 pages.
+ https://bugs.webkit.org/show_bug.cgi?id=73094
+
+ Reviewed by Simon Hausmann.
+
+ Enable developer extras on pages in MiniBrowser for Qt.
+
+ * MiniBrowser/qt/qml/BrowserWindow.qml:
+
2012-04-03 Christophe Dumez <[email protected]>
[EFL] LayoutTestController needs implementation of setDefersLoading
Modified: trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml (113027 => 113028)
--- trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml 2012-04-03 13:24:32 UTC (rev 113027)
+++ trunk/Tools/MiniBrowser/qt/qml/BrowserWindow.qml 2012-04-03 13:24:56 UTC (rev 113028)
@@ -314,6 +314,7 @@
experimental.authenticationDialog: AuthenticationDialog { }
experimental.proxyAuthenticationDialog: ProxyAuthenticationDialog { }
experimental.filePicker: FilePicker { }
+ experimental.preferences.developerExtrasEnabled: true
experimental.databaseQuotaDialog: Item {
Timer {
interval: 1