violentmonkey: [BUG] GM.info.platform gets the wrong browser version in MAXTHON

Problem:

GM.info.platform gets the wrong browser version in MAXTHON, browserVersion should be 109.0.0.0.

GM.info.platform:

{
    "arch": "x86-64",
    "os": "win",
    "browserBrand": "Chromium",
    "brand": "Chromium",
    "browserName": "chrome",
    "name": "chrome",
    "browserVersion": "7.2.2.3200",
    "version": "7.2.2.3200"
}

navigator.userAgentData:

{
    "brands": [
        {
            "brand": "Chromium",
            "version": "109"
        },
        {
            "brand": "Not_A Brand",
            "version": "99"
        }
    ],
    "mobile": false,
    "platform": "Windows"
}

Environment:

  • OS: Windows11
  • Browser: MAXTHON 7.2.2.3200 (Chromium 190.0.0.0)
  • Violentmonkey Version: BETA v2.20.1

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 49 (27 by maintainers)

Commits related to this issue

Most upvoted comments

Edit: in modern Chromium-based browsers we use navigator.userAgentData.getHighEntropyValues([‘uaFullVersion’]).

Hi @tophf,

uaFullVersion is Deprecated. see #uafullversion. fullVersionList should be used instead.

And MAXTHON return navigator.userAgentData.getHighEntropyValues([‘fullVersionList’]) like this:

{
    "fullVersionList": [
        {
            "brand": "Chromium",
            "version": "7.2.2.3200"
        },
        {
            "brand": "Not_A Brand",
            "version": "99.0.0.0"
        }
    ]
}

I think this is very irresponsible brand information. The correct brand information should be:

{
    "fullVersionList": [
        {
            "brand": "Maxthon",
            "version": "7.2.2.3200"
        },
        {
            "brand": "Chromium",
            "version": "109.0.0.0"
        },
        {
            "brand": "Not_A Brand",
            "version": "99.0.0.0"
        }
    ]
}

Of course, this has nothing to do with the extension itself, as I mentioned above, it’s a problem caused by the browser developers.

GM_info.platform.browserVersion in Chromium-based browsers is parsed from navigator.userAgentData.getHighEntropyValues or navigator.userAgent of the background script, not from navigator.userAgentData.brands, because it’s a browserVersion, not browserBrandVersion. In other browsers we use browser.runtime.getBrowserInfo, which is implemented only in Gecko/Firefox, AFAIK, and potentially some obscure browsers like Orion.

Edit: in modern Chromium-based browsers we use navigator.userAgentData.getHighEntropyValues([‘uaFullVersion’]).

Hmmm… TM’s GM.info.userAgentData can get the real browser information, and won’t be affected by other extensions (e.g. User-Agent Switcher and Manager) modifying the browser’s UA information. I guess the same goes for VM’s GM.info.platform.

Back to this ISSUE, the browser information returned by the VM’s GM.info.platform is missing the brand version, which should be more important than the browser’s own version. After all, the brand version affects the compatibility of scripts and css.

That’s what I’m trying to say. I’m sorry that my English is not very good and maybe it will cause you misunderstanding.

The browser information obtained by extensions is not absolutely correct. This is especially true for unofficial or third-party forkes of the Chromium browser, whose developers don’t follow the agreed-upon data structures for defining browser information, but instead arbitrarily modify browser brand and brand version information. This can cause extensions to fetch browser information that is not correct. This is the case with Maxthon as you mentioned.

So i think @tophf is right about that.

User-Agent Switcher and Manager doesn’t work for it anymore.

This is the correct behavior, because this extension doesn’t use chrome.debugger API. If what you described were true, it would be a critical bug in the browser’s implementation of security boundary for extensions.

GM_info.userAgent and GM_info.userAgentData also provided in Firefox and Gecko-based browsers?

  • userAgent is a safe copy of navigator.userAgent, so it’s implemented in all browsers.
  • userAgentData is a safe copy of navigator.userAgentData, so it’s only implemented in Chromium-based browsers.

I don’t know and there’s a separate issue for that.