From 02a92ee13f8fa6bded3b7c85f08d572fe8ab99c0 Mon Sep 17 00:00:00 2001 From: Ladislau Szomoru <3372902+lszomoru@users.noreply.github.com> Date: Tue, 19 Apr 2022 13:55:44 +0200 Subject: [PATCH] Revert "Workspace trust - add tracing to track down integration test failure (#142609)" This reverts commit 0fb0a6df31fe49ab17a67ef33192aca9e1434699. --- src/vs/workbench/browser/web.main.ts | 2 +- .../electron-sandbox/desktop.main.ts | 2 +- .../workspaces/common/workspaceTrust.ts | 53 +------------------ .../test/common/workspaceTrust.test.ts | 8 +-- 4 files changed, 6 insertions(+), 59 deletions(-) diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index 5ad8d30aacc04..e8ca913a53241 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -253,7 +253,7 @@ export class BrowserMain extends Disposable { const workspaceTrustEnablementService = new WorkspaceTrustEnablementService(configurationService, environmentService); serviceCollection.set(IWorkspaceTrustEnablementService, workspaceTrustEnablementService); - const workspaceTrustManagementService = new WorkspaceTrustManagementService(configurationService, remoteAuthorityResolverService, storageService, uriIdentityService, environmentService, configurationService, workspaceTrustEnablementService, logService); + const workspaceTrustManagementService = new WorkspaceTrustManagementService(configurationService, remoteAuthorityResolverService, storageService, uriIdentityService, environmentService, configurationService, workspaceTrustEnablementService); serviceCollection.set(IWorkspaceTrustManagementService, workspaceTrustManagementService); // Update workspace trust so that configuration is updated accordingly diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index cfaf8a03ac234..7e658a10cdc09 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -279,7 +279,7 @@ export class DesktopMain extends Disposable { const workspaceTrustEnablementService = new WorkspaceTrustEnablementService(configurationService, environmentService); serviceCollection.set(IWorkspaceTrustEnablementService, workspaceTrustEnablementService); - const workspaceTrustManagementService = new WorkspaceTrustManagementService(configurationService, remoteAuthorityResolverService, storageService, uriIdentityService, environmentService, configurationService, workspaceTrustEnablementService, logService); + const workspaceTrustManagementService = new WorkspaceTrustManagementService(configurationService, remoteAuthorityResolverService, storageService, uriIdentityService, environmentService, configurationService, workspaceTrustEnablementService); serviceCollection.set(IWorkspaceTrustManagementService, workspaceTrustManagementService); // Update workspace trust so that configuration is updated accordingly diff --git a/src/vs/workbench/services/workspaces/common/workspaceTrust.ts b/src/vs/workbench/services/workspaces/common/workspaceTrust.ts index 8a29a82a90043..e5039e9bc0495 100644 --- a/src/vs/workbench/services/workspaces/common/workspaceTrust.ts +++ b/src/vs/workbench/services/workspaces/common/workspaceTrust.ts @@ -21,8 +21,7 @@ import { Memento, MementoObject } from 'vs/workbench/common/memento'; import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { IUriIdentityService } from 'vs/platform/uriIdentity/common/uriIdentity'; import { isEqualAuthority } from 'vs/base/common/resources'; -import { ILogService } from 'vs/platform/log/common/log'; -import { isCI, isWeb } from 'vs/base/common/platform'; +import { isWeb } from 'vs/base/common/platform'; export const WORKSPACE_TRUST_ENABLED = 'security.workspace.trust.enabled'; export const WORKSPACE_TRUST_STARTUP_PROMPT = 'security.workspace.trust.startupPrompt'; @@ -119,8 +118,7 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork @IUriIdentityService private readonly uriIdentityService: IUriIdentityService, @IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService, @IWorkspaceContextService private readonly workspaceService: IWorkspaceContextService, - @IWorkspaceTrustEnablementService private readonly workspaceTrustEnablementService: IWorkspaceTrustEnablementService, - @ILogService protected readonly _logService: ILogService, + @IWorkspaceTrustEnablementService private readonly workspaceTrustEnablementService: IWorkspaceTrustEnablementService ) { super(); @@ -147,10 +145,6 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork //#region initialize private initializeWorkspaceTrust(): void { - if (isCI) { - this._logService.info(`[WT] Enter initializeWorkspaceTrust()...`); - } - // Resolve canonical Uris this.resolveCanonicalUris() .then(async () => { @@ -158,15 +152,9 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork await this.updateWorkspaceTrust(); }) .finally(() => { - if (isCI) { - this._logService.info(`[WT] Open workspaceResolved gate...`); - } this._workspaceResolvedPromiseResolve(); if (!this.environmentService.remoteAuthority) { - if (isCI) { - this._logService.info(`[WT] Open workspaceTrustInitialized gate...`); - } this._workspaceTrustInitializedPromiseResolve(); } }); @@ -211,16 +199,8 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork } private async getCanonicalUri(uri: URI): Promise { - if (isCI) { - this._logService.info('[WT] Enter getCanonicalUri()...'); - } - let canonicalUri = uri; if (this.environmentService.remoteAuthority && uri.scheme === Schemas.vscodeRemote) { - if (isCI) { - this._logService.info('[WT] Return this.remoteAuthorityResolverService.getCanonicalURI(uri)...'); - } - canonicalUri = await this.remoteAuthorityResolverService.getCanonicalURI(uri); } else if (uri.scheme === 'vscode-vfs') { const index = uri.authority.indexOf('+'); @@ -234,10 +214,6 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork } private async resolveCanonicalUris(): Promise { - if (isCI) { - this._logService.info('[WT] Enter resolveCanonicalUris()...'); - } - // Open editors const filesToOpen: IPath[] = []; if (this.environmentService.filesToOpenOrCreate) { @@ -255,32 +231,16 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork this._canonicalStartupFiles.push(...canonicalFilesToOpen.filter(uri => this._canonicalStartupFiles.every(u => !this.uriIdentityService.extUri.isEqual(uri, u)))); } - if (isCI) { - this._logService.info('[WT] Done processing open editors...'); - } - // Workspace const workspaceUris = this.workspaceService.getWorkspace().folders.map(f => f.uri); const canonicalWorkspaceFolders = await Promise.all(workspaceUris.map(uri => this.getCanonicalUri(uri))); - if (isCI) { - this._logService.info('[WT] Done processing workspace folders...'); - } - let canonicalWorkspaceConfiguration = this.workspaceService.getWorkspace().configuration; if (canonicalWorkspaceConfiguration && isSavedWorkspace(canonicalWorkspaceConfiguration, this.environmentService)) { canonicalWorkspaceConfiguration = await this.getCanonicalUri(canonicalWorkspaceConfiguration); } - if (isCI) { - this._logService.info('[WT] Done processing workspace configuration...'); - } - this._canonicalWorkspace = new CanonicalWorkspace(this.workspaceService.getWorkspace(), canonicalWorkspaceFolders, canonicalWorkspaceConfiguration); - - if (isCI) { - this._logService.info('[WT] Exit resolveCanonicalUris()...'); - } } private loadTrustInfo(): IWorkspaceTrustInfo { @@ -362,16 +322,7 @@ export class WorkspaceTrustManagementService extends Disposable implements IWork } private async updateWorkspaceTrust(trusted?: boolean): Promise { - if (isCI) { - this._logService.info(`[WT] Enter updateWorkspaceTrust()...`); - } - if (!this.workspaceTrustEnablementService.isWorkspaceTrustEnabled()) { - if (isCI) { - this._logService.info(`[WT] Workspace trust is disabled.`); - this._logService.info(`[WT] Exit updateWorkspaceTrust()...`); - } - return; } diff --git a/src/vs/workbench/services/workspaces/test/common/workspaceTrust.test.ts b/src/vs/workbench/services/workspaces/test/common/workspaceTrust.test.ts index da38839689740..cb8808efc5024 100644 --- a/src/vs/workbench/services/workspaces/test/common/workspaceTrust.test.ts +++ b/src/vs/workbench/services/workspaces/test/common/workspaceTrust.test.ts @@ -10,7 +10,7 @@ import { IConfigurationService } from 'vs/platform/configuration/common/configur import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService'; import { FileService } from 'vs/platform/files/common/fileService'; import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock'; -import { ILogService, NullLogService } from 'vs/platform/log/common/log'; +import { NullLogService } from 'vs/platform/log/common/log'; import { IRemoteAuthorityResolverService } from 'vs/platform/remote/common/remoteAuthorityResolver'; import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage'; import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace'; @@ -28,7 +28,6 @@ suite('Workspace Trust', () => { let instantiationService: TestInstantiationService; let configurationService: TestConfigurationService; let environmentService: IWorkbenchEnvironmentService; - let logService: ILogService; setup(async () => { instantiationService = new TestInstantiationService(); @@ -39,10 +38,7 @@ suite('Workspace Trust', () => { environmentService = {} as IWorkbenchEnvironmentService; instantiationService.stub(IWorkbenchEnvironmentService, environmentService); - logService = new NullLogService(); - instantiationService.stub(ILogService, logService); - - instantiationService.stub(IUriIdentityService, new UriIdentityService(new FileService(logService))); + instantiationService.stub(IUriIdentityService, new UriIdentityService(new FileService(new NullLogService()))); instantiationService.stub(IRemoteAuthorityResolverService, new class extends mock() { }); });