diff options
author | Kirill Burtsev <kirill.burtsev@qt.io> | 2020-12-02 12:49:13 +0100 |
---|---|---|
committer | Kirill Burtsev <kirill.burtsev@qt.io> | 2021-01-06 13:03:30 +0100 |
commit | b27edd025dbe6ef2d1e302b8be0e0993ef3d645d (patch) | |
tree | 10b600daa6086457d7ea9c4b8e615c9ab5d05d95 /src/core/web_contents_delegate_qt.cpp | |
parent | 7194fa83055da3055000adf19b05328e7ccab38b (diff) |
Suppress error pages also for http errors if they are disabled
Load with client or server http error results in successful navigation,
which leads to 'true' loadFinished result, and subsequent chromium's error
page load and display with second set of loadStarted/loadFinished signals.
This effectively ignores QWebEngineSettings::ErrorPageEnabled. Fixing it
requires submodule change to ask embedder if error pages should also be
suppressed for http errors.
Also update chromium for required change, which pulls in the following changes:
* e71010069b4 Fix embedded builds with printing enabled
* f5a93d251cc Allow the embedder to suppress an error page for http errors
Change-Id: I731678575439a6dad90dfb89e79b0083c63b49c2
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index fb3eb2ab3..532d9653b 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -374,8 +374,6 @@ void WebContentsDelegateQt::DidStartNavigation(content::NavigationHandle *naviga if (!navigation_handle->IsInMainFrame()) return; - // Error-pages are not reported as separate started navigations. - Q_ASSERT(!navigation_handle->IsErrorPage()); m_loadingErrorFrameList.clear(); m_faviconManager->resetCandidates(); @@ -384,6 +382,8 @@ void WebContentsDelegateQt::DidStartNavigation(content::NavigationHandle *naviga void WebContentsDelegateQt::EmitLoadFinished(bool success, const QUrl &url, bool isErrorPage, int errorCode, const QString &errorDescription) { + Q_ASSERT(!isErrorPage || webEngineSettings()->testAttribute(WebEngineSettings::ErrorPageEnabled)); + // When error page enabled we don't need to send the error page load finished signal if (m_loadProgressMap[url] == 100) return; @@ -538,10 +538,8 @@ void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame m_viewClient->iconChanged(QUrl()); content::NavigationEntry *entry = web_contents()->GetController().GetActiveEntry(); - int http_statuscode = 0; - if (entry) - http_statuscode = entry->GetHttpStatusCode(); - EmitLoadFinished(true /* success */ , toQt(validated_url), false /* isErrorPage */, http_statuscode); + int http_statuscode = entry ? http_statuscode = entry->GetHttpStatusCode() : 0; + EmitLoadFinished(http_statuscode < 400, toQt(validated_url), false /* isErrorPage */, http_statuscode); } void WebContentsDelegateQt::DidUpdateFaviconURL(const std::vector<blink::mojom::FaviconURLPtr> &candidates) |