summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-01-21 18:38:47 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-22 23:13:06 +0000
commit4fa6a7a7c7e15a560bd8503fb5c0dc2e6d1024c1 (patch)
tree79f920915adf1cf6996fb9e736e146750cd93d53 /tests
parentd6e4d60e45a6fd7c67524b5ec79be75a922911bb (diff)
Fix deadlock on QWebEngineUrlRequestJob::fail
URLRequestCustomJob::notifyFailure calls NotifyStartError(status), which in turn will result in a call to URLRequestCustomJob::Kill. We must release the lock of m_mutex before calling NotifyStartError, otherwise m_mutex.lock() will wait forever in Kill. Change-Id: I319e45049766c2192dfc46a91b352b92ec677bc6 Task-number: QTBUG-50160 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 7a89e2439..0ad460634 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -50,6 +50,7 @@ private Q_SLOTS:
void defaultProfile();
void profileConstructors();
void urlSchemeHandlers();
+ void urlSchemeHandlerFailRequest();
};
void tst_QWebEngineProfile::defaultProfile()
@@ -147,5 +148,27 @@ void tst_QWebEngineProfile::urlSchemeHandlers()
QVERIFY(toPlainTextSync(view.page()) != url.toString());
}
+class FailingUrlSchemeHandler : public QWebEngineUrlSchemeHandler
+{
+public:
+ void requestStarted(QWebEngineUrlRequestJob *job) override
+ {
+ job->fail(QWebEngineUrlRequestJob::RequestFailed);
+ }
+};
+
+void tst_QWebEngineProfile::urlSchemeHandlerFailRequest()
+{
+ FailingUrlSchemeHandler handler;
+ QWebEngineProfile profile;
+ profile.installUrlSchemeHandler("foo", &handler);
+ QWebEngineView view;
+ QSignalSpy loadFinishedSpy(&view, SIGNAL(loadFinished(bool)));
+ view.setPage(new QWebEnginePage(&profile, &view));
+ view.load(QUrl(QStringLiteral("foo://bar")));
+ QVERIFY(loadFinishedSpy.wait());
+ QVERIFY(toPlainTextSync(view.page()).isEmpty());
+}
+
QTEST_MAIN(tst_QWebEngineProfile)
#include "tst_qwebengineprofile.moc"