Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-85526

[REG 5.15] Cookie filter does not filter anything

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P1: Critical
    • Resolution: Done
    • Affects Version/s: 5.15.0
    • Fix Version/s: 5.15.1
    • Component/s: WebEngine
    • Labels:
      None
    • Commits:
      9a90cd56c432f2ad3e811449cb199b11c6ed9de8 (qt/qtwebengine/5.15)

      Description

      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.

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            allan.jensen Allan Sandfeld Jensen
            Reporter:
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes