Skip to content

Do not check for navigator to detect web environment in built-in extensions #251688

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

Merged
merged 1 commit into from
Jun 18, 2025

Conversation

jeanp413
Copy link
Contributor

@jeanp413 jeanp413 commented Jun 17, 2025

Do not check for navigator to detect web environment in built-in extensions
Use recommended check from release notes

Fixes #251541

@jeanp413
Copy link
Contributor Author

cc @mjbvz

@jeanp413 jeanp413 changed the title Do not check for navigator to detect web environment in extensions Do not check for navigator to detect web environment in built-in extensions Jun 17, 2025
@dbaeumer dbaeumer assigned mjbvz and unassigned dbaeumer and mjbvz Jun 17, 2025
@dbaeumer dbaeumer assigned mjbvz and unassigned dbaeumer and mjbvz Jun 17, 2025
@bpasero
Copy link
Member

bpasero commented Jun 17, 2025

@deepak1556 fyi, I wonder if we did not fully adopt this yet in our code?

@deepak1556
Copy link
Collaborator

Yeah we haven't adopted the changes in all of our extensions but our polyfill #250619 is meant to avoid any issues for such conditions.

@jeanp413 I ran code-insiders serve-web and connected a debugger to remote extension host and see the following, can you share the steps that led to navigator being defined which caused issue for the relevant extension

Screenshot 2025-06-18 at 2 37 31

@jeanp413
Copy link
Contributor Author

jeanp413 commented Jun 18, 2025

@deepak1556 The issue is the way it's checked in the typescript extension 'navigator' in globalThis returns true because navigator property is defined but has value undefined

@deepak1556
Copy link
Collaborator

Ah thats a good catch, we could probably proxy the has method to cover the in operator. However, this PR should be merged as a potential fix.

@vs-code-engineering vs-code-engineering bot added this to the June 2025 milestone Jun 18, 2025
@bpasero bpasero enabled auto-merge (squash) June 18, 2025 04:37
@bpasero bpasero merged commit 0140ab3 into microsoft:main Jun 18, 2025
7 checks passed
deepak1556 pushed a commit that referenced this pull request Jun 18, 2025
…nsions (#251688)

Do not check for navigator to detect web environment
deepak1556 pushed a commit that referenced this pull request Jun 18, 2025
…nsions (#251688)

Do not check for navigator to detect web environment
deepak1556 added a commit that referenced this pull request Jun 18, 2025
Do not check for navigator to detect web environment in built-in extensions (#251688)

Do not check for navigator to detect web environment

Co-authored-by: Jean Pierre <jeanp413@hotmail.com>
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

Successfully merging this pull request may close these issues.

VS Code Update Causes TypeScript Server Crashes with SIGTERM in GitHub Codespaces (VS Code 1.101.0)
5 participants