Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ function configureCommandlineSwitchesSync(cliArgs: NativeParsedArgs) {
app.commandLine.appendSwitch('disable-blink-features', blinkFeaturesToDisable);

// Support JS Flags
const jsFlags = getJSFlags(cliArgs);
const jsFlags = getJSFlags(cliArgs, argvConfig);
if (jsFlags) {
app.commandLine.appendSwitch('js-flags', jsFlags);
}
Expand Down Expand Up @@ -374,6 +374,7 @@ interface IArgvConfig {
readonly 'use-inmemory-secretstorage'?: boolean;
readonly 'enable-rdp-display-tracking'?: boolean;
readonly 'remote-debugging-port'?: string;
readonly 'js-flags'?: string;
}

function readArgvConfigSync(): IArgvConfig {
Expand Down Expand Up @@ -537,14 +538,19 @@ function configureCrashReporter(): void {
});
}

function getJSFlags(cliArgs: NativeParsedArgs): string | null {
function getJSFlags(cliArgs: NativeParsedArgs, argvConfig: IArgvConfig): string | null {
const jsFlags: string[] = [];

// Add any existing JS flags we already got from the command line
if (cliArgs['js-flags']) {
jsFlags.push(cliArgs['js-flags']);
}

// Add JS flags from runtime arguments (argv.json)
if (typeof argvConfig['js-flags'] === 'string' && argvConfig['js-flags']) {
jsFlags.push(argvConfig['js-flags']);
}

if (process.platform === 'linux') {
// Fix cppgc crash on Linux with 16KB page size.
// Refs https://issues.chromium.org/issues/378017037
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,12 @@ export class UtilityProcess extends Disposable {
const serviceName = `${this.configuration.type}-${this.id}`;
const modulePath = FileAccess.asFileUri('bootstrap-fork.js').fsPath;
const args = this.configuration.args ?? [];
const execArgv = this.configuration.execArgv ?? [];
const execArgv = [...(this.configuration.execArgv ?? [])];
const allowLoadingUnsignedLibraries = this.configuration.allowLoadingUnsignedLibraries;
const jsFlags = app.commandLine.getSwitchValue('js-flags');
if (jsFlags) {
execArgv.push(`--js-flags=${jsFlags}`);
}
const respondToAuthRequestsFromMainProcess = this.configuration.respondToAuthRequestsFromMainProcess;
const stdio = 'pipe';
const env = this.createEnv(configuration);
Expand Down
4 changes: 4 additions & 0 deletions src/vs/workbench/electron-browser/desktop.contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,10 @@ import product from '../../platform/product/common/product.js';
'remote-debugging-port': {
type: 'string',
description: localize('argv.remoteDebuggingPort', "Specifies the port to use for remote debugging.")
},
'js-flags': {
type: 'string',
description: localize('argv.jsFlags', "Specifies V8 JavaScript engine flags to pass (e.g. \"--max-old-space-size=4096\"). These flags are applied to the main process, renderer and utility processes.")
}
}
};
Expand Down
Loading