From 56fcecdd16ed81d70046a818c3564bf02e56de5a Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Sat, 24 Nov 2012 05:08:33 -0500 Subject: [PATCH] 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. --- src/TimeoutCommand.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TimeoutCommand.cpp b/src/TimeoutCommand.cpp index 1d501b9..d2901e6 100644 --- a/src/TimeoutCommand.cpp +++ b/src/TimeoutCommand.cpp @@ -3,6 +3,7 @@ #include "WebPageManager.h" #include "WebPage.h" #include +#include 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)));