Diff
Modified: trunk/LayoutTests/ChangeLog (134242 => 134243)
--- trunk/LayoutTests/ChangeLog 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/LayoutTests/ChangeLog 2012-11-12 16:13:01 UTC (rev 134243)
@@ -1,3 +1,14 @@
+2012-11-12 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Support ResourceRequest's setTimeoutInterval
+ https://bugs.webkit.org/show_bug.cgi?id=101731
+
+ Reviewed by Simon Hausmann.
+
+ Unskip now passing XHR timeout tests.
+
+ * platform/qt/TestExpectations:
+
2012-11-12 Vsevolod Vlasov <[email protected]>
Layout Test inspector/debugger/dynamic-scripts.html is flaky
Modified: trunk/LayoutTests/platform/qt/TestExpectations (134242 => 134243)
--- trunk/LayoutTests/platform/qt/TestExpectations 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2012-11-12 16:13:01 UTC (rev 134243)
@@ -675,19 +675,6 @@
# https://bugs.webkit.org/show_bug.cgi?id=86606
http/tests/xmlhttprequest/xmlhttprequest-check-get-readystate-for-404-without-body.html
-# ResourceRequest needs to support setTimeoutInterval
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-aborted.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-abortedonmain.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-overridesexpires.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-simple.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-synconmain.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-twice.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker-aborted.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker-overridesexpires.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker-simple.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker-synconworker.html
-webkit.org/b/98397 http/tests/xmlhttprequest/timeout/xmlhttprequest-timeout-worker-twice.html
-
# =========================================================================== #
# Failing editing/inserting tests. #
# =========================================================================== #
Modified: trunk/Source/WebCore/ChangeLog (134242 => 134243)
--- trunk/Source/WebCore/ChangeLog 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/Source/WebCore/ChangeLog 2012-11-12 16:13:01 UTC (rev 134243)
@@ -1,3 +1,24 @@
+2012-11-12 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Support ResourceRequest's setTimeoutInterval
+ https://bugs.webkit.org/show_bug.cgi?id=101731
+
+ Reviewed by Simon Hausmann.
+
+ Establish a timeout and return the correct error when it is triggered.
+
+ Tested by existing http/tests/xmlhttprequest/timeout tests.
+
+ * platform/network/ResourceRequestBase.cpp:
+ * platform/network/qt/QNetworkReplyHandler.cpp:
+ (WebCore::QNetworkReplyHandler::release):
+ (WebCore::QNetworkReplyHandler::finish):
+ (WebCore::QNetworkReplyHandler::timeout):
+ (WebCore::QNetworkReplyHandler::timerEvent):
+ (WebCore::QNetworkReplyHandler::start):
+ * platform/network/qt/QNetworkReplyHandler.h:
+ (QNetworkReplyHandler):
+
2012-11-12 Sheriff Bot <[email protected]>
Unreviewed, rolling out r134224.
Modified: trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp (134242 => 134243)
--- trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp 2012-11-12 16:13:01 UTC (rev 134243)
@@ -35,7 +35,7 @@
namespace WebCore {
-#if !USE(SOUP) && (!PLATFORM(MAC) || USE(CFNETWORK))
+#if !USE(SOUP) && (!PLATFORM(MAC) || USE(CFNETWORK)) && !PLATFORM(QT)
double ResourceRequestBase::s_defaultTimeoutInterval = INT_MAX;
#else
// Will use NSURLRequest default timeout unless set to a non-zero value with setDefaultTimeoutInterval().
Modified: trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp (134242 => 134243)
--- trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.cpp 2012-11-12 16:13:01 UTC (rev 134243)
@@ -514,6 +514,7 @@
if (!m_replyWrapper)
return 0;
+ m_timeoutTimer.stop();
QNetworkReply* reply = m_replyWrapper->release();
m_replyWrapper = nullptr;
return reply;
@@ -539,6 +540,7 @@
void QNetworkReplyHandler::finish()
{
ASSERT(m_replyWrapper && m_replyWrapper->reply() && !wasAborted());
+ m_timeoutTimer.stop();
ResourceHandleClient* client = m_resourceHandle->client();
if (!client) {
@@ -560,6 +562,38 @@
m_replyWrapper = nullptr;
}
+void QNetworkReplyHandler::timeout()
+{
+ if (!m_replyWrapper || wasAborted())
+ return;
+
+ // The request is already finished, but is probably just waiting in the queue to get processed.
+ // In this case we ignore the timeout and proceed as normal.
+ if (m_replyWrapper->isFinished())
+ return;
+
+ ResourceHandleClient* client = m_resourceHandle->client();
+ if (!client) {
+ m_replyWrapper.clear();
+ return;
+ }
+
+ ASSERT(m_replyWrapper->reply());
+
+ ResourceError timeoutError("QtNetwork", QNetworkReply::TimeoutError, m_replyWrapper->reply()->url().toString(), "Request timed out");
+ timeoutError.setIsTimeout(true);
+ client->didFail(m_resourceHandle, timeoutError);
+
+ m_replyWrapper.clear();
+}
+
+void QNetworkReplyHandler::timerEvent(QTimerEvent* timerEvent)
+{
+ ASSERT_UNUSED(timerEvent, timerEvent->timerId()== m_timeoutTimer.timerId());
+ m_timeoutTimer.stop();
+ timeout();
+}
+
void QNetworkReplyHandler::sendResponseIfNeeded()
{
ASSERT(m_replyWrapper && m_replyWrapper->reply() && !wasAborted());
@@ -781,6 +815,10 @@
return;
}
+ double timeoutInSeconds = d->m_firstRequest.timeoutInterval();
+ if (timeoutInSeconds > 0 && timeoutInSeconds < (INT_MAX / 1000))
+ m_timeoutTimer.start(timeoutInSeconds * 1000, this);
+
if (m_resourceHandle->firstRequest().reportUploadProgress())
connect(m_replyWrapper->reply(), SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(uploadProgress(qint64, qint64)));
}
Modified: trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h (134242 => 134243)
--- trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/Source/WebCore/platform/network/qt/QNetworkReplyHandler.h 2012-11-12 16:13:01 UTC (rev 134243)
@@ -24,6 +24,7 @@
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
+#include <QBasicTimer>
#include "FormData.h"
#include "QtMIMETypeSniffer.h"
@@ -147,12 +148,15 @@
QNetworkReply* sendNetworkRequest(QNetworkAccessManager*, const ResourceRequest&);
FormDataIODevice* getIODevice(const ResourceRequest&);
void clearContentHeaders();
+ virtual void timerEvent(QTimerEvent*) OVERRIDE;
+ void timeout();
OwnPtr<QNetworkReplyWrapper> m_replyWrapper;
ResourceHandle* m_resourceHandle;
LoadType m_loadType;
QNetworkAccessManager::Operation m_method;
QNetworkRequest m_request;
+ QBasicTimer m_timeoutTimer;
// defer state holding
int m_redirectionTries;
Modified: trunk/Tools/ChangeLog (134242 => 134243)
--- trunk/Tools/ChangeLog 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/Tools/ChangeLog 2012-11-12 16:13:01 UTC (rev 134243)
@@ -1,3 +1,14 @@
+2012-11-12 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] Support ResourceRequest's setTimeoutInterval
+ https://bugs.webkit.org/show_bug.cgi?id=101731
+
+ Reviewed by Simon Hausmann.
+
+ Enable XHR_TIMEOUT now that we support the necessary feature.
+
+ * qmake/mkspecs/features/features.pri:
+
2012-11-12 Gustavo Noronha Silva <[email protected]>
Unreviewed. Removing myself from the list of address to CC on EWS
Modified: trunk/Tools/qmake/mkspecs/features/features.pri (134242 => 134243)
--- trunk/Tools/qmake/mkspecs/features/features.pri 2012-11-12 16:06:49 UTC (rev 134242)
+++ trunk/Tools/qmake/mkspecs/features/features.pri 2012-11-12 16:13:01 UTC (rev 134243)
@@ -112,5 +112,5 @@
ENABLE_WEB_SOCKETS=1 \
ENABLE_WEB_TIMING=1 \
ENABLE_WORKERS=1 \
- ENABLE_XHR_TIMEOUT = 0 \
+ ENABLE_XHR_TIMEOUT=1 \
ENABLE_XSLT=0 \