From b719da05c6429d72f4e0e0af44da0bf3f3e57984 Mon Sep 17 00:00:00 2001 From: Tamas Zakor Date: Mon, 9 Nov 2020 16:28:04 +0100 Subject: Stabilize load signals emitting Make the WebContentsDelegateQt::EmitLoadStarted() and the WebContentsDelegateQt::EmitLoadFinished() independent from the WebContentsDelegateQt::LoadProgressChanged() by removing m_lastLoadProgress. Adapt the WebContentsDelegateQt::LoadProgressChanged() to send signal only if load is in progress. Add a new test based on the bugreport. Fix qmltests::WebEngineViewSource::test_viewSourceURL() flaky tests. Fixes: QTBUG-65223 Fixes: QTBUG-87089 Change-Id: I90af4d2e85105dba801beb8102991eb4ef14c6a3 Reviewed-by: Allan Sandfeld Jensen --- tests/auto/shared/httpserver.cpp | 10 +++++++++- tests/auto/shared/httpserver.h | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'tests/auto/shared') diff --git a/tests/auto/shared/httpserver.cpp b/tests/auto/shared/httpserver.cpp index 67f491fac..69e8cb6cc 100644 --- a/tests/auto/shared/httpserver.cpp +++ b/tests/auto/shared/httpserver.cpp @@ -54,6 +54,7 @@ bool HttpServer::start() { m_error = false; m_expectingError = false; + m_ignoreNewConnection = false; if (!m_tcpServer->listen()) { qCWarning(gHttpServerLog).noquote() << m_tcpServer->errorString(); @@ -84,6 +85,9 @@ QUrl HttpServer::url(const QString &path) const void HttpServer::handleNewConnection() { + if (m_ignoreNewConnection) + return; + auto rr = new HttpReqRep(m_tcpServer->nextPendingConnection(), this); connect(rr, &HttpReqRep::requestReceived, [this, rr]() { Q_EMIT newRequest(rr); @@ -122,5 +126,9 @@ void HttpServer::handleNewConnection() << error; m_error = true; }); - connect(rr, &HttpReqRep::closed, rr, &QObject::deleteLater); + + if (!m_tcpServer->isListening()) { + m_ignoreNewConnection = true; + connect(rr, &HttpReqRep::closed, rr, &QObject::deleteLater); + } } diff --git a/tests/auto/shared/httpserver.h b/tests/auto/shared/httpserver.h index 9764852de..952ead220 100644 --- a/tests/auto/shared/httpserver.h +++ b/tests/auto/shared/httpserver.h @@ -90,6 +90,7 @@ private: QUrl m_url; QStringList m_dirs; bool m_error = false; + bool m_ignoreNewConnection = false; bool m_expectingError = false; }; -- cgit v1.2.3