Changeset 68056 in webkit


Ignore:
Timestamp:
Sep 22, 2010 10:33:56 AM (14 years ago)
Author:
commit-queue@webkit.org
Message:

2010-09-22 Jamey Hicks <jamey.hicks@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Web Inspector: Remote Web Inspector support for QtWebKit
https://bugs.webkit.org/show_bug.cgi?id=43988

Runs a web debug server on port specified by QtTestBrowser
argument -remote-inspector-port. Property
_q_webInspectorServerPort of the QWebPage instance will be set
according to the argument. All pages with that property set will
be remotely inspectable.

URL for remote inspection of first QWebPage is

http://localhost:9222/webkit/inspector/inspector.html?page=1

where 1 is the number of the QWebPage instance.

The base URL yields an index page with links to the individual inspectors:

http://localhost:9222/

  • WebCore.pro

2010-09-22 Jamey Hicks <jamey.hicks@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Web Inspector: Remote Web Inspector support for QtWebKit
https://bugs.webkit.org/show_bug.cgi?id=43988

Runs a web debug server on port specified by QtTestBrowser
argument -remote-inspector-port. Property
_q_webInspectorServerPort of the QWebPage instance will be set
according to the argument. All pages with that property set will
be remotely inspectable.

URL for remote inspection of first QWebPage is

http://localhost:9222/webkit/inspector/inspector.html?page=1

where 1 is the number of the QWebPage instance.

The base URL yields an index page with links to the individual inspectors:

http://localhost:9222/

  • Api/qwebinspector.cpp: (QWebInspectorPrivate::attachAndReplaceRemoteFrontend): (QWebInspectorPrivate::detachRemoteFrontend):
  • Api/qwebinspector_p.h: (QWebInspectorPrivate::QWebInspectorPrivate):
  • Api/qwebpage.cpp: (QWebPagePrivate::dynamicPropertyChangeEvent): (QWebPagePrivate::inspectorServerPort):
  • Api/qwebpage.h:
  • Api/qwebpage_p.h:
  • WebCoreSupport/InspectorClientQt.cpp: (WebCore::InspectorClientQt::InspectorClientQt): (WebCore::InspectorClientQt::inspectorDestroyed): (WebCore::InspectorClientQt::openInspectorFrontend): (WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend): (WebCore::InspectorClientQt::detachRemoteFrontend): (WebCore::InspectorClientQt::sendMessageToFrontend):
  • WebCoreSupport/InspectorClientQt.h:
  • WebCoreSupport/InspectorServerQt.cpp: Added. (WebCore::generateWebSocketChallengeResponse): (WebCore::parseWebSocketChallengeNumber): (WebCore::InspectorServerQt::server): (WebCore::InspectorServerQt::InspectorServerQt): (WebCore::InspectorServerQt::~InspectorServerQt): (WebCore::InspectorServerQt::listen): (WebCore::InspectorServerQt::close): (WebCore::InspectorServerQt::inspectorClientForPage): (WebCore::InspectorServerQt::registerClient): (WebCore::InspectorServerQt::unregisterClient): (WebCore::InspectorServerQt::newConnection): (WebCore::InspectorServerRequestHandlerQt::InspectorServerRequestHandlerQt): (WebCore::InspectorServerRequestHandlerQt::~InspectorServerRequestHandlerQt): (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): (WebCore::InspectorServerRequestHandlerQt::tcpConnectionDisconnected): (WebCore::InspectorServerRequestHandlerQt::webSocketSend): (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): (WebCore::RemoteFrontendChannel::RemoteFrontendChannel): (WebCore::RemoteFrontendChannel::sendMessageToFrontend):
  • WebCoreSupport/InspectorServerQt.h: Added.

2010-09-22 Jamey Hicks <jamey.hicks@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Web Inspector: Remote Web Inspector support for QtWebKit
https://bugs.webkit.org/show_bug.cgi?id=43988

Runs a web debug server on port specified by QtTestBrowser
argument -remote-inspector-port. Property
_q_webInspectorServerPort of the QWebPage instance will be set
according to the argument. All pages with that property set will
be remotely inspectable.

