Merge from vscode ad407028575a77ea387eb7cc219b323dc017b686

This commit is contained in:
ADS Merger
2020-08-22 06:06:52 +00:00
committed by Anthony Dresser
parent 404260b8a0
commit 4ad73d381c
480 changed files with 14360 additions and 14122 deletions

View File

@@ -82,6 +82,10 @@ import { WebviewMainService } from 'vs/platform/webview/electron-main/webviewMai
import { IWebviewManagerService } from 'vs/platform/webview/common/webviewManagerService';
import { createServer, AddressInfo } from 'net';
import { IOpenExtensionWindowResult } from 'vs/platform/debug/common/extensionHostDebug';
import { 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';
export class CodeApplication extends Disposable {
private windowsMainService: IWindowsMainService | undefined;
@@ -134,11 +138,6 @@ export class CodeApplication extends Disposable {
//
// !!! DO NOT CHANGE without consulting the documentation !!!
//
app.on('remote-get-guest-web-contents', event => {
this.logService.trace('App#on(remote-get-guest-web-contents): prevented');
event.preventDefault();
});
app.on('remote-require', (event, sender, module) => {
this.logService.trace('App#on(remote-require): prevented');
@@ -807,7 +806,7 @@ export class CodeApplication extends Disposable {
return { fileUri: URI.file(path) };
}
private afterWindowOpen(accessor: ServicesAccessor): void {
private async afterWindowOpen(accessor: ServicesAccessor): Promise<void> {
// Signal phase: after window open
this.lifecycleMainService.phase = LifecycleMainPhase.AfterWindowOpen;
@@ -820,6 +819,34 @@ export class CodeApplication extends Disposable {
if (updateService instanceof Win32UpdateService || updateService instanceof LinuxUpdateService || updateService instanceof DarwinUpdateService) {
updateService.initialize();
}
// If enable-crash-reporter argv is undefined then this is a fresh start,
// based on telemetry.enableCrashreporter settings, generate a UUID which
// will be used as crash reporter id and also update the json file.
try {
const fileService = accessor.get(IFileService);
const argvContent = await fileService.readFile(this.environmentService.argvResource);
const argvString = argvContent.value.toString();
const argvJSON = JSON.parse(stripComments(argvString));
if (argvJSON['enable-crash-reporter'] === undefined) {
const enableCrashReporter = this.configurationService.getValue<boolean>('telemetry.enableCrashReporter') ?? true;
const additionalArgvContent = [
'',
' // Allows to disable crash reporting.',
' // Should restart the app if the value is changed.',
` "enable-crash-reporter": ${enableCrashReporter},`,
'',
' // Unique id used for correlating crash reports sent from this instance.',
' // Do not edit this value.',
` "crash-reporter-id": "${generateUuid()}"`,
'}'
];
const newArgvString = argvString.substring(0, argvString.length - 2).concat(',\n', additionalArgvContent.join('\n'));
await fileService.writeFile(this.environmentService.argvResource, VSBuffer.fromString(newArgvString));
}
} catch (error) {
this.logService.error(error);
}
}
private handleRemoteAuthorities(): void {