* fast/dom/onerror-img.html regressed due checking the JobStates because in case...
authorhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Oct 2007 13:41:25 +0000 (13:41 +0000)
committerhausmann <hausmann@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 Oct 2007 13:41:25 +0000 (13:41 +0000)
* Use the error message from Qt. It might or might not be translated.

Signed-off-by: Simon Hausmann <hausmann@kde.org>
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27043 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/qt/ResourceHandleQt.cpp
WebKit/qt/Api/qwebnetworkinterface.cpp
WebKit/qt/Api/qwebnetworkinterface.h
WebKit/qt/Api/qwebnetworkinterface_p.h
WebKit/qt/ChangeLog

index ee48923ca1203dcbeb96f7cf8369e63b17352f98..87d59ca326eb9ff27491791c9b21cb6a56425545 100644 (file)
@@ -1,3 +1,16 @@
+2007-10-25  Holger Freyther  <zecke@selfish.org>
+
+        Reviewed by Simon Hausmann <hausmann@kde.org>.
+
+        * fast/dom/onerror-img.html regressed due checking the JobStates because in case of error (e.g. not being able to connect) the job will no be started.
+        * Use the error message from Qt. It might or might not be translated.
+        
+
+        WARNING: NO TEST CASES ADDED OR CHANGED
+
+        * platform/network/qt/ResourceHandleQt.cpp:
+        (WebCore::WebCoreSynchronousLoader::didFail):
+
 2007-10-25  Holger Freyther  <zecke@selfish.org>
 
         Reviewed by Simon Hausmann <hausmann@kde.org>.
index a84b05ae2020071d42f2c5661a4af898db9e589b..792050743ad857b0f531ccb1afa7a333e7c85f53 100644 (file)
@@ -91,6 +91,7 @@ void WebCoreSynchronousLoader::didFinishLoading(ResourceHandle*)
 void WebCoreSynchronousLoader::didFail(ResourceHandle*, const ResourceError& error)
 {
     m_error = error;
+    m_finished = true;
 }
 
 void WebCoreSynchronousLoader::waitForCompletion()
index 9414e63d77c143e099e97e38cb2370f61d4d03b9..7f3edfd9a84314c221cbd7afc32db5de66bd9874 100644 (file)
@@ -334,6 +334,14 @@ QHttpResponseHeader QWebNetworkJob::response() const
     return d->response;
 }
 
+/*!
+  The last error of the Job.
+*/
+QString QWebNetworkJob::errorString() const
+{
+    return d->errorString;
+}
+
 /*!
   Sets the HTTP reponse header. The response header has to be called before
   emitting QWebNetworkInterface::started.
@@ -343,6 +351,11 @@ void QWebNetworkJob::setResponse(const QHttpResponseHeader &response)
     d->response = response;
 }
 
+void QWebNetworkJob::setErrorString(const QString& errorString)
+{
+    d->errorString = errorString;
+}
+
 /*!
   returns true if the job has been cancelled by the WebKit framework
 */
@@ -588,7 +601,8 @@ void QWebNetworkManager::data(QWebNetworkJob *job, const QByteArray &data)
 
 void QWebNetworkManager::finished(QWebNetworkJob *job, int errorCode)
 {
-    Q_ASSERT(job->status() == QWebNetworkJob::JobStarted ||
+    Q_ASSERT(errorCode == 1 ||
+             job->status() == QWebNetworkJob::JobStarted ||
              job->status() == QWebNetworkJob::JobReceivingData);
 
     if (m_synchronousJobs.contains(job))
@@ -622,7 +636,7 @@ void QWebNetworkManager::finished(QWebNetworkJob *job, int errorCode)
             //FIXME: error setting error was removed from ResourceHandle
             client->didFail(job->d->resourceHandle,
                             ResourceError(job->d->request.url.host(), job->d->response.statusCode(),
-                                          job->d->request.url.toString(), String()));
+                                          job->d->request.url.toString(), job->d->errorString));
         } else {
             client->didFinishLoading(job->d->resourceHandle);
         }
@@ -819,7 +833,8 @@ void QWebNetworkManager::doWork()
             continue;
 
         // This job was not yet started... we have no idea if data comes by...
-        if (static_cast<int>(jobFinished->job->status()) < QWebNetworkJob::JobStarted)
+        // and it won't start in case of errors
+        if (static_cast<int>(jobFinished->job->status()) < QWebNetworkJob::JobStarted && jobFinished->errorCode != 1)
             continue;
 
         m_queueMutex.lock();
@@ -1151,8 +1166,10 @@ void WebCoreHttp::onRequestFinished(int id, bool error)
 
     QHttp *http = connection[c].http;
     DEBUG() << "WebCoreHttp::slotFinished connection=" << c << error << job;
-    if (error)
+    if (error) {
         DEBUG() << "   error: " << http->errorString();
+        job->setErrorString(http->errorString());
+    }
 
     if (!error && http->bytesAvailable()) {
         QByteArray data;
index 2cf1dabb9faac74e711950386e92fac460a1f879..113d9b30497dc5179d95bda68ababc717fca8df6 100644 (file)
@@ -90,9 +90,11 @@ public:
     QByteArray postData() const;
     QHttpRequestHeader httpHeader() const;
     QWebNetworkRequest request() const;
+    QString errorString() const;
 
     QHttpResponseHeader response() const;
     void setResponse(const QHttpResponseHeader &response);
+    void setErrorString(const QString&);
 
     bool cancelled() const;
 
index c49602ae1760885ac595004db8a414441b525c0a..41f5ab5673ce4335af888ef641c41a8e371b70f2 100644 (file)
@@ -70,6 +70,7 @@ public:
     QWebNetworkInterface *interface;
     QWebObjectPluginConnector *connector;
     QWebNetworkJob::JobStatus jobStatus;
+    QString errorString;
 };
 
 class QWebNetworkManager : public QObject
index 148a75e81f97f4fb98ce7e88f2d5c5ba44bc552e..d2975b27b76e6c3991d0c204866c3ce3e96cf960 100644 (file)
@@ -1,3 +1,20 @@
+2007-10-25  Holger Freyther  <zecke@selfish.org>
+
+        Reviewed by Simon Hausmann <hausmann@kde.org>.
+
+        * fast/dom/onerror-img.html regressed due checking the JobStates because in case of error (e.g. not being able to connect) the job will no be started.
+        * Use the error message from Qt. It might or might not be translated.
+        
+
+        * Api/qwebnetworkinterface.cpp:
+        (QWebNetworkJob::errorString):
+        (QWebNetworkJob::setErrorString):
+        (QWebNetworkManager::finished):
+        (QWebNetworkManager::doWork):
+        (WebCoreHttp::onRequestFinished):
+        * Api/qwebnetworkinterface.h:
+        * Api/qwebnetworkinterface_p.h:
+
 2007-10-25  Holger Freyther  <zecke@selfish.org>
 
         Reviewed by Simon Hausmann <hausmann@kde.org>.