summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/core/url_request_context_getter_qt.cpp1
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp20
2 files changed, 21 insertions, 0 deletions
diff --git a/src/core/url_request_context_getter_qt.cpp b/src/core/url_request_context_getter_qt.cpp
index 959dd3d95..42c8db280 100644
--- a/src/core/url_request_context_getter_qt.cpp
+++ b/src/core/url_request_context_getter_qt.cpp
@@ -216,6 +216,7 @@ void URLRequestContextGetterQt::generateStorage()
cancelAllUrlRequests();
// we need to get rid of dangling pointer due to coming storage deletion
m_urlRequestContext->set_http_transaction_factory(0);
+ m_httpNetworkSession.reset();
}
m_storage.reset(new net::URLRequestContextStorage(m_urlRequestContext.get()));
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 579a0f776..093bc2e43 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -52,6 +52,7 @@ private Q_SLOTS:
void customUserAgent();
void httpAcceptLanguage();
void downloadItem();
+ void changePersistentPath();
};
void tst_QWebEngineProfile::defaultProfile()
@@ -375,5 +376,24 @@ void tst_QWebEngineProfile::downloadItem()
QTRY_COMPARE(downloadSpy.count(), 1);
}
+void tst_QWebEngineProfile::changePersistentPath()
+{
+ QWebEngineProfile testProfile(QStringLiteral("Test"));
+ const QString oldPath = testProfile.persistentStoragePath();
+ QVERIFY(oldPath.endsWith(QStringLiteral("Test")));
+
+ // Make sure the profile has been used and the url-request-context-getter instantiated:
+ QWebEnginePage page(&testProfile);
+ QSignalSpy loadFinishedSpy(&page, SIGNAL(loadFinished(bool)));
+ page.load(QUrl("http://qt-project.org"));
+ if (!loadFinishedSpy.wait(10000) || !loadFinishedSpy.at(0).at(0).toBool())
+ QSKIP("Couldn't load page from network, skipping test.");
+
+ // Test we do not crash (QTBUG-55322):
+ testProfile.setPersistentStoragePath(oldPath + QLatin1Char('2'));
+ const QString newPath = testProfile.persistentStoragePath();
+ QVERIFY(newPath.endsWith(QStringLiteral("Test2")));
+}
+
QTEST_MAIN(tst_QWebEngineProfile)
#include "tst_qwebengineprofile.moc"