summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/network_delegate_qt.cpp2
-rw-r--r--src/core/web_contents_delegate_qt.cpp15
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp12
3 files changed, 23 insertions, 6 deletions
diff --git a/src/core/network_delegate_qt.cpp b/src/core/network_delegate_qt.cpp
index 6fdabcd4c..0c0de64fd 100644
--- a/src/core/network_delegate_qt.cpp
+++ b/src/core/network_delegate_qt.cpp
@@ -111,7 +111,7 @@ int NetworkDelegateQt::OnBeforeURLRequest(net::URLRequest *request, const net::C
QWebEngineUrlRequestInfo requestInfo(infoPrivate);
interceptor->interceptRequest(requestInfo);
if (requestInfo.changed()) {
- int result = infoPrivate->shouldBlockRequest ? net::ERR_ABORTED : net::OK;
+ int result = infoPrivate->shouldBlockRequest ? net::ERR_BLOCKED_BY_CLIENT : net::OK;
if (qUrl != infoPrivate->url)
*newUrl = toGurl(infoPrivate->url);
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 81f16970d..baf61b5fc 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -191,7 +191,15 @@ void WebContentsDelegateQt::DidFailProvisionalLoad(content::RenderFrameHost* ren
void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url, int error_code, const base::string16& error_description, bool was_ignored_by_handler)
{
Q_UNUSED(was_ignored_by_handler);
- if (m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID()) || render_frame_host->GetParent())
+ if (validated_url.spec() == content::kUnreachableWebDataURL) {
+ m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID());
+ qCritical("Loading error-page failed. This shouldn't happen.");
+ if (!render_frame_host->GetParent())
+ m_viewClient->loadFinished(false /* success */, toQt(validated_url), true /* isErrorPage */);
+ return;
+ }
+
+ if (render_frame_host->GetParent())
return;
m_viewClient->loadFinished(false /* success */ , toQt(validated_url), false /* isErrorPage */, error_code, toQt(error_description));
@@ -200,8 +208,9 @@ void WebContentsDelegateQt::DidFailLoad(content::RenderFrameHost* render_frame_h
void WebContentsDelegateQt::DidFinishLoad(content::RenderFrameHost* render_frame_host, const GURL& validated_url)
{
- if (m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID())) {
- Q_ASSERT(validated_url.is_valid() && validated_url.spec() == content::kUnreachableWebDataURL);
+ Q_ASSERT(validated_url.is_valid());
+ if (validated_url.spec() == content::kUnreachableWebDataURL) {
+ m_loadingErrorFrameList.removeOne(render_frame_host->GetRoutingID());
m_viewClient->iconChanged(QUrl());
// Trigger LoadFinished signal for main frame's error page only.
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index b1bf33067..458ddae5f 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -200,13 +200,21 @@ void QWebEnginePagePrivate::loadFinished(bool success, const QUrl &url, bool isE
Q_UNUSED(errorCode);
Q_UNUSED(errorDescription);
- if (isErrorPage)
+ if (isErrorPage) {
+ Q_ASSERT(settings->testAttribute(QWebEngineSettings::ErrorPageEnabled));
+ Q_ASSERT(success);
+ Q_EMIT q->loadFinished(false);
return;
+ }
isLoading = false;
if (success)
explicitUrl = QUrl();
- Q_EMIT q->loadFinished(success);
+ // Delay notifying failure until the error-page is done loading.
+ // Error-pages are not loaded on failures due to abort.
+ if (success || errorCode == -3 /* ERR_ABORTED*/ || !settings->testAttribute(QWebEngineSettings::ErrorPageEnabled)) {
+ Q_EMIT q->loadFinished(success);
+ }
updateNavigationActions();
}