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

navigator.userAgent incorrect in web worker in v0.83 #8162

Open
AshleyScirra opened this issue Jan 29, 2024 · 0 comments
Open

navigator.userAgent incorrect in web worker in v0.83 #8162

AshleyScirra opened this issue Jan 29, 2024 · 0 comments

Comments

@AshleyScirra
Copy link

This is a regression in NW.js v0.83. If package.json specifies both "user-agent" and "chromium-args": "--enable-node-worker", then navigator.userAgent is set to the wrong value in a Web Worker.

Minimal repro:
nwjs-wrong-useragent.zip

Run the project and open the console. It logs the user agent in both the DOM and in a web worker.

Expected result:

Log the correct user agent in both cases, e.g. Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (@cb06fc91af4703f38d770d89cd3c7a066fdce098) (KHTML, like Gecko, Chrome, Safari) NWjs/0.83.0

Observed result:

In NW.js 0.83, it logs the correct user agent in the DOM, but in the worker it is set to Node.js/21. This causes incorrect feature detection in the worker and results in various features not working, browser-engine specific hacks not being applied, etc.

It works correctly in NW.js v0.82, logging the right user agent in the web worker, so this is a regression in v0.83 specifically. Tested on Windows 11 x64.

(FWIW: please also take a look at #8075 which is another thing that regressed when using "chromium-args": "--enable-node-worker" back in v0.76 and still hasn't been fixed)

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

No branches or pull requests

1 participant