Commit 7fb530e0 authored by yi.4.shen@nokia.com's avatar yi.4.shen@nokia.com

[Qt] ASSERTION FAILED in ResourceHandle::setDefersLoading causes crash

https://bugs.webkit.org/show_bug.cgi?id=62808

Source/WebCore:

Reviewed by Benjamin Poulain.

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.

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

* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyHandlerCallQueue::setDeferSignals):
* platform/network/qt/QNetworkReplyHandler.h:

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@90779 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d3a54683
2011-07-11 Yi Shen <yi.4.shen@nokia.com>
[Qt] ASSERTION FAILED in ResourceHandle::setDefersLoading causes crash
https://bugs.webkit.org/show_bug.cgi?id=62808
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.
2011-07-11 Stephen White <senorblanco@chromium.org>
Unreviewed; chromium test expectations update.
For the test to pass there should be no crash.
<html>
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
layoutTestController.waitUntilDone();
}
function run() {
var frameElement = document.createElement('iframe')
frameElement.setAttribute("src", "resources/images.html");
document.getElementById("frameDiv").appendChild(frameElement);
if (window.layoutTestController) {
layoutTestController.setDefersLoading(true);
setTimeout("layoutTestController.setDefersLoading(false);layoutTestController.notifyDone();",1000);
} else
alert("Deferring loads");
}
</script>
<body onload='run()'>
<p>For the test to pass there should be no crash.</p>
<div id="frameDiv"></div>
</body>
</html>
<html>
<body>
<img border="0" src="image1.png"/>
<img border="0" src="image2.png"/>
</body>
</html>
......@@ -212,6 +212,7 @@ WONTFIX SKIP : animations/animation-api-1.html = FAIL
// Unskip after implementing LayoutTestController::setDefersLoading and ::goBack.
BUGWK60877 SKIP : loader/navigation-while-deferring-loads.html = FAIL
BUGWK60877 SKIP : loader/load-defer-resume-crash.html = FAIL
// Skipped until new WebSocket protocol is implemented.
BUGWK50099 SKIP : http/tests/websocket/tests/hybi/ = PASS FAIL TIMEOUT
......
2011-07-11 Yi Shen <yi.4.shen@nokia.com>
[Qt] ASSERTION FAILED in ResourceHandle::setDefersLoading causes crash
https://bugs.webkit.org/show_bug.cgi?id=62808
Reviewed by Benjamin Poulain.
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.
Test: loader/load-defer-resume-crash.html
* platform/network/qt/QNetworkReplyHandler.cpp:
(WebCore::QNetworkReplyHandlerCallQueue::setDeferSignals):
* platform/network/qt/QNetworkReplyHandler.h:
2011-07-08 Ryosuke Niwa <rniwa@webkit.org>
Move innerTextElement() from RenderTextControl to HTMLTextFormControlElement
......@@ -181,7 +181,7 @@ void QNetworkReplyHandlerCallQueue::unlock()
void QNetworkReplyHandlerCallQueue::setDeferSignals(bool defer)
{
m_deferSignals = defer;
flush();
QMetaObject::invokeMethod(this, "flush", Qt::QueuedConnection);
}
void QNetworkReplyHandlerCallQueue::flush()
......
......@@ -41,7 +41,8 @@ class ResourceRequest;
class ResourceResponse;
class QNetworkReplyHandler;
class QNetworkReplyHandlerCallQueue {
class QNetworkReplyHandlerCallQueue : public QObject {
Q_OBJECT
public:
QNetworkReplyHandlerCallQueue(QNetworkReplyHandler*, bool deferSignals);
bool deferSignals() const { return m_deferSignals; }
......@@ -60,7 +61,7 @@ private:
bool m_flushing;
QList<EnqueuedCall> m_enqueuedCalls;
void flush();
Q_INVOKABLE void flush();
};
class QNetworkReplyWrapper : public QObject {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment