diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-04-30 21:30:16 +0200 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-05-06 09:07:13 +0200 |
commit | 4d4fc9cd120376f30ce0630b1e8c7bf174d44fae (patch) | |
tree | 30424dfd873ff93ea3ff4f1fdf5791440c4fd69a /src/core/web_contents_delegate_qt.h | |
parent | 88c9dc6801a583956e2eb5063544303b6f12f95d (diff) |
Fix inconsistent number of load signals and their order
This change tries to match how chromium treats one single load. Before
the pair of loadStarted/loadFinished methods for api classes was called
on delegate's DidStartNavigation/DidFinishNavigation, which might be many
within one single logical load. This is true for multiple usecases (like
multiple redirects on load, immediate form submit on DOM load, page's
subresource load, or just an error page load on failure). Tracking these
methods and deciding when to emit signals based on states are error-prone
and complicates logic for no benefits. Also it somewhat lies about when
real load is done, which is only started and finished on outer methods
DidStartLoading/DidStopLoading, which are conveniently called only once
for all mentioned usecases. So, this change uses these methods to issue
signals for load start/finish, and only makes exception for error page,
which is needed for quick's private test support.
Fixes: QTBUG-65223
Fixes: QTBUG-76802
Fixes: QTBUG-87089
Fixes: QTBUG-90342
Fixes: QTBUG-91773
Fixes: QTBUG-92063
Change-Id: I9cc99b639030fedd8cf6a9dc04d0869d6be6357d
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Diffstat (limited to 'src/core/web_contents_delegate_qt.h')
-rw-r--r-- | src/core/web_contents_delegate_qt.h | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 5a3dff6e9..7149f6bff 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -216,9 +216,9 @@ private: WindowOpenDisposition disposition, const gfx::Rect &initial_pos, const QUrl &url, bool user_gesture); - void EmitLoadStarted(const QUrl &url, bool isErrorPage = false); - void EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage = false, int errorCode = 0, const QString &errorDescription = QString(), bool triggersErrorPage = false); - void EmitLoadCommitted(); + void emitLoadStarted(bool isErrorPage = false); + void emitLoadFinished(bool isErrorPage = false); + void emitLoadCommitted(); LoadingState determineLoadingState(content::WebContents *contents); void setLoadingState(LoadingState state); @@ -242,9 +242,17 @@ private: int m_desktopStreamCount = 0; mutable bool m_pendingUrlUpdate = false; - QMap<QUrl, int> m_loadProgressMap; - QUrl m_lastLoadedUrl; - bool m_isNavigationCommitted = false; + struct LoadingInfo { + bool success = false; + int progress = -1; + bool isLoading() const { return progress >= 0; } + QUrl url; + int errorCode = 0; + QString errorDescription; + bool triggersErrorPage = false; + void clear() { *this = LoadingInfo(); } + } m_loadingInfo; + bool m_isDocumentEmpty = true; base::WeakPtrFactory<WebContentsDelegateQt> m_weakPtrFactory { this }; }; |