Process all pending events before checking if page is loading

JavaScipt actions and other asynchronous events which cause a WebPage
load may not be processed by the time we receive an incoming command.
Ensure that these events get processed before checking if the page is
loading by calling QApplication::processEvents().

Fixes spurious failures throughout the test suite.
This commit is contained in:
Matthew Horan 2012-11-24 05:08:33 -05:00
parent b829103bbd
commit 56fcecdd16
1 changed files with 2 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#include "WebPageManager.h"
#include "WebPage.h"
#include <QTimer>
#include <QApplication>
TimeoutCommand::TimeoutCommand(Command *command, WebPageManager *manager, QObject *parent) : Command(parent) {
m_command = command;
@ -14,6 +15,7 @@ TimeoutCommand::TimeoutCommand(Command *command, WebPageManager *manager, QObjec
}
void TimeoutCommand::start() {
QApplication::processEvents();
if (m_manager->isLoading()) {
m_manager->logger() << this->toString() << "waiting for load to finish";
connect(m_manager, SIGNAL(pageFinished(bool)), this, SLOT(pendingLoadFinished(bool)));