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

QtWebEngine. QWebEngineCookieStore::loadAllCookies cannot work

    XMLWordPrintable

Details

    Description

      以5.15.2和6.3.0的cookiebrowser例子为测试工程。

      Examples\Qt-5.15.2\webenginewidgets\cookiebrowser在访问几个网站后,重新启动exe,loadAllCookies 之后会读取上次的Cookie。

      Examples\Qt-6.3.0\webenginewidgets\cookiebrowser的

      MainWindow::MainWindow构造函数中

      ,简单修改如下:

       

      QWebEngineProfile * engineProfile = new QWebEngineProfile("test");
      m_webview->setPage(new QWebEnginePage(engineProfile, m_webview));
      QString strTemp = "f:/webcache/cache";
      engineProfile->setHttpCacheType(QWebEngineProfile::DiskHttpCache);
      engineProfile->setPersistentCookiesPolicy(QWebEngineProfile::AllowPersistentCookies);
      engineProfile->setCachePath(strTemp);
      strTemp = "f:/webcache/storage";
      engineProfile->setPersistentStoragePath(strTemp);

      m_store = engineProfile->cookieStore();
      connect(m_store, &QWebEngineCookieStore::cookieAdded, this, &MainWindow::handleCookieAdded);
      m_store->loadAllCookies();
      m_webview->load(url);

       

      同样,先访问几个网站后,重新启动exe,loadAllCookies 之后并没有读取上次的任何Cookie,但是网页本身正确加载了上次保存的cookie(帐号的登录状态仍然保持)。

       

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-102552
          # Subject Branch Project Status CR V

          Activity

            People

              kchehlarski Kaloyan Chehlarski
              zhanyonhu Yonghui Zhang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 1 week
                  1w
                  Remaining:
                  Remaining Estimate - 1 week
                  1w
                  Logged:
                  Time Spent - Not Specified
                  Not Specified

                  Gerrit Reviews

                    There is 1 open Gerrit change