Changeset 91189 in webkit


Ignore:
Timestamp:
Jul 18, 2011 9:48:32 AM (13 years ago)
Author:
yi.4.shen@nokia.com
Message:

[Qt] ASSERTION FAILED in ResourceHandle::setDefersLoading causes crash
https://bugs.webkit.org/show_bug.cgi?id=62808

Source/WebCore:

The assertion in ResourceHandle::setDefersLoading assumes asynchronous
content delivery -- To resume a page, first, its main resource loader
calls setDefersLoading to resume loading the main content; then all the
sub-resource loaders calls setDefersLoading to resume sub-contents.
However, since QNetworkReplyHandler delivers content synchronously,
some new sub-resource loaders get created as soon as the main resource
loader resumed, and all these new sub-resource loaders set their
defersLoading flag to false. Then, the assertion fails for these new
sub-resource loaders when calling setDefersLoading on them. As a fix,
this path makes QNetworkReplyHandler deliver content asynchronously
when its load type is set to SynchronousLoad.

Reviewed by Benjamin Poulain.

Test: loader/load-defer-resume-crash.html

  • platform/network/qt/QNetworkReplyHandler.cpp:

(WebCore::QNetworkReplyHandlerCallQueue::setDeferSignals):

  • platform/network/qt/QNetworkReplyHandler.h:

(WebCore::QNetworkReplyHandler::setLoadingDeferred):

LayoutTests:

Added a test for the crash occurs when load deferring is turned off.

Reviewed by Benjamin Poulain.

  • loader/load-defer-resume-crash-expected.txt: Added.
  • loader/load-defer-resume-crash.html: Added.
  • loader/resources/images.html: Added.
  • platform/chromium/test_expectations.txt: Skip this test since the LayoutTestController::setDefersLoading is not implemented for chromium.
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r91187 r91189  
     12011-07-18  Yi Shen  <yi.4.shen@nokia.com>
     2
     3        [Qt] ASSERTION FAILED in ResourceHandle::setDefersLoading causes crash
     4        https://bugs.webkit.org/show_bug.cgi?id=62808
     5
     6        Added a test for the crash occurs when load deferring is turned off.
     7
     8        Reviewed by Benjamin Poulain.
     9
     10        * loader/load-defer-resume-crash-expected.txt: Added.
     11        * loader/load-defer-resume-crash.html: Added.
     12        * loader/resources/images.html: Added.
     13        * platform/chromium/test_expectations.txt: Skip this test since the LayoutTestController::setDefersLoading is not implemented for chromium.
     14
    1152011-07-18  Young Han Lee  <joybro@company100.net>
    216
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r91186 r91189  
    161161// Unskip after implementing LayoutTestController::setDefersLoading and ::goBack.
    162162BUGWK60877 SKIP : loader/navigation-while-deferring-loads.html = FAIL
     163BUGWK60877 SKIP : loader/load-defer-resume-crash.html = FAIL
    163164
    164165// Skipped until new WebSocket protocol is implemented.
  • trunk/Source/WebCore/ChangeLog

    r91187 r91189  
     12011-07-18  Yi Shen  <yi.4.shen@nokia.com>
     2
     3        [Qt] ASSERTION FAILED in ResourceHandle::setDefersLoading causes crash
     4        https://bugs.webkit.org/show_bug.cgi?id=62808
     5
     6        The assertion in ResourceHandle::setDefersLoading assumes asynchronous
     7        content delivery -- To resume a page, first, its main resource loader
     8        calls setDefersLoading to resume loading the main content; then all the
     9        sub-resource loaders calls setDefersLoading to resume sub-contents.
     10        However, since QNetworkReplyHandler delivers content synchronously,
     11        some new sub-resource loaders get created as soon as the main resource
     12        loader resumed, and all these new sub-resource loaders set their
     13        defersLoading flag to false. Then, the assertion fails for these new
     14        sub-resource loaders when calling setDefersLoading on them. As a fix,
     15        this path makes QNetworkReplyHandler deliver content asynchronously
     16        when its load type is set to SynchronousLoad.
     17
     18        Reviewed by Benjamin Poulain.
     19
     20        Test: loader/load-defer-resume-crash.html
     21
     22        * platform/network/qt/QNetworkReplyHandler.cpp:
     23        (WebCore::QNetworkReplyHandlerCallQueue::setDeferSignals):
     24        * platform/network/qt/QNetworkReplyHandler.h:
     25        (WebCore::QNetworkReplyHandler::setLoadingDeferred):
     26
    1272011-07-18  Young Han Lee  <joybro@company100.net>
    228
  • trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp

    r90784 r91189  
    179179}
    180180
    181 void QNetworkReplyHandlerCallQueue::setDeferSignals(bool defer)
     181void QNetworkReplyHandlerCallQueue::setDeferSignals(bool defer, bool sync)
    182182{
    183183    m_deferSignals = defer;
    184     flush();
     184    if (sync)
     185        flush();
     186    else
     187        QMetaObject::invokeMethod(this, "flush",  Qt::QueuedConnection);
    185188}
    186189
  • trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h

    r90784 r91189  
    4242class QNetworkReplyHandler;
    4343
    44 class QNetworkReplyHandlerCallQueue {
     44class QNetworkReplyHandlerCallQueue : public QObject {
     45    Q_OBJECT
    4546public:
    4647    QNetworkReplyHandlerCallQueue(QNetworkReplyHandler*, bool deferSignals);
    4748    bool deferSignals() const { return m_deferSignals; }
    48     void setDeferSignals(bool);
     49    void setDeferSignals(bool, bool sync = false);
    4950
    5051    typedef void (QNetworkReplyHandler::*EnqueuedCall)();
     
    6162    QList<EnqueuedCall> m_enqueuedCalls;
    6263
    63     void flush();
     64    Q_INVOKABLE void flush();
    6465};
    6566
     
    121122
    122123    QNetworkReplyHandler(ResourceHandle*, LoadType, bool deferred = false);
    123     void setLoadingDeferred(bool deferred) { m_queue.setDeferSignals(deferred); }
     124    void setLoadingDeferred(bool deferred) { m_queue.setDeferSignals(deferred, m_loadType == SynchronousLoad); }
    124125
    125126    QNetworkReply* reply() const { return m_replyWrapper ? m_replyWrapper->reply() : 0; }
Note: See TracChangeset for help on using the changeset viewer.