https://bugs.webkit.org/show_bug.cgi?id=73094
Reviewed by Simon Hausmann.
Source/WebKit2:
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:
Tools:
Enable developer extras on pages in MiniBrowser for Qt.
* MiniBrowser/qt/qml/BrowserWindow.qml:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113028
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-04-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ 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 <joepeck@webkit.org> and Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
WebInspectorServer for WebKit2.
#include "WebProcessProxy.h"
#include "WebURLRequest.h"
+#if ENABLE(INSPECTOR_SERVER)
+#include "WebInspectorServer.h"
+#endif
#if PLATFORM(WIN)
#include "WebView.h"
#endif
, m_inspectorView(0)
, m_inspectorWindow(0)
#endif
+#if ENABLE(INSPECTOR_SERVER)
+ , m_remoteInspectionPageId(0)
+#endif
{
}
void WebInspectorProxy::invalidate()
{
+#if ENABLE(INSPECTOR_SERVER)
+ if (m_remoteInspectionPageId)
+ WebInspectorServer::shared().unregisterPage(m_remoteInspectionPageId);
+#endif
+
m_page->close();
didClose();
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)
{
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)
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);
void bringToFront();
void inspectedURLChanged(const String&);
+#if ENABLE(INSPECTOR_SERVER)
+ void sendMessageToRemoteFrontend(const String& message);
+#endif
+
bool canAttach();
bool shouldOpenAttached();
GtkWidget* m_inspectorView;
GtkWidget* m_inspectorWindow;
#endif
+#if ENABLE(INSPECTOR_SERVER)
+ int m_remoteInspectionPageId;
+#endif
};
} // namespace WebKit
Attach()
Detach()
SetAttachedWindowHeight(unsigned height)
+
+#if ENABLE(INSPECTOR_SERVER)
+ SendMessageToRemoteFrontend(WTF::String message)
+#endif
}
#endif
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);
}
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.
#include "QtWebIconDatabaseClient.h"
#include "WKAPICast.h"
#include "WebContext.h"
+#include "WebInspectorServer.h"
#include "WebPageProxy.h"
#include <WKArray.h>
#include <WKPage.h>
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)
// 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));
}
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*)
: m_page(page)
, m_inspectorPage(0)
, m_frontendClient(0)
+#if ENABLE(INSPECTOR_SERVER)
+ , m_remoteFrontendConnected(false)
+#endif
{
}
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)
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
#if PLATFORM(MAC)
String m_localizedStringsURL;
#endif
+#if ENABLE(INSPECTOR_SERVER)
+ bool m_remoteFrontendConnected;
+#endif
};
} // namespace WebKit
StopJavaScriptProfiling()
StartPageProfiling()
StopPageProfiling()
+
+#if ENABLE(INSPECTOR_SERVER)
+ DispatchMessageFromRemoteFrontend(WTF::String message)
+ RemoteFrontendConnected()
+ RemoteFrontendDisconnected()
+#endif
}
#endif
+2012-04-02 Jocelyn Turcotte <jocelyn.turcotte@nokia.com>
+
+ 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 <christophe.dumez@intel.com>
[EFL] LayoutTestController needs implementation of setDefersLoading
experimental.authenticationDialog: AuthenticationDialog { }
experimental.proxyAuthenticationDialog: ProxyAuthenticationDialog { }
experimental.filePicker: FilePicker { }
+ experimental.preferences.developerExtrasEnabled: true
experimental.databaseQuotaDialog: Item {
Timer {
interval: 1