Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.5.0
-
None
-
aa88ad113669d8daf9c1486487b7c48b39279be5
Description
This seems to affect both the HTTP and JavaScript user agent strings. Here are a couple of examples that don't work:
import QtQuick 2.4 import QtWebEngine 1.1 WebEngineView { width: 600; height: 600 url: "http://whatismyuseragent.com" Component.onCompleted: { profile.httpUserAgent = "foo" reload() } }
import QtQuick 2.4 import QtWebEngine 1.1 import QtWebChannel 1.0 WebEngineView { width: 600; height: 600 url: "http://whatismyuseragent.com" profile.httpUserAgent: "foo" webChannel.registeredObjects: [] }
import QtQuick 2.4 import QtWebEngine 1.1 WebEngineView { width: 600; height: 600 url: "http://whatismyuseragent.com" profile.httpUserAgent: "foo" backgroundColor: "red" }
Only WebContentsAdapter::initialize seems to set user_agent_override RendererPreferences on the WebContents, BrowserContextAdapter::setHttpUserAgent doesn't seem to get that far.
A solution could be to call content::WebContents::SetUserAgentOverride on all views of a specific BrowserContextAdapter, but I'm not sure if that list is available from the BrowserContext. It could also work to move the httpUserAgent property to QQuickWebView but that would mean deprecating the profile one, probably not worth it.