URL for remote inspection of first QWebPage is

http://localhost:9222/webkit/inspector/inspector.html?page=1

where 1 is the number of the QWebPage instance.

The base URL yields an index page with links to the individual inspectors:

http://localhost:9222/

  • QtTestBrowser/launcherwindow.cpp: (LauncherWindow::init):
  • QtTestBrowser/launcherwindow.h:
  • QtTestBrowser/main.cpp: (LauncherApplication::handleUserOptions):
Location:
trunk
Files:
2 added
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r68054 r68056  
     12010-09-22  Jamey Hicks  <jamey.hicks@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Web Inspector: Remote Web Inspector support for QtWebKit
     6        https://bugs.webkit.org/show_bug.cgi?id=43988
     7
     8        Runs a web debug server on port specified by QtTestBrowser
     9        argument -remote-inspector-port. Property
     10        _q_webInspectorServerPort of the QWebPage instance will be set
     11        according to the argument. All pages with that property set will
     12        be remotely inspectable.
     13
     14        URL for remote inspection of first QWebPage is
     15            http://localhost:9222/webkit/inspector/inspector.html?page=1
     16        where 1 is the number of the QWebPage instance.
     17
     18        The base URL yields an index page with links to the individual inspectors:
     19            http://localhost:9222/
     20
     21        * WebCore.pro
     22
    1232010-09-21  Darin Adler  <darin@apple.com>
    224
  • trunk/WebCore/WebCore.pro

    r68022 r68056  
    25042504    xml/XSLTUnicodeSort.h \
    25052505    $$PWD/../WebKit/qt/Api/qwebplugindatabase_p.h \
     2506    $$PWD/../WebKit/qt/WebCoreSupport/InspectorServerQt.h \
    25062507    $$PWD/../WebKit/qt/WebCoreSupport/QtFallbackWebPopup.h \
    25072508    $$PWD/../WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h \
     
    26102611    ../WebKit/qt/WebCoreSupport/GeolocationPermissionClientQt.cpp \
    26112612    ../WebKit/qt/WebCoreSupport/InspectorClientQt.cpp \
     2613    ../WebKit/qt/WebCoreSupport/InspectorServerQt.cpp \
    26122614    ../WebKit/qt/WebCoreSupport/NotificationPresenterClientQt.cpp \
    26132615    ../WebKit/qt/WebCoreSupport/PageClientQt.cpp \
  • trunk/WebKit/qt/Api/qwebinspector.cpp

    r59456 r68056  
    197197}
    198198
     199/*!
     200 * \internal
     201 */
     202void QWebInspectorPrivate::attachAndReplaceRemoteFrontend(QObject* newRemoteFrontend)
     203{
     204    if (remoteFrontend)
     205        remoteFrontend->setParent(0);
     206
     207    remoteFrontend = newRemoteFrontend;
     208
     209    if (remoteFrontend)
     210        remoteFrontend->setParent(q);
     211}
     212
     213/*!
     214 * \internal
     215 */
     216void QWebInspectorPrivate::detachRemoteFrontend()
     217{
     218    if (remoteFrontend) {
     219        remoteFrontend->deleteLater();
     220        remoteFrontend = 0;
     221    }
     222}
     223
    199224void QWebInspectorPrivate::adjustFrontendSize(const QSize& size)
    200225{
  • trunk/WebKit/qt/Api/qwebinspector_p.h

    r48808 r68056  
    3434    , page(0)
    3535    , frontend(0)
     36    , remoteFrontend(0)
    3637    {}
    3738
    3839    void setFrontend(QWidget* newFrontend);
     40    void attachAndReplaceRemoteFrontend(QObject* newRemoteFrontend);
     41    void detachRemoteFrontend();
    3942    void adjustFrontendSize(const QSize& size);
    4043
     
    4245    QWebPage* page;
    4346    QWidget* frontend;
     47    QObject* remoteFrontend;
    4448};
    4549
  • trunk/WebKit/qt/Api/qwebpage.cpp

    r68039 r68056  
    7878#include "HTMLNames.h"
    7979#include "HitTestResult.h"
     80#include "InspectorServerQt.h"
    8081#include "WindowFeatures.h"
    8182#include "WebPlatformStrategies.h"
     
    13031304    }
    13041305#endif
     1306    else if (event->propertyName() == "_q_webInspectorServerPort") {
     1307        InspectorServerQt* inspectorServer = InspectorServerQt::server();
     1308        inspectorServer->listen(inspectorServerPort());
     1309    }
    13051310}
    13061311#endif
     
    15601565}
    15611566
     1567quint16 QWebPagePrivate::inspectorServerPort()
     1568{
     1569#if ENABLE(INSPECTOR) && !defined(QT_NO_PROPERTIES)
     1570    if (q && q->property("_q_webInspectorServerPort").isValid())
     1571        return q->property("_q_webInspectorServerPort").toInt();
     1572#endif
     1573    return 0;
     1574}
    15621575
    15631576/*!
  • trunk/WebKit/qt/Api/qwebpage.h

    r67376 r68056  
    5656    class FrameLoaderClientQt;
    5757    class InspectorClientQt;
     58    class InspectorServerRequestHandlerQt;
    5859    class InspectorFrontendClientQt;
    5960    class NotificationPresenterClientQt;
     
    426427    friend class WebCore::FrameLoaderClientQt;
    427428    friend class WebCore::InspectorClientQt;
     429    friend class WebCore::InspectorServerRequestHandlerQt;
    428430    friend class WebCore::InspectorFrontendClientQt;
    429431    friend class WebCore::NotificationPresenterClientQt;
  • trunk/WebKit/qt/Api/qwebpage_p.h

    r67376 r68056  
    140140    QWebInspector* getOrCreateInspector();
    141141    WebCore::InspectorController* inspectorController();
     142    quint16 inspectorServerPort();
    142143
    143144#ifndef QT_NO_SHORTCUT
  • trunk/WebKit/qt/ChangeLog

    r68039 r68056  
     12010-09-22  Jamey Hicks  <jamey.hicks@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Web Inspector: Remote Web Inspector support for QtWebKit
     6        https://bugs.webkit.org/show_bug.cgi?id=43988
     7
     8        Runs a web debug server on port specified by QtTestBrowser
     9        argument -remote-inspector-port. Property
     10        _q_webInspectorServerPort of the QWebPage instance will be set
     11        according to the argument. All pages with that property set will
     12        be remotely inspectable.
     13
     14        URL for remote inspection of first QWebPage is
     15            http://localhost:9222/webkit/inspector/inspector.html?page=1
     16        where 1 is the number of the QWebPage instance.
     17
     18        The base URL yields an index page with links to the individual inspectors:
     19            http://localhost:9222/
     20
     21        * Api/qwebinspector.cpp:
     22        (QWebInspectorPrivate::attachAndReplaceRemoteFrontend):
     23        (QWebInspectorPrivate::detachRemoteFrontend):
     24        * Api/qwebinspector_p.h:
     25        (QWebInspectorPrivate::QWebInspectorPrivate):
     26        * Api/qwebpage.cpp:
     27        (QWebPagePrivate::dynamicPropertyChangeEvent):
     28        (QWebPagePrivate::inspectorServerPort):
     29        * Api/qwebpage.h:
     30        * Api/qwebpage_p.h:
     31        * WebCoreSupport/InspectorClientQt.cpp:
     32        (WebCore::InspectorClientQt::InspectorClientQt):
     33        (WebCore::InspectorClientQt::inspectorDestroyed):
     34        (WebCore::InspectorClientQt::openInspectorFrontend):
     35        (WebCore::InspectorClientQt::attachAndReplaceRemoteFrontend):
     36        (WebCore::InspectorClientQt::detachRemoteFrontend):
     37        (WebCore::InspectorClientQt::sendMessageToFrontend):
     38        * WebCoreSupport/InspectorClientQt.h:
     39        * WebCoreSupport/InspectorServerQt.cpp: Added.
     40        (WebCore::generateWebSocketChallengeResponse):
     41        (WebCore::parseWebSocketChallengeNumber):
     42        (WebCore::InspectorServerQt::server):
     43        (WebCore::InspectorServerQt::InspectorServerQt):
     44        (WebCore::InspectorServerQt::~InspectorServerQt):
     45        (WebCore::InspectorServerQt::listen):
     46        (WebCore::InspectorServerQt::close):
     47        (WebCore::InspectorServerQt::inspectorClientForPage):
     48        (WebCore::InspectorServerQt::registerClient):
     49        (WebCore::InspectorServerQt::unregisterClient):
     50        (WebCore::InspectorServerQt::newConnection):
     51        (WebCore::InspectorServerRequestHandlerQt::InspectorServerRequestHandlerQt):
     52        (WebCore::InspectorServerRequestHandlerQt::~InspectorServerRequestHandlerQt):
     53        (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead):
     54        (WebCore::InspectorServerRequestHandlerQt::tcpConnectionDisconnected):
     55        (WebCore::InspectorServerRequestHandlerQt::webSocketSend):
     56        (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead):
     57        (WebCore::RemoteFrontendChannel::RemoteFrontendChannel):
     58        (WebCore::RemoteFrontendChannel::sendMessageToFrontend):
     59        * WebCoreSupport/InspectorServerQt.h: Added.
     60
    1612010-09-22  Balazs Kelemen  <kb@inf.u-szeged.hu>
    262
  • trunk/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp

    r67488 r68056  
    3333
    3434#include "Frame.h"
     35#include "InspectorBackendDispatcher.h"
    3536#include "InspectorController.h"
     37#include "InspectorFrontend.h"
     38#include "InspectorServerQt.h"
    3639#include "NotImplemented.h"
    3740#include "Page.h"
     
    116119    , m_frontendWebPage(0)
    117120    , m_frontendClient(0)
    118 {}
     121{
     122    InspectorServerQt* webInspectorServer = InspectorServerQt::server();
     123    if (webInspectorServer)
     124        webInspectorServer->registerClient(this);
     125}
    119126
    120127void InspectorClientQt::inspectorDestroyed()
     
    122129    if (m_frontendClient)
    123130        m_frontendClient->inspectorClientDestroyed();
     131
     132    InspectorServerQt* webInspectorServer = InspectorServerQt::server();
     133    if (webInspectorServer)
     134        webInspectorServer->unregisterClient(this);
     135
    124136    delete this;
    125137}
    126138
    127139   
    128 void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController*)
     140void InspectorClientQt::openInspectorFrontend(WebCore::InspectorController* inspectorController)
    129141{
    130142#if USE(V8)
     
    137149
    138150    QWebInspector* inspector = m_inspectedWebPage->d->getOrCreateInspector();
     151    // Remote frontend was attached.
     152    if (m_inspectedWebPage->d->inspector->d->remoteFrontend)
     153        return;
     154
    139155    // This is a known hook that allows changing the default URL for the
    140156    // Web inspector. This is used for SDK purposes. Please keep this hook
     
    166182    m_frontendWebPage = 0;
    167183    m_frontendClient = 0;
     184}
     185
     186void InspectorClientQt::attachAndReplaceRemoteFrontend(RemoteFrontendChannel* channel)
     187{
     188#if ENABLE(INSPECTOR)
     189    // Channel was allocated by InspectorServerQt. Here we transfer ownership to inspector.
     190    m_inspectedWebPage->d->inspector->d->attachAndReplaceRemoteFrontend(channel);
     191    m_inspectedWebPage->d->inspectorController()->connectFrontend();
     192#endif
     193}
     194
     195void InspectorClientQt::detachRemoteFrontend()
     196{
     197#if ENABLE(INSPECTOR)
     198    m_inspectedWebPage->d->inspector->d->detachRemoteFrontend();
     199    m_inspectedWebPage->d->inspectorController()->disconnectFrontend();
     200#endif
    168201}
    169202
     
    224257bool InspectorClientQt::sendMessageToFrontend(const String& message)
    225258{
     259    if (m_inspectedWebPage->d->inspector->d->remoteFrontend) {
     260        RemoteFrontendChannel* session = qobject_cast<RemoteFrontendChannel*>(m_inspectedWebPage->d->inspector->d->remoteFrontend);
     261        if (session)
     262            session->sendMessageToFrontend(message);
     263        return true;
     264    }
    226265    if (!m_frontendWebPage)
    227266        return false;
  • trunk/WebKit/qt/WebCoreSupport/InspectorClientQt.h

    r66824 r68056  
    4343namespace WebCore {
    4444class InspectorFrontendClientQt;
     45class InspectorServerRequestHandlerQt;
    4546class Node;
    4647class Page;
     48class RemoteFrontendChannel;
    4749
    4850class InspectorClientQt : public InspectorClient {
     
    6466    void releaseFrontendPage();
    6567
     68    void attachAndReplaceRemoteFrontend(RemoteFrontendChannel *channel);
     69    void detachRemoteFrontend();
     70
    6671private:
    6772    QWebPage* m_inspectedWebPage;
    6873    QWebPage* m_frontendWebPage;
    6974    InspectorFrontendClientQt* m_frontendClient;
     75    bool m_remoteInspector;
     76
     77    friend class InspectorServerRequestHandlerQt;
    7078};
    7179
  • trunk/WebKitTools/ChangeLog

    r68053 r68056  
     12010-09-22  Jamey Hicks  <jamey.hicks@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Web Inspector: Remote Web Inspector support for QtWebKit
     6        https://bugs.webkit.org/show_bug.cgi?id=43988
     7
     8        Runs a web debug server on port specified by QtTestBrowser
     9        argument -remote-inspector-port. Property
     10        _q_webInspectorServerPort of the QWebPage instance will be set
     11        according to the argument. All pages with that property set will
     12        be remotely inspectable.
     13
     14        URL for remote inspection of first QWebPage is
     15            http://localhost:9222/webkit/inspector/inspector.html?page=1
     16        where 1 is the number of the QWebPage instance.
     17
     18        The base URL yields an index page with links to the individual inspectors:
     19            http://localhost:9222/
     20
     21        * QtTestBrowser/launcherwindow.cpp:
     22        (LauncherWindow::init):
     23        * QtTestBrowser/launcherwindow.h:
     24        * QtTestBrowser/main.cpp:
     25        (LauncherApplication::handleUserOptions):
     26
    1272010-09-22  Adam Roben  <aroben@apple.com>
    228
  • trunk/WebKitTools/QtTestBrowser/launcherwindow.cpp

    r67689 r68056  
    9292    connect(this, SIGNAL(destroyed()), m_inspector, SLOT(deleteLater()));
    9393
     94    if (m_windowOptions.remoteInspectorPort)
     95        page()->setProperty("_q_webInspectorServerPort", m_windowOptions.remoteInspectorPort);
     96
    9497    // the zoom values are chosen to be like in Mozilla Firefox 3
    9598    if (!m_zoomLevels.count()) {
  • trunk/WebKitTools/QtTestBrowser/launcherwindow.h

    r67686 r68056  
    111111#endif
    112112    QUrl inspectorUrl;
     113    quint16 remoteInspectorPort;
    113114};
    114115
  • trunk/WebKitTools/QtTestBrowser/main.cpp

    r67942 r68056  
    189189       windowOptions.inspectorUrl = takeOptionValue(&args, inspectorUrlIndex);
    190190
     191    QString remoteInspectorPortArg("-remote-inspector-port");
     192    int remoteInspectorPortIndex = args.indexOf(remoteInspectorPortArg);
     193    if (remoteInspectorPortIndex != -1)
     194        windowOptions.remoteInspectorPort = takeOptionValue(&args, remoteInspectorPortIndex).toInt();
     195
    191196    int robotIndex = args.indexOf("-r");
    192197    if (robotIndex != -1) {
Note: See TracChangeset for help on using the changeset viewer.