sandbox - delete "Code Cache" folder on startup for now (workaround for #120655)

This commit is contained in:
Benjamin Pasero 2021-04-07 14:13:38 +02:00
parent 5dd5dd8100
commit bb90ba3d5a
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65
3 changed files with 22 additions and 4 deletions

View file

@ -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 ((<FileOperationError>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

View file

@ -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'); }
}

View file

@ -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,