summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/web_contents_delegate_qt.cpp10
-rw-r--r--tests/auto/widgets/schemes/tst_schemes.cpp5
2 files changed, 6 insertions, 9 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp
index 11f64c5a..569b939d 100644
--- a/src/core/web_contents_delegate_qt.cpp
+++ b/src/core/web_contents_delegate_qt.cpp
@@ -602,14 +602,12 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio
}
if (!navigationAllowedByPolicy || !navigationRequestAccepted) {
+ QString errorDescription;
if (!navigationAllowedByPolicy)
- didFailLoad(url, 420, QStringLiteral("Launching external protocol forbidden by WebEngineSettings::UnknownUrlSchemePolicy"));
+ errorDescription = QStringLiteral("Launching external protocol forbidden by WebEngineSettings::UnknownUrlSchemePolicy");
else
- didFailLoad(url, 420, QStringLiteral("Launching external protocol suppressed by WebContentsAdapterClient::navigationRequested"));
- if (settings->testAttribute(WebEngineSettings::ErrorPageEnabled)) {
- EmitLoadStarted(toQt(GURL(content::kUnreachableWebDataURL)), true);
- m_viewClient->webContentsAdapter()->load(toQt(GURL(content::kUnreachableWebDataURL)));
- }
+ errorDescription = QStringLiteral("Launching external protocol suppressed by WebContentsAdapterClient::navigationRequested");
+ didFailLoad(url, net::Error::ERR_ABORTED, errorDescription);
}
}
diff --git a/tests/auto/widgets/schemes/tst_schemes.cpp b/tests/auto/widgets/schemes/tst_schemes.cpp
index 2097120e..6da34efd 100644
--- a/tests/auto/widgets/schemes/tst_schemes.cpp
+++ b/tests/auto/widgets/schemes/tst_schemes.cpp
@@ -68,7 +68,7 @@ void tst_Schemes::unknownUrlSchemePolicy()
view.show();
QVERIFY(QTest::qWaitForWindowExposed(&view));
QWebEngineSettings *settings = view.page()->profile()->settings();
- settings->setAttribute(QWebEngineSettings::ErrorPageEnabled, false);
+ settings->setAttribute(QWebEngineSettings::ErrorPageEnabled, true);
settings->setAttribute(QWebEngineSettings::FocusOnNavigationEnabled, true);
QWebEngineSettings::UnknownUrlSchemePolicy policies[6] = {QWebEngineSettings::DisallowUnknownUrlSchemes,
@@ -103,8 +103,7 @@ void tst_Schemes::unknownUrlSchemePolicy()
});
}
- bool errorPageEnabled = settings->testAttribute(QWebEngineSettings::ErrorPageEnabled);
- QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2 + (errorPageEnabled ? 1 : 0), 15000);
+ QTRY_COMPARE_WITH_TIMEOUT(loadFinishedSpy.size(), 2, 15000);
QCOMPARE(page.acceptNavigationRequestCalls, shouldAccept ? 1 : 0);
}
}