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

Setting WebEngineView.profile by id has no effect

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.15.6
    • WebEngine
    • None

    Description

      Reproducible with the code below: Try to login into google, then close app and reopen.

      import QtQuick 2.15
      import QtQuick.Window 2.15
      import QtWebEngine 1.11
      import QtQuick.Controls 2.15
      import QtQuick.Layouts 1.15
      
      Window {
          id: root
          width: 960
          height: 960
          visible: true
          title: qsTr("webengineexample")
      
          Shortcut {
              sequence: StandardKey.Quit
              onActivated: {
                  Qt.quit()
              }
          }
      
      
          WebEngineProfile {
              id: customprofile
              httpAcceptLanguage: root.httpAcceptLanguage
              httpUserAgent: root.httpUserAgent
              httpCacheType: WebEngineProfile.DiskHttpCache
              cachePath: "/tmp/webengineexample/customprofile/cache"
              persistentStoragePath: "/tmp/webengineexample/customprofile/data"
              persistentCookiesPolicy: WebEngineProfile.ForcePersistentCookies
              storageName: "customprofile"
          }
      
          WebEngineProfile {
              id: inkognitoProfile
              offTheRecord: true
              httpAcceptLanguage: root.httpAcceptLanguage
              httpUserAgent: root.httpUserAgent
          }
      
          WebEngineView {
              id: webEngineView
              anchors.fill: parent
              // this fails
              profile : customprofile
      
              // The following works
      //        profile {
      //            httpAcceptLanguage: root.httpAcceptLanguage
      //            httpUserAgent: root.httpUserAgent
      //            httpCacheType: WebEngineProfile.MemoryHttpCache
      //            cachePath: "/tmp/webengineexample/customprofile/cache"
      //            persistentStoragePath: "/tmp/webengineexample/customprofile/data"
      //            persistentCookiesPolicy: WebEngineProfile.ForcePersistentCookies
      //            storageName: "customprofile"
      //        }
      
              settings {
                  autoLoadImages: true
                  dnsPrefetchEnabled: false
              }
              url: "https://youtube.com"
      //        url: "https://ping.eu"
      
              property Menu contextMenu: Menu {
                  Repeater {
                      model: [
                          WebEngineView.Back,
                          WebEngineView.Forward,
                          WebEngineView.Reload,
                          WebEngineView.SavePage,
                          WebEngineView.Copy,
                          WebEngineView.Paste,
                          WebEngineView.Cut,
                          WebEngineView.CopyLinkToClipboard,
                          WebEngineView.DownloadLinkToDisk
                      ]
                      MenuItem {
                          text: webEngineView.action(modelData).text
                          enabled: webEngineView.action(modelData).enabled
                          onClicked: webEngineView.action(modelData).trigger()
                          icon.name: webEngineView.action(modelData).iconName
                          display: MenuItem.TextBesideIcon
                          }
                      }
              }
      
              property Menu contextMenu2: Menu {
                  Repeater {
                      model: [
                          WebEngineView.Back,
                          WebEngineView.Forward,
                          WebEngineView.Reload,
                          WebEngineView.SavePage,
                          WebEngineView.Copy,
                          WebEngineView.Paste,
                          WebEngineView.Cut,
                          WebEngineView.CopyLinkToClipboard,
                          WebEngineView.DownloadLinkToDisk
                      ]
                      MenuItem {
                          text: webEngineView.action(modelData).text
                          enabled: webEngineView.action(modelData).enabled
                          onClicked: webEngineView.action(modelData).trigger()
                          icon.name: webEngineView.action(modelData).iconName
                          display: MenuItem.TextBesideIcon
                          }
                      }
              }
      
              onContextMenuRequested: function(request) {
                  request.accepted = true;
                  contextMenu.popup();
              }
          }
      
      
          property string httpUserAgent: "Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Firefox/90.0"
          property string httpAcceptLanguage: "en-US"
      
      }
      
      

      Attachments

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

        Activity

          People

            michal Michal Klocek
            paangele Paolo Angelelli
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes