Merge from vscode cfbd1999769f4f08dce29629fb92fdc0fac53829

This commit is contained in:
ADS Merger
2020-08-06 07:08:52 +00:00
parent 9c67832880
commit 540046ba00
362 changed files with 7588 additions and 6584 deletions

View File

@@ -18,11 +18,7 @@ const bootstrap = require('./bootstrap');
const paths = require('./paths');
/** @type {any} */
const product = require('../product.json');
const { app, protocol, crashReporter } = require('electron');
// Disable render process reuse, we still have
// non-context aware native modules in the renderer.
app.allowRendererProcessReuse = false;
const { app, protocol } = require('electron');
// Enable portable support
const portable = bootstrap.configurePortable(product);
@@ -42,13 +38,13 @@ if (args['nogpu']) { // {{SQL CARBON EDIT}}
const userDataPath = getUserDataPath(args);
app.setPath('userData', userDataPath);
// Configure static command line arguments
const argvConfig = configureCommandlineSwitchesSync(args);
// Set temp directory based on crash-reporter-directory CLI argument
// The crash reporter will store crashes in temp folder so we need
// to change that location accordingly.
// If a crash-reporter-directory is specified we store the crash reports
// in the specified directory and don't upload them to the crash server.
// If a crash-reporter-directory is specified we setup the crash reporter
// right from the beginning as early as possible to monitor all processes.
let crashReporterDirectory = args['crash-reporter-directory'];
let submitURL = '';
if (crashReporterDirectory) {
crashReporterDirectory = path.normalize(crashReporterDirectory);
@@ -66,40 +62,22 @@ if (crashReporterDirectory) {
}
}
// Crashes are stored in the crashDumps directory by default, so we
// Crashes are stored in the temp directory by default, so we
// need to change that directory to the provided one
console.log(`Found --crash-reporter-directory argument. Setting crashDumps directory to be '${crashReporterDirectory}'`);
app.setPath('crashDumps', crashReporterDirectory);
} else {
const appCenter = product.appCenter;
// Disable Appcenter crash reporting if
// * --crash-reporter-directory is specified
// * enable-crash-reporter runtime argument is set to 'false'
// * --disable-crash-reporter command line parameter is set
if (appCenter && argvConfig['enable-crash-reporter'] && !args['disable-crash-reporter']) {
const isWindows = (process.platform === 'win32');
const isLinux = (process.platform === 'linux');
const crashReporterId = argvConfig['crash-reporter-id'];
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
if (uuidPattern.test(crashReporterId)) {
submitURL = isWindows ? appCenter[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? appCenter[`linux-x64`] : appCenter.darwin;
submitURL = submitURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', crashReporterId);
// Send the id for child node process that are explicitly starting crash reporter.
// For vscode this is ExtensionHost process currently.
process.argv.push('--crash-reporter-id', crashReporterId);
}
}
}
console.log(`Found --crash-reporter-directory argument. Setting temp directory to be '${crashReporterDirectory}'`);
app.setPath('temp', crashReporterDirectory);
// Start crash reporter for all processes
const productName = (product.crashReporter ? product.crashReporter.productName : undefined) || product.nameShort;
const companyName = (product.crashReporter ? product.crashReporter.companyName : undefined) || 'Microsoft';
crashReporter.start({
companyName: companyName,
productName: process.env['VSCODE_DEV'] ? `${productName} Dev` : productName,
submitURL,
uploadToServer: !crashReporterDirectory
});
// Start crash reporter
const { crashReporter } = require('electron');
const productName = (product.crashReporter && product.crashReporter.productName) || product.nameShort;
const companyName = (product.crashReporter && product.crashReporter.companyName) || 'Microsoft';
crashReporter.start({
companyName: companyName,
productName: process.env['VSCODE_DEV'] ? `${productName} Dev` : productName,
submitURL: '',
uploadToServer: false
});
}
// Set logs path before app 'ready' event if running portable
// to ensure that no 'logs' folder is created on disk at a
@@ -139,6 +117,9 @@ registerListeners();
// Cached data
const nodeCachedDataDir = getNodeCachedDir();
// Configure static command line arguments
const argvConfig = configureCommandlineSwitchesSync(args);
// Remove env set by snap https://github.com/microsoft/vscode/issues/85344
if (process.env['SNAP']) {
delete process.env['GDK_PIXBUF_MODULE_FILE'];
@@ -280,6 +261,9 @@ function configureCommandlineSwitchesSync(cliArgs) {
app.commandLine.appendSwitch('js-flags', jsFlags);
}
// TODO@Deepak Electron 7 workaround for https://github.com/microsoft/vscode/issues/88873
app.commandLine.appendSwitch('disable-features', 'LayoutNG');
return argvConfig;
}