bitwiseworks / qtwebengine-chromium-os2

Port of Chromium and related tools to OS/2
9 stars 2 forks source link

Fix UserAgent string #48

Open dmik opened 2 years ago

dmik commented 2 years ago

Currently, Chromium reports the following user agent string via content::BuildUserAgentFromProduct(product_str) on OS/2:

Mozilla/5.0 (Unknown; OS/2 i386) AppleWebKit/537.36 (KHTML, like Gecko) <PRODUCT> Safari/537.36

where is what is passed in product_str, 537 is WEBKIT_VERSION_MAJOR and 36 is WEBKIT_VERSION_MINOR.

This method calls BuildUserAgentFromOSAndProduct in turn: https://github.com/bitwiseworks/qtwebengine-chromium-os2/blob/94066e19f149bc944d1fb9c286d952bb729e22c7/chromium/content/common/user_agent.cc#L234

The first part in the parenthesis comes from GetUserAgentPatform in the me file: https://github.com/bitwiseworks/qtwebengine-chromium-os2/blob/94066e19f149bc944d1fb9c286d952bb729e22c7/chromium/content/common/user_agent.cc#L32

This produces Unknown on OS/2 as there is no OS/2 specific ifdef.

The rest comes from BuildOSCpuInfo: https://github.com/bitwiseworks/qtwebengine-chromium-os2/blob/94066e19f149bc944d1fb9c286d952bb729e22c7/chromium/content/common/user_agent.cc#L131

This produces OS/2 i386 which is more or less correct except that the OS/2 version information is missing.

It appears that it's Unknown that makes web sites freak out and think they run on a mobile platform (e.g. google.com). We should obviously put OS/2 here.

See also https://github.com/bitwiseworks/dooble-os2/issues/3.

dmik commented 2 years ago

A number of useful links:

dmik commented 2 years ago

Note that once this issue fixed, https://github.com/bitwiseworks/dooble-os2/commit/d03b9359c7f0816a7231f4adc03c25ba6c1a331f should be rolled back.

psmedley commented 1 month ago

https://github.com/psmedley/qt6-webengine-os2/commit/3204bdb54a12e33471f1b6998e8318566d8cf895 fixes this afaict