diff options
author | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-01-25 14:59:55 +0100 |
---|---|---|
committer | Peter Varga <pvarga@inf.u-szeged.hu> | 2021-02-05 08:19:49 +0100 |
commit | c43c3c3ae46735e3d23e0ed70c31143d2556a579 (patch) | |
tree | f24808bc3dd12c862510a994b3da8e004749b837 /src/core/web_contents_adapter.cpp | |
parent | f9885840ef2840179f589dd1f71a776df5fd34f3 (diff) |
Fix loadFinished signal if page has content but server sends HTTP error
For triggering an error page 3 conditions should be fulfilled:
- main frame navigation
- the page's document is empty
- the HTTP status code indicates an error
This fix adds check for the empty document and sends loadFinished signal
without expecting an error page if the document is not empty.
Fixes: QTBUG-90517
Change-Id: I6463d75fb5e682932feca64b0f059f9aa475795c
Reviewed-by: Kirill Burtsev <kirill.burtsev@qt.io>
Diffstat (limited to 'src/core/web_contents_adapter.cpp')
-rw-r--r-- | src/core/web_contents_adapter.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/web_contents_adapter.cpp b/src/core/web_contents_adapter.cpp index a5473372d..ee0c1fb3c 100644 --- a/src/core/web_contents_adapter.cpp +++ b/src/core/web_contents_adapter.cpp @@ -713,9 +713,10 @@ void WebContentsAdapter::load(const QWebEngineHttpRequest &request) // 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")); + net::ERR_DISALLOWED_URL_SCHEME, + QCoreApplication::translate("WebContentsAdapter", + "HTTP-POST data can only be sent over HTTP(S) protocol"), + false); return; } params.post_data = network::ResourceRequestBody::CreateFromBytes( @@ -771,7 +772,7 @@ 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); + m_adapterClient->loadFinished(false, baseUrl, false, net::ERR_ABORTED, QString(), false); return; } content::NavigationController::LoadURLParams params((dataUrlToLoad)); |