Skip to content

Commit ad4130b

Browse files
jeanp413deepak1556
authored andcommitted
Do not check for navigator to detect web environment in built-in extensions (#251688)
Do not check for navigator to detect web environment
1 parent cd3c36a commit ad4130b

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

extensions/simple-browser/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,5 @@ export function activate(context: vscode.ExtensionContext) {
8787

8888
function isWeb(): boolean {
8989
// @ts-expect-error
90-
return typeof navigator !== 'undefined' && vscode.env.uiKind === vscode.UIKind.Web;
90+
return !(typeof process === 'object' && !!process.versions.node) && vscode.env.uiKind === vscode.UIKind.Web;
9191
}

extensions/typescript-language-features/src/utils/platform.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import * as vscode from 'vscode';
77

88
export function isWeb(): boolean {
9-
return 'navigator' in globalThis && vscode.env.uiKind === vscode.UIKind.Web;
9+
return !(typeof process === 'object' && !!process.versions.node) && vscode.env.uiKind === vscode.UIKind.Web;
1010
}
1111

1212
export function isWebAndHasSharedArrayBuffers(): boolean {
@@ -16,4 +16,3 @@ export function isWebAndHasSharedArrayBuffers(): boolean {
1616
export function supportsReadableByteStreams(): boolean {
1717
return isWeb() && 'ReadableByteStreamController' in globalThis;
1818
}
19-

0 commit comments

Comments
 (0)