It looks like returning false from QWebEngineCookieStore::setCookieFilter(...) does not filter cookies anymore with Qt 5.15, while it works fine with Qt 5.14.2.
To reproduce:
- Remove ~/.local/share/QtExamples/simplebrowser/QtWebEngine/Default/Cookies (or the equivalent on non-Linux systems)
- Patch simplebrowser to reject all cookies:
diff --git i/examples/webenginewidgets/simplebrowser/main.cpp w/examples/webenginewidgets/simplebrowser/main.cpp
index ddc8b4d0..1a768a93 100644
--- i/examples/webenginewidgets/simplebrowser/main.cpp
+++ w/examples/webenginewidgets/simplebrowser/main.cpp
@@ -54,6 +54,7 @@
#include <QApplication>
#include <QWebEngineProfile>
#include <QWebEngineSettings>
+#include <QWebEngineCookieStore>
QUrl commandLineUrlArgument()
{
@@ -75,6 +76,7 @@ int main(int argc, char **argv)
app.setWindowIcon(QIcon(QStringLiteral(":AppLogoColor.png")));
QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PluginsEnabled, true);
+ QWebEngineProfile::defaultProfile()->cookieStore()->setCookieFilter([](auto request) { return false; });
#if QT_VERSION >= QT_VERSION_CHECK(5, 13, 0)
QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::DnsPrefetchEnabled, true);
QWebEngineProfile::defaultProfile()->setUseForGlobalCertificateVerification();
- Run simplebrowser youtube.com with Qt 5.14
- Run sqlite3 ~/.local/share/QtExamples/simplebrowser/QtWebEngine/Default/Cookies 'select * from Cookies' and observe how there are no cookies
- Repeat with Qt 5.15 and you'll see various cookies saved to the database.
| For Gerrit Dashboard: QTBUG-85526 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 307459,2 | Remove the lie | 5.15 | qt/qtwebengine | Status: MERGED | +2 | 0 |
| 307483,3 | Add cookie filter to URL requests cookie headers | 80-based | qt/qtwebengine-chromium | Status: MERGED | +2 | 0 |
| 307491,4 | Add the cookie filter to URL requests | 5.15 | qt/qtwebengine | Status: MERGED | +2 | 0 |
| 307641,6 | Remove ProxyingRestrictedCookieManagerListenerQt | 5.15 | qt/qtwebengine | Status: MERGED | +2 | 0 |