summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/core/api/qwebengineloadinginfo.cpp23
-rw-r--r--src/core/api/qwebengineloadinginfo.h15
-rw-r--r--src/core/api/qwebenginepage.cpp21
-rw-r--r--src/core/api/qwebenginepage_p.h4
-rw-r--r--src/core/web_contents_adapter.cpp13
-rw-r--r--src/core/web_contents_adapter_client.h5
-rw-r--r--src/core/web_contents_delegate_qt.cpp33
-rw-r--r--src/core/web_contents_delegate_qt.h1
-rw-r--r--src/webenginequick/api/qquickwebenginetestsupport.cpp27
-rw-r--r--src/webenginequick/api/qquickwebenginetestsupport_p.h16
-rw-r--r--src/webenginequick/api/qquickwebengineview.cpp46
-rw-r--r--src/webenginequick/api/qquickwebengineview_p_p.h4
-rw-r--r--src/webenginequick/testsupport/plugin.cpp2
-rw-r--r--src/webenginequick/testsupport/plugins.qmltypes17
14 files changed, 79 insertions, 148 deletions
diff --git a/src/core/api/qwebengineloadinginfo.cpp b/src/core/api/qwebengineloadinginfo.cpp
index fcbb2ce7a..03a31ab72 100644
--- a/src/core/api/qwebengineloadinginfo.cpp
+++ b/src/core/api/qwebengineloadinginfo.cpp
@@ -56,9 +56,11 @@ Q_STATIC_ASSERT(static_cast<int>(WebEngineError::DnsErrorDomain) == static_cast<
class QWebEngineLoadingInfo::QWebEngineLoadingInfoPrivate : public QSharedData {
public:
- QWebEngineLoadingInfoPrivate(const QUrl& url, LoadStatus status, const QString& errorString, int errorCode, ErrorDomain errorDomain)
+ QWebEngineLoadingInfoPrivate(const QUrl& url, LoadStatus status, bool isErrorPage,
+ const QString& errorString, int errorCode, ErrorDomain errorDomain)
: url(url)
, status(status)
+ , isErrorPage(isErrorPage)
, errorString(errorString)
, errorCode(errorCode)
, errorDomain(errorDomain)
@@ -67,6 +69,7 @@ public:
QUrl url;
LoadStatus status;
+ bool isErrorPage;
QString errorString;
int errorCode;
ErrorDomain errorDomain;
@@ -83,9 +86,9 @@ public:
\sa QWebEnginePage::loadStarted, QWebEnginePage::loadFinished, WebEngineView::loadingChanged
*/
-QWebEngineLoadingInfo::QWebEngineLoadingInfo(const QUrl& url, LoadStatus status, const QString& errorString,
- int errorCode, ErrorDomain errorDomain)
- : d_ptr(new QWebEngineLoadingInfoPrivate(url, status, errorString, errorCode, errorDomain))
+QWebEngineLoadingInfo::QWebEngineLoadingInfo(const QUrl& url, LoadStatus status, bool isErrorPage,
+ const QString& errorString, int errorCode, ErrorDomain errorDomain)
+ : d_ptr(new QWebEngineLoadingInfoPrivate(url, status, isErrorPage, errorString, errorCode, errorDomain))
{
}
@@ -133,6 +136,18 @@ LoadStatus QWebEngineLoadingInfo::status() const
return d->status;
}
/*!
+ \property QWebEngineLoadingInfo::isErrorPage
+ \property Indicates if the load's resulted in an error page.
+*/
+/*!
+ Returns true if the load's resulted is an error page.
+*/
+bool QWebEngineLoadingInfo::isErrorPage() const
+{
+ Q_D(const QWebEngineLoadingInfo);
+ return d->isErrorPage;
+}
+/*!
\property QWebEngineLoadingInfo::errorString
\brief Holds the error message.
*/
diff --git a/src/core/api/qwebengineloadinginfo.h b/src/core/api/qwebengineloadinginfo.h
index bd07d52a3..8aacb0281 100644
--- a/src/core/api/qwebengineloadinginfo.h
+++ b/src/core/api/qwebengineloadinginfo.h
@@ -45,12 +45,18 @@
#include <QObject>
#include <QUrl>
+namespace QtWebEngineCore {
+class WebContentsAdapter;
+class WebContentsDelegateQt;
+}
+
QT_BEGIN_NAMESPACE
class Q_WEBENGINECORE_EXPORT QWebEngineLoadingInfo
{
Q_GADGET
Q_PROPERTY(QUrl url READ url CONSTANT FINAL)
+ Q_PROPERTY(bool isErrorPage READ isErrorPage CONSTANT FINAL)
Q_PROPERTY(LoadStatus status READ status CONSTANT FINAL)
Q_PROPERTY(QString errorString READ errorString CONSTANT FINAL)
Q_PROPERTY(ErrorDomain errorDomain READ errorDomain CONSTANT FINAL)
@@ -83,19 +89,22 @@ public:
~QWebEngineLoadingInfo();
QUrl url() const;
+ bool isErrorPage() const;
LoadStatus status() const;
QString errorString() const;
ErrorDomain errorDomain() const;
int errorCode() const;
private:
- QWebEngineLoadingInfo(const QUrl& url, LoadStatus status, const QString& errorString = QString(),
- int errorCode = 0, ErrorDomain errorDomain = NoErrorDomain);
+ QWebEngineLoadingInfo(const QUrl& url, LoadStatus status,
+ bool isErrorPage = false, const QString& errorString = QString(),
+ int errorCode = 0, ErrorDomain errorDomain = NoErrorDomain);
class QWebEngineLoadingInfoPrivate;
Q_DECLARE_PRIVATE(QWebEngineLoadingInfo)
QExplicitlySharedDataPointer<QWebEngineLoadingInfoPrivate> d_ptr;
friend class QQuickWebEngineViewPrivate;
- friend class QQuickWebEngineErrorPage;
+ friend class QtWebEngineCore::WebContentsAdapter;
+ friend class QtWebEngineCore::WebContentsDelegateQt;
};
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginepage.cpp b/src/core/api/qwebenginepage.cpp
index 460b5a351..5298849f8 100644
--- a/src/core/api/qwebenginepage.cpp
+++ b/src/core/api/qwebenginepage.cpp
@@ -52,6 +52,7 @@
#include "qwebenginefullscreenrequest.h"
#include "qwebenginehistory.h"
#include "qwebenginehistory_p.h"
+#include "qwebengineloadinginfo.h"
#include "qwebenginenavigationrequest.h"
#include "qwebenginenewwindowrequest.h"
#include "qwebenginenotification.h"
@@ -300,31 +301,19 @@ QColor QWebEnginePagePrivate::backgroundColor() const
return m_backgroundColor;
}
-void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage)
+void QWebEnginePagePrivate::loadStarted(QWebEngineLoadingInfo /* info */)
{
- Q_UNUSED(provisionalUrl);
Q_Q(QWebEnginePage);
-
- if (isErrorPage)
- return;
-
isLoading = true;
-
QTimer::singleShot(0, q, &QWebEnginePage::loadStarted);
}
-void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription)
+void QWebEnginePagePrivate::loadFinished(QWebEngineLoadingInfo info)
{
Q_Q(QWebEnginePage);
- Q_UNUSED(url);
- Q_UNUSED(errorCode);
- Q_UNUSED(errorDescription);
-
- if (isErrorPage)
- return;
-
isLoading = false;
- QTimer::singleShot(0, q, [q, success](){
+ bool success = info.status() == QWebEngineLoadingInfo::LoadSucceededStatus;
+ QTimer::singleShot(0, q, [q, success] () {
emit q->loadFinished(success);
});
}
diff --git a/src/core/api/qwebenginepage_p.h b/src/core/api/qwebenginepage_p.h
index a830028f8..46dcf2ce8 100644
--- a/src/core/api/qwebenginepage_p.h
+++ b/src/core/api/qwebenginepage_p.h
@@ -134,10 +134,10 @@ public:
void renderProcessPidChanged(qint64 pid) override;
QRectF viewportRect() const override;
QColor backgroundColor() const override;
- void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
+ void loadStarted(QWebEngineLoadingInfo info) override;
void loadCommitted() override { }
void didFirstVisuallyNonEmptyPaint() override { }
- void loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription) override;
+ void loadFinished(QWebEngineLoadingInfo info) override;
void focusContainer() override;
void unhandledKeyEvent(QKeyEvent *event) override;
QSharedPointer<QtWebEngineCore::WebContentsAdapter>
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp
index 16e91e6c7..4c156644d 100644
--- a/src/core/web_contents_adapter.cpp
+++ b/src/core/web_contents_adapter.cpp
@@ -55,6 +55,7 @@
#include "profile_adapter.h"
#include "profile_qt.h"
#include "qwebenginecallback_p.h"
+#include "qwebengineloadinginfo.h"
#include "renderer_host/web_engine_page_host.h"
#include "render_widget_host_view_qt.h"
#include "type_conversion.h"
@@ -721,10 +722,11 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request)
params.load_type = content::NavigationController::LOAD_TYPE_HTTP_POST;
// chromium accepts LOAD_TYPE_HTTP_POST only for the HTTP and HTTPS protocols
if (!params.url.SchemeIsHTTPOrHTTPS()) {
- m_adapterClient->loadFinished(false, request.url(), false,
- net::ERR_DISALLOWED_URL_SCHEME,
- QCoreApplication::translate("WebContentsAdapter",
- "HTTP-POST data can only be sent over HTTP(S) protocol"));
+ m_adapterClient->loadFinished(QWebEngineLoadingInfo(
+ request.url(), QWebEngineLoadingInfo::LoadFailedStatus, false,
+ QCoreApplication::translate("WebContentsAdapter",
+ "HTTP-POST data can only be sent over HTTP(S) protocol"),
+ net::ERR_DISALLOWED_URL_SCHEME));
return;
}
params.post_data = network::ResourceRequestBody::CreateFromBytes(
@@ -779,7 +781,8 @@ void WebContentsAdapter::setContent(const QByteArray &data, const QString &mimeT
GURL dataUrlToLoad(urlString);
if (dataUrlToLoad.spec().size() > url::kMaxURLChars) {
- m_adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED, QString());
+ m_adapterClient->loadFinished(QWebEngineLoadingInfo(baseUrl, QWebEngineLoadingInfo::LoadFailedStatus,
+ false, QString(), net::ERR_ABORTED));
return;
}
content::NavigationController::LoadURLParams params((dataUrlToLoad));
diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h
index b0bddf5b8..42a5a3ab0 100644
--- a/src/core/web_contents_adapter_client.h
+++ b/src/core/web_contents_adapter_client.h
@@ -64,6 +64,7 @@
QT_FORWARD_DECLARE_CLASS(QKeyEvent)
QT_FORWARD_DECLARE_CLASS(QVariant)
QT_FORWARD_DECLARE_CLASS(QWebEngineFindTextResult)
+QT_FORWARD_DECLARE_CLASS(QWebEngineLoadingInfo)
QT_FORWARD_DECLARE_CLASS(QWebEngineQuotaRequest)
QT_FORWARD_DECLARE_CLASS(QWebEngineRegisterProtocolHandlerRequest)
QT_FORWARD_DECLARE_CLASS(QWebEngineUrlRequestInfo)
@@ -192,10 +193,10 @@ public:
virtual void renderProcessPidChanged(qint64 pid) = 0;
virtual QRectF viewportRect() const = 0;
virtual QColor backgroundColor() const = 0;
- virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) = 0;
+ virtual void loadStarted(QWebEngineLoadingInfo info) = 0;
virtual void loadCommitted() = 0;
virtual void didFirstVisuallyNonEmptyPaint() = 0;
- virtual void loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription) = 0;
+ virtual void loadFinished(QWebEngineLoadingInfo info) = 0;
virtual void focusContainer() = 0;
virtual void unhandledKeyEvent(QKeyEvent *event) = 0;
virtual QSharedPointer<WebContentsAdapter>
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 34e1f7ad1..a04ef700b 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -49,6 +49,7 @@
#include "file_picker_controller.h"
#include "media_capture_devices_dispatcher.h"
#include "profile_qt.h"
+#include "qwebengineloadinginfo.h"
#include "qwebengineregisterprotocolhandlerrequest.h"
#include "register_protocol_handler_request_controller_impl.h"
#include "render_widget_host_view_qt.h"
@@ -58,6 +59,7 @@
#include "web_contents_adapter.h"
#include "web_contents_view_qt.h"
#include "web_engine_context.h"
+#include "web_engine_error.h"
#include "web_engine_settings.h"
#include "certificate_error_controller.h"
#include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
@@ -344,11 +346,9 @@ void WebContentsDelegateQt::emitLoadStarted(bool isErrorPage)
m_isDocumentEmpty = true; // reset to default which may only be overridden on actual resource load complete
if (!isErrorPage) {
m_loadingInfo.progress = 0;
- m_viewClient->loadStarted(m_loadingInfo.url, false);
+ m_viewClient->loadStarted(QWebEngineLoadingInfo(m_loadingInfo.url, QWebEngineLoadingInfo::LoadStartedStatus));
m_viewClient->updateNavigationActions();
m_viewClient->loadProgressChanged(0);
- } else {
- m_viewClient->loadStarted(toQt(GURL(content::kUnreachableWebDataURL)), true);
}
}
@@ -374,17 +374,25 @@ void WebContentsDelegateQt::emitLoadFinished(bool isErrorPage)
Q_ASSERT(!isErrorPage || webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled));
Q_ASSERT((m_loadingInfo.triggersErrorPage && webEngineSettings()->testAttribute(QWebEngineSettings::ErrorPageEnabled)) || !m_loadingInfo.triggersErrorPage);
- if (!isErrorPage) {
- if (m_loadingInfo.progress < 100) {
- m_loadingInfo.progress = 100;
- m_viewClient->loadProgressChanged(100);
- }
+ if (isErrorPage) {
+ m_loadingInfo.isErrorPage = isErrorPage;
+ return;
+ }
- m_viewClient->loadFinished(m_loadingInfo.success, m_loadingInfo.url, false, m_loadingInfo.errorCode, m_loadingInfo.errorDescription);
- m_viewClient->updateNavigationActions();
- } else {
- m_viewClient->loadFinished(false, toQt(GURL(content::kUnreachableWebDataURL)), true, 0, QString());
+ if (m_loadingInfo.progress < 100) {
+ m_loadingInfo.progress = 100;
+ m_viewClient->loadProgressChanged(100);
}
+
+ auto loadStatus = m_loadingInfo.success
+ ? QWebEngineLoadingInfo::LoadSucceededStatus
+ : (m_loadingInfo.errorCode == WebEngineError::UserAbortedError
+ ? QWebEngineLoadingInfo::LoadStoppedStatus : QWebEngineLoadingInfo::LoadFailedStatus);
+ auto errorDomain = static_cast<QWebEngineLoadingInfo::ErrorDomain>(WebEngineError::toQtErrorDomain(m_loadingInfo.errorCode));
+ QWebEngineLoadingInfo info(m_loadingInfo.url, loadStatus, m_loadingInfo.isErrorPage,
+ m_loadingInfo.errorDescription, m_loadingInfo.errorCode, errorDomain);
+ m_viewClient->loadFinished(std::move(info));
+ m_viewClient->updateNavigationActions();
}
void WebContentsDelegateQt::emitLoadCommitted()
@@ -422,7 +430,6 @@ void WebContentsDelegateQt::DidFinishNavigation(content::NavigationHandle *navig
// The load will succede as an error-page load later, and we reported the original error above
if (navigation_handle->IsErrorPage()) {
// Now report we are starting to load an error-page.
- emitLoadStarted(true);
// If it is already committed we will not see another DidFinishNavigation call or a DidFinishLoad call.
if (navigation_handle->HasCommitted())
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h
index d6adcd77c..9ddd1d192 100644
--- a/src/core/web_contents_delegate_qt.h
+++ b/src/core/web_contents_delegate_qt.h
@@ -237,6 +237,7 @@ private:
int progress = -1;
bool isLoading() const { return progress >= 0; }
QUrl url;
+ bool isErrorPage = false;
int errorCode = 0;
QString errorDescription;
bool triggersErrorPage = false;
diff --git a/src/webenginequick/api/qquickwebenginetestsupport.cpp b/src/webenginequick/api/qquickwebenginetestsupport.cpp
index d15472291..6c9e8ec30 100644
--- a/src/webenginequick/api/qquickwebenginetestsupport.cpp
+++ b/src/webenginequick/api/qquickwebenginetestsupport.cpp
@@ -52,25 +52,6 @@ namespace QTest {
int Q_TESTLIB_EXPORT defaultMouseDelay();
}
-QQuickWebEngineErrorPage::QQuickWebEngineErrorPage()
-{
-}
-
-void QQuickWebEngineErrorPage::loadFinished(bool success, const QUrl &url)
-{
- Q_UNUSED(success);
- QTimer::singleShot(0, this, [this, url]() {
- emit loadingChanged(QWebEngineLoadingInfo(url, QWebEngineLoadingInfo::LoadSucceededStatus));
- });
-}
-
-void QQuickWebEngineErrorPage::loadStarted(const QUrl &provisionalUrl)
-{
- QTimer::singleShot(0, this, [this, provisionalUrl]() {
- emit loadingChanged(QWebEngineLoadingInfo(provisionalUrl, QWebEngineLoadingInfo::LoadStartedStatus));
- });
-}
-
QQuickWebEngineTestInputContext::QQuickWebEngineTestInputContext()
: m_visible(false)
{
@@ -167,17 +148,11 @@ void QQuickWebEngineTestEvent::mouseEvent(QEvent::Type type, QWindow *window, QO
QQuickWebEngineTestSupport::QQuickWebEngineTestSupport()
- : m_errorPage(new QQuickWebEngineErrorPage)
- , m_testInputContext(new QQuickWebEngineTestInputContext)
+ : m_testInputContext(new QQuickWebEngineTestInputContext)
, m_testEvent(new QQuickWebEngineTestEvent)
{
}
-QQuickWebEngineErrorPage *QQuickWebEngineTestSupport::errorPage() const
-{
- return m_errorPage.data();
-}
-
QQuickWebEngineTestInputContext *QQuickWebEngineTestSupport::testInputContext() const
{
return m_testInputContext.data();
diff --git a/src/webenginequick/api/qquickwebenginetestsupport_p.h b/src/webenginequick/api/qquickwebenginetestsupport_p.h
index 0accb9b67..8f8bfde4d 100644
--- a/src/webenginequick/api/qquickwebenginetestsupport_p.h
+++ b/src/webenginequick/api/qquickwebenginetestsupport_p.h
@@ -63,19 +63,6 @@ QT_BEGIN_NAMESPACE
class QWebEngineLoadingInfo;
class QWindow;
-class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineErrorPage : public QObject {
- Q_OBJECT
-
-public:
- QQuickWebEngineErrorPage();
-
- void loadFinished(bool success, const QUrl &url);
- void loadStarted(const QUrl &provisionalUrl);
-
-Q_SIGNALS:
- void loadingChanged(const QWebEngineLoadingInfo &loadStatus);
-};
-
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestInputContext : public QPlatformInputContext {
Q_OBJECT
@@ -110,13 +97,11 @@ private:
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineTestSupport : public QObject {
Q_OBJECT
- Q_PROPERTY(QQuickWebEngineErrorPage *errorPage READ errorPage CONSTANT FINAL)
Q_PROPERTY(QQuickWebEngineTestInputContext *testInputContext READ testInputContext CONSTANT FINAL)
Q_PROPERTY(QQuickWebEngineTestEvent *testEvent READ testEvent CONSTANT FINAL)
public:
QQuickWebEngineTestSupport();
- QQuickWebEngineErrorPage *errorPage() const;
QQuickWebEngineTestInputContext *testInputContext() const;
QQuickWebEngineTestEvent *testEvent() const;
@@ -125,7 +110,6 @@ Q_SIGNALS:
void loadVisuallyCommitted();
private:
- QScopedPointer<QQuickWebEngineErrorPage> m_errorPage;
QScopedPointer<QQuickWebEngineTestInputContext> m_testInputContext;
QScopedPointer<QQuickWebEngineTestEvent> m_testEvent;
};
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;
}
diff --git a/src/webenginequick/api/qquickwebengineview_p_p.h b/src/webenginequick/api/qquickwebengineview_p_p.h
index f8bcadeb6..9dfaedfdd 100644
--- a/src/webenginequick/api/qquickwebengineview_p_p.h
+++ b/src/webenginequick/api/qquickwebengineview_p_p.h
@@ -115,10 +115,10 @@ public:
void renderProcessPidChanged(qint64 pid) override;
QRectF viewportRect() const override;
QColor backgroundColor() const override;
- void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) override;
+ void loadStarted(QWebEngineLoadingInfo info) override;
void loadCommitted() override;
void didFirstVisuallyNonEmptyPaint() override;
- void loadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription) override;
+ void loadFinished(QWebEngineLoadingInfo info) override;
void focusContainer() override;
void unhandledKeyEvent(QKeyEvent *event) override;
QSharedPointer<QtWebEngineCore::WebContentsAdapter>
diff --git a/src/webenginequick/testsupport/plugin.cpp b/src/webenginequick/testsupport/plugin.cpp
index 087cd2919..02e6d66c4 100644
--- a/src/webenginequick/testsupport/plugin.cpp
+++ b/src/webenginequick/testsupport/plugin.cpp
@@ -56,8 +56,6 @@ public:
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine.testsupport"));
qmlRegisterType<QQuickWebEngineTestSupport>(uri, 1, 0, "WebEngineTestSupport");
- qmlRegisterUncreatableType<QQuickWebEngineErrorPage>(uri, 1, 0, "WebEngineErrorPage",
- tr("Cannot create a separate instance of WebEngineErrorPage"));
qmlRegisterUncreatableType<QQuickWebEngineTestInputContext>(uri, 1, 0, "TestInputContext",
tr("Cannot create a separate instance of WebEngineErrorPage"));
qmlRegisterUncreatableType<QQuickWebEngineTestEvent>(uri, 1, 0, "WebEngineTestEvent",
diff --git a/src/webenginequick/testsupport/plugins.qmltypes b/src/webenginequick/testsupport/plugins.qmltypes
index 17fb56658..cc39186ab 100644
--- a/src/webenginequick/testsupport/plugins.qmltypes
+++ b/src/webenginequick/testsupport/plugins.qmltypes
@@ -10,17 +10,6 @@ Module {
dependencies: ["QtQuick 2.0"]
Component { name: "QPlatformInputContext"; prototype: "QObject" }
Component {
- name: "QQuickWebEngineErrorPage"
- prototype: "QObject"
- exports: ["QtWebEngine.testsupport/WebEngineErrorPage 1.0"]
- isCreatable: false
- exportMetaObjectRevisions: [0]
- Signal {
- name: "loadingChanged"
- Parameter { name: "loadingInfo"; type: "QWebEngineLoadingInfo" }
- }
- }
- Component {
name: "QQuickWebEngineTestEvent"
prototype: "QObject"
exports: ["QtWebEngine.testsupport/WebEngineTestEvent 1.0"]
@@ -50,12 +39,6 @@ Module {
exports: ["QtWebEngine.testsupport/WebEngineTestSupport 1.0"]
exportMetaObjectRevisions: [0]
Property {
- name: "errorPage"
- type: "QQuickWebEngineErrorPage"
- isReadonly: true
- isPointer: true
- }
- Property {
name: "testInputContext"
type: "QQuickWebEngineTestInputContext"
isReadonly: true