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

Service workers do not honor QWebEngineProfile::setHttpUserAgent

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.8.3, 6.9.2
    • WebEngine
    • None

      When a service worker sends an HTTP request or when accessing navigator.userAgent the default Qt user agent is used instead of the one set by the user with QWebEngineProfile::setHttpUserAgent()

      Client hints seems to also behave the same, always using default values instead of the one set by the user.

      To reproduce:

      1. Take simple browser demo
      2. Add m_profile->setHttpUserAgent("foobar"); to Browser::createHiddenWindow(bool offTheRecord)
      3. Run simplebrowser
      4. Go to youtube.com
      5. Open dev tools
      6. Open the console and type navigator.userAgent, check that the value is "foobar"
      7. Change the context of the console to "sw.js" using the combobox in the toolbar of the console
      8. Type navigator.userAgent, the value is Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/6.9.2 Chrome/130.0.0.0 Safari/537.36 instead of foobar

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

            qt_webengine_team Qt WebEngine Team
            bterrier Benjamin Terrier
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes