2011-05-04 Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
authorcaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2011 12:24:40 +0000 (12:24 +0000)
committercaio.oliveira@openbossa.org <caio.oliveira@openbossa.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 4 May 2011 12:24:40 +0000 (12:24 +0000)
commit32488a591956c1e882d876ac135e3b37ea84e047
treec5628dbfd42ff152859676fb56ab7b315296538d
parent1ea6c03de1fdf725a6eefb243675cf62b10e7157
2011-05-04  Caio Marcelo de Oliveira Filho  <caio.oliveira@openbossa.org>

        Reviewed by Andreas Kling.

        [Qt] Fix QNetworkReplyWrapper to not depend on QNetworkReply::isFinished() method
        https://bugs.webkit.org/show_bug.cgi?id=59070

        Applications using our API and our autotests subclass QNetworkReply as part of providing a
        custom QNetworkAccessManager. But there's an API limitation in Qt 4.7, that makes
        QNetworkReply::isFinished() always be false for these custom replies. This was fixed in Qt
        4.8, see http://bugreports.qt.nokia.com/browse/QTBUG-11737.

        The consequence is that QtWebKit cannot rely on this function. So now QNetworkReplyWrapper
        watches for the finished() signal and set a dynamic property "_q_isFinished" on the reply
        indicating that it is finished. When there's no finished signal (synchronous) we set the
        dynamic property once we get the reply.

        This fixes tst_QWebFrame::requestedUrl(), that was breaking because sniffer was not
        emitting its own finished() signal, causing QWebFrame::loadFinished() to not be emitted.

        * platform/network/qt/QNetworkReplyHandler.cpp:
        (WebCore::QNetworkReplyWrapper::QNetworkReplyWrapper):
        Connect the finished signal to the new setFinished() slot.

        (WebCore::QNetworkReplyWrapper::synchronousLoad):
        Since we don't get the finished signal for synchronous loads, set the dynamic property
        before processing it.

        (WebCore::QNetworkReplyWrapper::resetConnections):
        Do not reset the connection to setFinished().

        (WebCore::QNetworkReplyWrapper::setFinished):
        Set the dynamic property in the reply.

        (WebCore::QNetworkReplyWrapper::emitMetaDataChanged):
        (WebCore::QNetworkReplyHandler::start):
        Change to use wrapper's isFinished() instead of asking the reply directly.

        * platform/network/qt/QNetworkReplyHandler.h:
        (WebCore::QNetworkReplyWrapper::isFinished):
        Checks the dynamic property of the reply.

        * platform/network/qt/QtMIMETypeSniffer.cpp:
        (QtMIMETypeSniffer::sniff):
        Use the dynamic property to check if the reply is finished.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85734 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp
Source/WebCore/platform/network/qt/QNetworkReplyHandler.h
Source/WebCore/platform/network/qt/QtMIMETypeSniffer.cpp