From ede95c2a1186c17996091950ec57c5998f73fa7a Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Thu, 21 Aug 2014 14:02:10 +0200 Subject: Don't forward loading of error pages to the API layer The fact that the error pages are HTML and get loaded through the same mechanism should be kept an implementation detail and not be considered as a new load in the API sense. Also implement HasErrorPage for good measure and remove an anoying warning from the demo browser. The issue of the url not being changed remains in the QML test (but it doesn't affect a typical browser-like UI since the user input is still there untouched in the address bar), just make sure that failure does not affect the later checks. It also seems like we have a focus problem somehow, but the test should probably use a click for that matter. Change-Id: Ib5e363981a11287fdf4bfe84b93c999d96ed8087 Reviewed-by: Jocelyn Turcotte --- src/webenginewidgets/api/qwebenginepage.cpp | 7 +++++-- src/webenginewidgets/api/qwebenginepage_p.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/webenginewidgets') diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 51e733e70..ac677a8c6 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -171,6 +171,7 @@ QWebEnginePagePrivate::QWebEnginePagePrivate() , history(new QWebEngineHistory(new QWebEngineHistoryPrivate(this))) , settings(new QWebEngineSettings) , view(0) + , isLoading(false) { memset(actions, 0, sizeof(actions)); } @@ -237,6 +238,7 @@ void QWebEnginePagePrivate::loadStarted(const QUrl &provisionalUrl) { Q_UNUSED(provisionalUrl) Q_Q(QWebEnginePage); + isLoading = true; Q_EMIT q->loadStarted(); updateNavigationActions(); } @@ -251,6 +253,7 @@ void QWebEnginePagePrivate::loadFinished(bool success, int error_code, const QSt Q_Q(QWebEnginePage); Q_UNUSED(error_code); Q_UNUSED(error_description); + isLoading = false; if (success) m_explicitUrl = QUrl(); Q_EMIT q->loadFinished(success); @@ -362,11 +365,11 @@ void QWebEnginePagePrivate::updateAction(QWebEnginePage::WebAction action) const enabled = adapter->canGoForward(); break; case QWebEnginePage::Stop: - enabled = adapter->isLoading(); + enabled = isLoading; break; case QWebEnginePage::Reload: case QWebEnginePage::ReloadAndBypassCache: - enabled = !adapter->isLoading(); + enabled = !isLoading; break; default: break; diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 10a253d8d..fab4a2139 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -153,6 +153,7 @@ public: QSize viewportSize; QUrl m_explicitUrl; WebEngineContextMenuData m_menuData; + bool isLoading; mutable CallbackDirectory m_callbacks; mutable QAction *actions[QWebEnginePage::WebActionCount]; -- cgit v1.2.3