summaryrefslogtreecommitdiffstats
path: root/src/webenginequick/api/qquickwebengineview.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-06 18:30:13 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-06-06 21:33:49 +0200
commit5dd4dd1d1f83157339bac1600228895cc0c86088 (patch)
tree15f04a636c1a2dfbc3b58a71772e0d872af5e90b /src/webenginequick/api/qquickwebengineview.cpp
parent163e262888f8d44d1c4405b420a6a58cb622aca8 (diff)
Replace testsupport's QQuickWebEngineErrorPage with isErrorPage
Merge and unify handling of loading started/finished for quick and widgets by removing separate quick's type for monitoring error page load and replace it with an isErrorPage method in WebEngineLoadRequest to indicate, that load ended with an error page being displayed. Effectively this only slightly changes when loading finished gets emitted: now the signal is just postponed until error page is finished loading after initial failure. [ChangeLog][QWebEngineQuick][WebEngineLoadingInfo] New property 'isErrorPage' which indicates that the load resulted in an error page Change-Id: I3e59dc488429d776f7c8e083b6d0489fb30a65fc Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/webenginequick/api/qquickwebengineview.cpp')
-rw-r--r--src/webenginequick/api/qquickwebengineview.cpp46
1 files changed, 6 insertions, 40 deletions
diff --git a/src/webenginequick/api/qquickwebengineview.cpp b/src/webenginequick/api/qquickwebengineview.cpp
index f457bb338..5a9e0f8fd 100644
--- a/src/webenginequick/api/qquickwebengineview.cpp
+++ b/src/webenginequick/api/qquickwebengineview.cpp
@@ -73,7 +73,6 @@
#include "render_widget_host_view_qt_delegate_quickwindow.h"
#include "ui_delegates_manager.h"
#include "web_contents_adapter.h"
-#include "web_engine_error.h"
#include "web_engine_settings.h"
#include <QClipboard>
@@ -455,22 +454,13 @@ QColor QQuickWebEngineViewPrivate::backgroundColor() const
return m_backgroundColor;
}
-void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage)
+void QQuickWebEngineViewPrivate::loadStarted(QWebEngineLoadingInfo info)
{
Q_Q(QQuickWebEngineView);
- if (isErrorPage) {
-#if QT_CONFIG(webenginequick_testsupport)
- if (m_testSupport)
- m_testSupport->errorPage()->loadStarted(provisionalUrl);
-#endif
- return;
- }
-
isLoading = true;
m_history->reset();
-
- QTimer::singleShot(0, q, [q, provisionalUrl]() {
- emit q->loadingChanged(QWebEngineLoadingInfo(provisionalUrl, LoadStatus::LoadStartedStatus));
+ QTimer::singleShot(0, q, [q, info] () {
+ emit q->loadingChanged(info);
});
}
@@ -505,37 +495,13 @@ void QQuickWebEngineViewPrivate::didCompositorFrameSwap()
#endif
}
-void QQuickWebEngineViewPrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription)
+void QQuickWebEngineViewPrivate::loadFinished(QWebEngineLoadingInfo info)
{
Q_Q(QQuickWebEngineView);
-
- if (isErrorPage) {
-#if QT_CONFIG(webenginequick_testsupport)
- if (m_testSupport)
- m_testSupport->errorPage()->loadFinished(success, url);
-#endif
- return;
- }
-
isLoading = false;
m_history->reset();
- if (errorCode == WebEngineError::UserAbortedError) {
- QTimer::singleShot(0, q, [q, url]() {
- emit q->loadingChanged(QWebEngineLoadingInfo(url, LoadStatus::LoadStoppedStatus));
- });
- return;
- }
- if (success) {
- QTimer::singleShot(0, q, [q, url, errorDescription, errorCode]() {
- emit q->loadingChanged(QWebEngineLoadingInfo(url, LoadStatus::LoadSucceededStatus, errorDescription, errorCode));
- });
- return;
- }
-
- Q_ASSERT(errorCode);
- auto errorDomain = static_cast<ErrorDomain>(WebEngineError::toQtErrorDomain(errorCode));
- QTimer::singleShot(0, q, [q, url, errorDescription, errorCode, errorDomain]() {
- emit q->loadingChanged(QWebEngineLoadingInfo(url, LoadStatus::LoadFailedStatus, errorDescription, errorCode, errorDomain));
+ QTimer::singleShot(0, q, [q, info] () {
+ emit q->loadingChanged(info);
});
return;
}