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

Fix platform detection after Node.js 21 #200935

Merged
merged 1 commit into from
Dec 16, 2023
Merged

Fix platform detection after Node.js 21 #200935

merged 1 commit into from
Dec 16, 2023

Conversation

kkocdko
Copy link
Contributor

@kkocdko kkocdko commented Dec 15, 2023

Node.js 21 added navigator.userAgent, which breaks the previous detection.

Close #200934

Node.js 21 added `navigator.userAgent`, which breaks the previous detection.
@kkocdko
Copy link
Contributor Author

kkocdko commented Dec 15, 2023

The same problem happen in xterm.js, and is already fixed.

xtermjs/xterm.js#4850

xtermjs/xterm.js#4851

nodejs/node#47769 (comment)

_language = _locale;
_platformLocale = navigator.language;
}

Copy link
Contributor Author

@kkocdko kkocdko Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only reorder two code block, without change the block content.

@@ -75,31 +75,8 @@ interface INavigator {
}
declare const navigator: INavigator;

// Web environment
if (typeof navigator === 'object' && !isElectronRenderer) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous detection expect that Node.js doesn't have navigator, now Node.js 21 had, with navigator.userAgent === 'Node.js/21' .

Copy link
Contributor

@deepak1556 deepak1556 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

/cc @bpasero for another set of 👀

@deepak1556 deepak1556 assigned bpasero and unassigned deepak1556 Dec 15, 2023
@VSCodeTriageBot VSCodeTriageBot added this to the December / January 2024 milestone Dec 15, 2023
@bpasero bpasero enabled auto-merge (squash) December 16, 2023 10:02
@bpasero bpasero merged commit c52d8fb into microsoft:main Dec 16, 2023
6 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extension can't be install from market on ./scripts/code-server.sh with nodejs 21
5 participants