[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
jocelyn.turcotte at nokia.com
jocelyn.turcotte at nokia.com
Wed Dec 22 14:45:11 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 648128de536046de58a4f2a06404941d5060a1ce
Author: jocelyn.turcotte at nokia.com <jocelyn.turcotte at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 19 10:34:56 2010 +0000
[Qt] QtTestBrowser: Prevent calling load() directly from loadFinished() in robot mode.
https://bugs.webkit.org/show_bug.cgi?id=47809
Reviewed by Andreas Kling.
Connecting a call to load from the loadFinished signal can cause
re-entrance crashes in WebCore. This patch uses a timer to do so,
also giving some time to subsequent frames to finish loading.
* QtTestBrowser/urlloader.cpp:
(UrlLoader::UrlLoader):
(UrlLoader::loadNext):
(UrlLoader::checkIfFinished):
(UrlLoader::frameLoadStarted):
(UrlLoader::frameLoadFinished):
* QtTestBrowser/urlloader.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70044 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index dec0cfc..88f5b0f 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,22 @@
+2010-10-18 Jocelyn Turcotte <jocelyn.turcotte at nokia.com>
+
+ Reviewed by Andreas Kling.
+
+ [Qt] QtTestBrowser: Prevent calling load() directly from loadFinished() in robot mode.
+ https://bugs.webkit.org/show_bug.cgi?id=47809
+
+ Connecting a call to load from the loadFinished signal can cause
+ re-entrance crashes in WebCore. This patch uses a timer to do so,
+ also giving some time to subsequent frames to finish loading.
+
+ * QtTestBrowser/urlloader.cpp:
+ (UrlLoader::UrlLoader):
+ (UrlLoader::loadNext):
+ (UrlLoader::checkIfFinished):
+ (UrlLoader::frameLoadStarted):
+ (UrlLoader::frameLoadFinished):
+ * QtTestBrowser/urlloader.h:
+
2010-10-19 Sergio Villar Senín <svillar at igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebKitTools/QtTestBrowser/urlloader.cpp b/WebKitTools/QtTestBrowser/urlloader.cpp
index abe9902..2ae722b 100644
--- a/WebKitTools/QtTestBrowser/urlloader.cpp
+++ b/WebKitTools/QtTestBrowser/urlloader.cpp
@@ -30,12 +30,21 @@
#include <QFile>
#include <QDebug>
+#include <QWebPage>
UrlLoader::UrlLoader(QWebFrame* frame, const QString& inputFileName, int timeoutSeconds, int extraTimeSeconds)
: m_frame(frame)
, m_stdOut(stdout)
, m_loaded(0)
+ , m_numFramesLoading(0)
{
+ m_checkIfFinishedTimer.setInterval(200);
+ 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_frame->page(), SIGNAL(loadStarted()), this, SLOT(frameLoadStarted()));
+ connect(m_frame->page(), SIGNAL(loadFinished(bool)), this, SLOT(frameLoadFinished()));
+
if (timeoutSeconds) {
m_timeoutTimer.setInterval(timeoutSeconds * 1000);
m_timeoutTimer.setSingleShot(true);
@@ -45,10 +54,10 @@ UrlLoader::UrlLoader(QWebFrame* frame, const QString& inputFileName, int timeout
if (extraTimeSeconds) {
m_extraTimeTimer.setInterval(extraTimeSeconds * 1000);
m_extraTimeTimer.setSingleShot(true);
- connect(frame, SIGNAL(loadFinished(bool)), &m_extraTimeTimer, SLOT(start()));
+ connect(this, SIGNAL(pageLoadFinished()), &m_extraTimeTimer, SLOT(start()));
connect(&m_extraTimeTimer, SIGNAL(timeout()), this, SLOT(loadNext()));
} else
- connect(frame, SIGNAL(loadFinished(bool)), this, SLOT(loadNext()));
+ connect(this, SIGNAL(pageLoadFinished()), this, SLOT(loadNext()));
loadUrlList(inputFileName);
}
@@ -56,6 +65,8 @@ void UrlLoader::loadNext()
{
m_timeoutTimer.stop();
m_extraTimeTimer.stop();
+ m_checkIfFinishedTimer.stop();
+ m_numFramesLoading = 0;
QString qstr;
if (getUrl(qstr)) {
QUrl url(qstr, QUrl::StrictMode);
@@ -68,6 +79,27 @@ void UrlLoader::loadNext()
disconnect(m_frame, 0, this, 0);
}
+void UrlLoader::checkIfFinished()
+{
+ if (!m_numFramesLoading)
+ emit pageLoadFinished();
+}
+
+void UrlLoader::frameLoadStarted()
+{
+ ++m_numFramesLoading;
+ m_checkIfFinishedTimer.stop();
+}
+
+void UrlLoader::frameLoadFinished()
+{
+ Q_ASSERT(m_numFramesLoading > 0);
+ --m_numFramesLoading;
+ // Once our frame has finished loading, wait a moment to call loadNext for cases
+ // where a sub-frame starts loading or another frame is loaded through JavaScript.
+ m_checkIfFinishedTimer.start();
+}
+
void UrlLoader::loadUrlList(const QString& inputFileName)
{
QFile inputFile(inputFileName);
diff --git a/WebKitTools/QtTestBrowser/urlloader.h b/WebKitTools/QtTestBrowser/urlloader.h
index e2a6d87..8ce24c0 100644
--- a/WebKitTools/QtTestBrowser/urlloader.h
+++ b/WebKitTools/QtTestBrowser/urlloader.h
@@ -44,6 +44,14 @@ public:
public slots:
void loadNext();
+private slots:
+ void checkIfFinished();
+ void frameLoadStarted();
+ void frameLoadFinished();
+
+signals:
+ void pageLoadFinished();
+
private:
void loadUrlList(const QString& inputFileName);
bool getUrl(QString& qstr);
@@ -56,6 +64,8 @@ private:
int m_loaded;
QTimer m_timeoutTimer;
QTimer m_extraTimeTimer;
+ QTimer m_checkIfFinishedTimer;
+ int m_numFramesLoading;
};
#endif
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list