summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2018-11-27 17:44:22 +0100
committerJani Heikkinen <jani.heikkinen@qt.io>2019-01-09 18:47:18 +0000
commitfc382c92021954593e6d8d07ee3f0792c4ad5c17 (patch)
tree3d0d9c6dc50bc0af61c13fb047164995e61f89a6 /tests
parent846320f5877aafb9c7b319da6c972786805d9c30 (diff)
Fix recreation of cookie store and channel id service
As more things gets mojofy and become services, we can not simply delete parts of storage context. Therefore regenerate whole storage in case of cookie store, cache, agent settings updates. URLRequestContextStorage guards correct order of destruction. This change aims to fix some crashes during cookie store and http cache recreation when ChannelIDService gets deleted. Depending on timing this ends with different stacktraces like in cookie store manager or during ssl handshake. We still keep network delegate outside of storage context to prevent crashes when url requests end their life due to (forced) request cancellation in cancelAllUrlRequests(). Please note this is just band-aid patch, and introduction of 'profile builder' will be a proper fix. Fixes: QTBUG-71895 Change-Id: If33a7af3ebba2632ea33f32d913e1c21a4534817 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
index 1fe0f0304..98b4fa6a8 100644
--- a/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
+++ b/tests/auto/widgets/qwebengineprofile/tst_qwebengineprofile.cpp
@@ -30,6 +30,7 @@
#include <QtCore/qbuffer.h>
#include <QtTest/QtTest>
#include <QtWebEngineCore/qwebengineurlrequestjob.h>
+#include <QtWebEngineCore/qwebenginecookiestore.h>
#include <QtWebEngineCore/qwebengineurlschemehandler.h>
#include <QtWebEngineWidgets/qwebengineprofile.h>
#include <QtWebEngineWidgets/qwebenginepage.h>
@@ -57,6 +58,7 @@ private Q_SLOTS:
void downloadItem();
void changePersistentPath();
void initiator();
+ void qtbug_72299(); // this should be the last test
};
void tst_QWebEngineProfile::init()
@@ -568,5 +570,19 @@ void tst_QWebEngineProfile::initiator()
QCOMPARE(handler.initiator, QUrl());
}
+void tst_QWebEngineProfile::qtbug_72299()
+{
+ QWebEngineView view;
+ view.setUrl(QUrl("https://www.qt.io"));
+ view.show();
+ QSignalSpy loadSpy(view.page(), SIGNAL(loadFinished(bool)));
+ view.page()->profile()->clearHttpCache();
+ view.page()->profile()->setHttpCacheType(QWebEngineProfile::NoCache);
+ view.page()->profile()->cookieStore()->deleteAllCookies();
+ view.page()->profile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
+ QTRY_COMPARE_WITH_TIMEOUT(loadSpy.count(), 1, 20000);
+}
+
+
QTEST_MAIN(tst_QWebEngineProfile)
#include "tst_qwebengineprofile.moc"