mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Improve logic for detection of node vs web worker extension host (#248534)
* Use `WorkerGlobalScope` instead of `navigator` since node defines `navigator` now * microsoft auth too * better logic
This commit is contained in:
committed by
GitHub
parent
2c38508d76
commit
b2224f2fc6
@@ -71,8 +71,9 @@ export async function activate(context: ExtensionContext) {
|
||||
commands.executeCommand('workbench.action.reloadWindow');
|
||||
}
|
||||
}));
|
||||
const isNodeEnvironment = typeof process !== 'undefined' && typeof process?.versions?.node === 'string';
|
||||
// Only activate the new extension if we are not running in a browser environment
|
||||
if (useMsal && typeof navigator === 'undefined') {
|
||||
if (useMsal && isNodeEnvironment) {
|
||||
await extensionV2.activate(context, mainTelemetryReporter);
|
||||
} else {
|
||||
mainTelemetryReporter.sendActivatedWithClassicImplementationEvent();
|
||||
|
||||
@@ -210,8 +210,9 @@ export class MsalAuthProvider implements AuthenticationProvider {
|
||||
}
|
||||
};
|
||||
|
||||
const isNodeEnvironment = typeof process !== 'undefined' && typeof process?.versions?.node === 'string';
|
||||
const flows = getMsalFlows({
|
||||
extensionHost: typeof navigator === 'undefined'
|
||||
extensionHost: isNodeEnvironment
|
||||
? this._context.extension.extensionKind === ExtensionKind.UI ? ExtensionHost.Local : ExtensionHost.Remote
|
||||
: ExtensionHost.WebWorker,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user