[Qt] UrlLoader::loadNext is broken in MiniBrowser
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2013 02:44:43 +0000 (02:44 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2013 02:44:43 +0000 (02:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=116099

Patch by Hyungchan Kim <hyungchan2.kim@lge.com> on 2013-05-16
Reviewed by Jocelyn Turcotte.

QQuickWebView's 3 signals(loadStarted, loadSucceeded, loadFailed)
are not available any more. So, UrlLoader::loadNext was broken
because it failed to connect to those signals.

* MiniBrowser/qt/UrlLoader.cpp:
(UrlLoader::UrlLoader):
(UrlLoader::loadingChanged):
* MiniBrowser/qt/UrlLoader.h:
(UrlLoader):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150229 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/MiniBrowser/qt/UrlLoader.cpp
Tools/MiniBrowser/qt/UrlLoader.h

index ed8d8997fdc4d83b32a36c13ee247b7f77c845a6..7dc45ca791a371544163d658197fed8e841d0934 100644 (file)
@@ -1,3 +1,20 @@
+2013-05-16  Hyungchan Kim  <hyungchan2.kim@lge.com>
+
+        [Qt] UrlLoader::loadNext is broken in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=116099
+
+        Reviewed by Jocelyn Turcotte.
+
+        QQuickWebView's 3 signals(loadStarted, loadSucceeded, loadFailed)
+        are not available any more. So, UrlLoader::loadNext was broken
+        because it failed to connect to those signals.
+
+        * MiniBrowser/qt/UrlLoader.cpp:
+        (UrlLoader::UrlLoader):
+        (UrlLoader::loadingChanged):
+        * MiniBrowser/qt/UrlLoader.h:
+        (UrlLoader):
+
 2013-05-16  Lamarque V. Souza  <Lamarque.Souza@basyskom.com>
 
         [WebSocket] Update pywebsocket to r760
index 8b330fdb93ff22c340efae8dfbad161b3b166b08..a0658e983cd926465296f374b0d0963ddf9793ef 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "UrlLoader.h"
 #include "private/qquickwebview_p.h"
+#include "private/qwebloadrequest_p.h"
 
 #include <QDebug>
 #include <QFile>
@@ -42,14 +43,14 @@ UrlLoader::UrlLoader(BrowserWindow* browserWindow, const QString& inputFileName,
     m_checkIfFinishedTimer.setSingleShot(true);
     connect(&m_checkIfFinishedTimer, SIGNAL(timeout()), this, SLOT(checkIfFinished()));
     // loadStarted and loadFinished on QWebPage is emitted for each frame/sub-frame
-    connect(m_browserWindow->webView(), SIGNAL(loadStarted()), this, SLOT(frameLoadStarted()));
-    connect(m_browserWindow->webView(), SIGNAL(loadSucceeded()), this, SLOT(frameLoadFinished()));
-    connect(m_browserWindow->webView(), SIGNAL(loadFailed(QDesktopWebView::ErrorType, int, const QUrl&)), this, SLOT(frameLoadFinished()));
+    connect(m_browserWindow->webView(), SIGNAL(loadingChanged(QWebLoadRequest*)), this, SLOT(loadingChanged(QWebLoadRequest*)));
+    connect(this, SIGNAL(loadStarted()), this, SLOT(frameLoadStarted()));
+    connect(this, SIGNAL(loadFinished()), this, SLOT(frameLoadFinished()));
 
     if (timeoutSeconds) {
         m_timeoutTimer.setInterval(timeoutSeconds * 1000);
         m_timeoutTimer.setSingleShot(true);
-        connect(m_browserWindow->webView(), SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start()));
+        connect(this, SIGNAL(loadStarted()), &m_timeoutTimer, SLOT(start()));
         connect(&m_timeoutTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
     }
     if (extraTimeSeconds) {
@@ -129,3 +130,18 @@ bool UrlLoader::getUrl(QString& qstr)
     qstr = m_urls[m_index++];
     return true;
 }
+
+void UrlLoader::loadingChanged(QWebLoadRequest* loadRequest)
+{
+    switch (loadRequest->status()) {
+    case QQuickWebView::LoadStartedStatus:
+        emit loadStarted();
+        break;
+    case QQuickWebView::LoadStoppedStatus:
+    case QQuickWebView::LoadSucceededStatus:
+    case QQuickWebView::LoadFailedStatus:
+    default:
+        emit loadFinished();
+        break;
+    }
+}
index 8ac58dfdd9fe2cd5afb1b923fb3fe9aafdbe3178..a64548a0234fbba03f7fa05283bf3e4c57cc874e 100644 (file)
@@ -35,6 +35,8 @@
 #include <QTimer>
 #include <QVector>
 
+class QWebLoadRequest;
+
 class UrlLoader : public QObject {
     Q_OBJECT
 
@@ -48,9 +50,12 @@ private Q_SLOTS:
     void checkIfFinished();
     void frameLoadStarted();
     void frameLoadFinished();
+    void loadingChanged(QWebLoadRequest*);
 
 Q_SIGNALS:
     void pageLoadFinished();
+    void loadStarted();
+    void loadFinished();
 
 private:
     void loadUrlList(const QString& inputFileName);