Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] GM_info.userAgentData gets the wrong version information in TM 5.2.3/5.3.6207 #2164

Open
F9y4ng opened this issue Aug 25, 2024 · 7 comments

Comments

@F9y4ng
Copy link

F9y4ng commented Aug 25, 2024

The following situation only occurs in Chromium >= 128, and all versions below v128 are normal.

Actual Behavior

Chrome 128:

a11

a1

a12

Brave 1.69.153 (Chromium 128)

b1

b11

b12

Specifications

  • Chromium: all Chromium >= 128
  • TM: 5.2.3/5.3.6207
  • OS: win10
@derjanb
Copy link
Member

derjanb commented Aug 29, 2024

I assume you're using UserScripts API Dynamic mode and haven't saved/updated the script after the browser was updated?

@derjanb derjanb added the bug label Aug 29, 2024
@derjanb derjanb added this to the 5.3 milestone Aug 29, 2024
@F9y4ng
Copy link
Author

F9y4ng commented Aug 29, 2024

I assume you're using UserScripts API Dynamic mode

Yes, in UserScripts API Dynamic.

haven't saved/updated the script after the browser was updated?

No, saved/updated many times after the browser was updated.

@F9y4ng
Copy link
Author

F9y4ng commented Aug 29, 2024

I tried reinstalling the script, but the problem persisted.

Finally, after factory reset, TM 5.2.3/5.3.2607 returned to normal. (After testing, switching the Content Script API mode multiple times and running the script can return to normal.)

From the performance point of view, it is similar to the situation of #2141 ([Safari] Tampermonkey 5.2.6199) that I reported before, but didn't find the cause of the problem and couldn't reproduce it.

@F9y4ng
Copy link
Author

F9y4ng commented Aug 29, 2024

FYI, on some 3rd party chromium browsers need to use getHighEntropyValues(["fullVersionList"]) to get the real browser information, I wonder if the value of getHighEntropyValues(["fullVersionList"]) can be returned in this fix?

Or return the getHighEntropyValues method in the same way as VM BETA's GM_info.userAgentData?

@derjanb
Copy link
Member

derjanb commented Sep 5, 2024

Please try 5.3.6209 (crx|xpi in review)

Please download the crx file linked above and drag and drop it to the extensions page chrome://extensions (after you've enabled 'Developer Mode').

For a quick fix please export your settings and scripts as zip or (JSON) file at the "Utilities" tab and import it back at the fixed BETA version.

@F9y4ng
Copy link
Author

F9y4ng commented Sep 6, 2024

Thanks for the fix.

@F9y4ng F9y4ng closed this as completed Sep 6, 2024
@F9y4ng
Copy link
Author

F9y4ng commented Sep 7, 2024

@derjanb v5.3.6209 doesn't seem to fix the problem with getting the version info, it still gets the previous wrong version after browser update.

In order to reproduce the problem, after I upgraded Supermium from 124 to 126 with Tampermonkey v5.3.6209, GM_info.userAgentData still obtained the wrong version information, as shown in the figure:

test

Repeatedly switching Content Script API mode and saving can refresh the cache and allow GM_info.userAgentData to obtain the correct version information.

Script

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      2024-09-07
// @description  try to take over the world!
// @author       You
// @match        *://*/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        GM_info
// @run-at       document-start
// ==/UserScript==

(async function() {
    'use strict';
    console.log("GM_info.userAgentData:", GM_info.userAgentData);
    console.log("navigator.userAgentData:", await navigator.userAgentData.getHighEntropyValues(["fullVersionList"]).then(rst => {
        rst.brands = rst.fullVersionList;
        delete rst.fullVersionList;
        return rst;
    }));
})();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants