From e78b4302ff7424a1377dda19f4f9ee2fea6f285d Mon Sep 17 00:00:00 2001 From: "commit-queue@webkit.org" Date: Wed, 8 Feb 2012 15:11:37 +0000 Subject: [PATCH] Remote web inspector reentrancy fixes https://bugs.webkit.org/show_bug.cgi?id=77022 Patch by Leo Franchi on 2012-02-08 Reviewed by Joseph Pecoraro. * WebCoreSupport/InspectorServerQt.cpp: (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107085 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/qt/ChangeLog | 11 +++++++++++ Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp | 8 +++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index caab4e6..9406c92 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,14 @@ +2012-02-08 Leo Franchi + + Remote web inspector reentrancy fixes + https://bugs.webkit.org/show_bug.cgi?id=77022 + + Reviewed by Joseph Pecoraro. + + * WebCoreSupport/InspectorServerQt.cpp: + (WebCore::InspectorServerRequestHandlerQt::tcpReadyRead): + (WebCore::InspectorServerRequestHandlerQt::webSocketReadyRead): + 2012-02-06 Caio Marcelo de Oliveira Filho Provide more attribute methods in Element diff --git a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp index fdc14f5..26c52ff 100644 --- a/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/InspectorServerQt.cpp @@ -209,7 +209,7 @@ void InspectorServerRequestHandlerQt::tcpReadyRead() // switch to websocket-style WebSocketService messaging if (m_tcpConnection) { m_tcpConnection->disconnect(SIGNAL(readyRead())); - connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead())); + connect(m_tcpConnection, SIGNAL(readyRead()), SLOT(webSocketReadyRead()), Qt::QueuedConnection); QByteArray key3 = m_tcpConnection->read(8); @@ -357,6 +357,10 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() QByteArray payload = m_data.mid(1, length); + // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). + // Truncate data before delivering message in case of re-entrancy. + m_data = m_data.mid(length + 2); + #if ENABLE(INSPECTOR) if (m_inspectorClient) { InspectorController* inspectorController = m_inspectorClient->m_inspectedWebPage->d->page->inspectorController(); @@ -364,8 +368,6 @@ void InspectorServerRequestHandlerQt::webSocketReadyRead() } #endif - // Remove this WebSocket message from m_data (payload, start-of-frame byte, end-of-frame byte). - m_data = m_data.mid(length + 2); } } -- 2.7.4