diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index e855325520e..da8f7223969 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -71,7 +71,7 @@ import { withNullAsUndefined } from 'vs/base/common/types'; import { mnemonicButtonLabel, getPathLabel } from 'vs/base/common/labels'; import { WebviewMainService } from 'vs/platform/webview/electron-main/webviewMainService'; import { IWebviewManagerService } from 'vs/platform/webview/common/webviewManagerService'; -import { IFileService } from 'vs/platform/files/common/files'; +import { FileOperationError, FileOperationResult, IFileService } from 'vs/platform/files/common/files'; import { stripComments } from 'vs/base/common/json'; import { generateUuid } from 'vs/base/common/uuid'; import { VSBuffer } from 'vs/base/common/buffer'; @@ -417,6 +417,18 @@ export class CodeApplication extends Disposable { this.logService.debug(`from: ${this.environmentMainService.appRoot}`); this.logService.debug('args:', this.environmentMainService.args); + // TODO@bpasero TODO@deepak1556 workaround for #120655 + try { + const cachedDataPath = URI.file(this.environmentMainService.chromeCachedDataDir); + this.logService.trace(`Deleting Chrome cached data path: ${cachedDataPath.fsPath}`); + + await this.fileService.del(cachedDataPath, { recursive: true }); + } catch (error) { + if ((error).fileOperationResult !== FileOperationResult.FILE_NOT_FOUND) { + this.logService.error(error); + } + } + // Make sure we associate the program with the app user model id // This will help Windows to associate the running program with // any shortcut that is pinned to the taskbar and prevent showing diff --git a/src/vs/platform/environment/electron-main/environmentMainService.ts b/src/vs/platform/environment/electron-main/environmentMainService.ts index 912cf8e9594..56705313f6f 100644 --- a/src/vs/platform/environment/electron-main/environmentMainService.ts +++ b/src/vs/platform/environment/electron-main/environmentMainService.ts @@ -25,9 +25,12 @@ export interface IEnvironmentMainService extends INativeEnvironmentService { backupHome: string; backupWorkspacesPath: string; - // --- V8 script cache path + // --- V8 script cache path (ours) nodeCachedDataDir?: string; + // --- V8 script cache path (chrome) + chromeCachedDataDir: string; + // --- IPC mainIPCHandle: string; @@ -66,4 +69,7 @@ export class EnvironmentMainService extends NativeEnvironmentService implements @memoize get nodeCachedDataDir(): string | undefined { return process.env['VSCODE_NODE_CACHED_DATA_DIR'] || undefined; } + + @memoize + get chromeCachedDataDir(): string { return join(this.userDataPath, 'Code Cache'); } } diff --git a/src/vs/platform/issue/electron-main/issueMainService.ts b/src/vs/platform/issue/electron-main/issueMainService.ts index 662bdd79aca..86417c0922d 100644 --- a/src/vs/platform/issue/electron-main/issueMainService.ts +++ b/src/vs/platform/issue/electron-main/issueMainService.ts @@ -11,7 +11,7 @@ import { BrowserWindow, ipcMain, screen, IpcMainEvent, Display } from 'electron' import { ILaunchMainService } from 'vs/platform/launch/electron-main/launchMainService'; import { IDiagnosticsService, PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService'; -import { isMacintosh, IProcessEnvironment } from 'vs/base/common/platform'; +import { isMacintosh, IProcessEnvironment, browserCodeLoadingCacheStrategy } from 'vs/base/common/platform'; import { ILogService } from 'vs/platform/log/common/log'; import { IWindowState } from 'vs/platform/windows/electron-main/windows'; import { listProcesses } from 'vs/base/node/ps'; @@ -289,7 +289,7 @@ export class IssueMainService implements ICommonIssueService { webPreferences: { preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js', require).fsPath, additionalArguments: [`--vscode-window-config=${ipcObjectUrl.resource.toString()}`], - v8CacheOptions: 'bypassHeatCheck', + v8CacheOptions: browserCodeLoadingCacheStrategy, enableWebSQL: false, enableRemoteModule: false, spellcheck: false,