Skip to content

Commit

Permalink
Process all pending events before checking if page is loading
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mhoran committed Dec 1, 2012
1 parent b829103 commit 56fcecd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/TimeoutCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)));
Expand Down

0 comments on commit 56fcecd

Please sign in to comment.