mirror of
https://github.com/Microsoft/vscode
synced 2024-10-06 03:17:00 +00:00
This reverts commit 3d0d50caf8
.
This commit is contained in:
parent
ae245c9b1f
commit
227d533937
2
.yarnrc
2
.yarnrc
|
@ -1,3 +1,3 @@
|
|||
disturl "https://atom.io/download/electron"
|
||||
target "9.1.0"
|
||||
target "7.3.2"
|
||||
runtime "electron"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -21,7 +21,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -8,7 +8,7 @@ pr:
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: AzureKeyVault@1
|
||||
displayName: 'Azure Key Vault: Get Secrets'
|
||||
|
|
|
@ -11,7 +11,7 @@ pr:
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: AzureKeyVault@1
|
||||
displayName: 'Azure Key Vault: Get Secrets'
|
||||
|
|
|
@ -10,7 +10,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -21,7 +21,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -21,7 +21,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -16,7 +16,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
condition: and(succeeded(), ne(variables['CacheExists-Compilation'], 'true'))
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
|
|
|
@ -9,7 +9,7 @@ pr: none
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -21,7 +21,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -21,7 +21,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -21,7 +21,7 @@ steps:
|
|||
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: "12.14.1"
|
||||
versionSpec: "12.13.0"
|
||||
|
||||
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
|
||||
inputs:
|
||||
|
|
|
@ -246,6 +246,10 @@
|
|||
"name": "vs/workbench/services/configurationResolver",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/crashReporter",
|
||||
"project": "vscode-workbench"
|
||||
},
|
||||
{
|
||||
"name": "vs/workbench/services/dialogs",
|
||||
"project": "vscode-workbench"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"git": {
|
||||
"name": "chromium",
|
||||
"repositoryUrl": "https://chromium.googlesource.com/chromium/src",
|
||||
"commitHash": "894fb9eb56c6cbda65e3c3ae9ada6d4cb5850cc9"
|
||||
"commitHash": "e4745133a1d3745f066e068b8033c6a269b59caf"
|
||||
}
|
||||
},
|
||||
"licenseDetail": [
|
||||
|
@ -40,7 +40,7 @@
|
|||
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
|
||||
],
|
||||
"isOnlyProductionDependency": true,
|
||||
"version": "83.0.4103.122"
|
||||
"version": "78.0.3904.130"
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
|
@ -48,11 +48,11 @@
|
|||
"git": {
|
||||
"name": "nodejs",
|
||||
"repositoryUrl": "https://github.com/nodejs/node",
|
||||
"commitHash": "9622fed3fb2cffcea9efff6c8cb4cc2def99d75d"
|
||||
"commitHash": "787378879acfb212ed4ff824bf9f767a24a5cb43a"
|
||||
}
|
||||
},
|
||||
"isOnlyProductionDependency": true,
|
||||
"version": "12.14.1"
|
||||
"version": "12.8.1"
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
|
@ -60,12 +60,12 @@
|
|||
"git": {
|
||||
"name": "electron",
|
||||
"repositoryUrl": "https://github.com/electron/electron",
|
||||
"commitHash": "a822d2639a9c9c2c670e91d73f78e921865ce38e"
|
||||
"commitHash": "5f93e889020d279d5a9cd1ecab080ab467312447"
|
||||
}
|
||||
},
|
||||
"isOnlyProductionDependency": true,
|
||||
"license": "MIT",
|
||||
"version": "9.1.0"
|
||||
"version": "7.3.2"
|
||||
},
|
||||
{
|
||||
"component": {
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
"css-loader": "^3.2.0",
|
||||
"debounce": "^1.0.0",
|
||||
"deemon": "^1.4.0",
|
||||
"electron": "9.1.0",
|
||||
"electron": "7.3.2",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-plugin-jsdoc": "^19.1.0",
|
||||
"event-stream": "3.3.4",
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
disturl "http://nodejs.org/dist"
|
||||
target "12.14.1"
|
||||
target "12.4.0"
|
||||
runtime "node"
|
||||
|
|
68
src/main.js
68
src/main.js
|
@ -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);
|
||||
|
@ -35,13 +31,13 @@ const args = parseCLIArgs();
|
|||
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);
|
||||
|
||||
|
@ -59,40 +55,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
|
||||
|
@ -132,6 +110,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'];
|
||||
|
@ -273,6 +254,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;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,13 @@
|
|||
|
||||
import { Menu, MenuItem, BrowserWindow, ipcMain, IpcMainEvent } from 'electron';
|
||||
import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
|
||||
export function registerContextMenuListener(): void {
|
||||
ipcMain.on(CONTEXT_MENU_CHANNEL, (event: IpcMainEvent, contextMenuId: number, items: ISerializableContextMenuItem[], onClickChannel: string, options?: IPopupOptions) => {
|
||||
const menu = createMenu(event, onClickChannel, items);
|
||||
|
||||
menu.popup({
|
||||
window: withNullAsUndefined(BrowserWindow.fromWebContents(event.sender)),
|
||||
window: BrowserWindow.fromWebContents(event.sender),
|
||||
x: options ? options.x : undefined,
|
||||
y: options ? options.y : undefined,
|
||||
positioningItem: options ? options.positioningItem : undefined,
|
||||
|
|
|
@ -209,6 +209,37 @@ export interface SaveDialogReturnValue {
|
|||
bookmark?: string;
|
||||
}
|
||||
|
||||
export interface CrashReporterStartOptions {
|
||||
companyName: string;
|
||||
/**
|
||||
* URL that crash reports will be sent to as POST.
|
||||
*/
|
||||
submitURL: string;
|
||||
/**
|
||||
* Defaults to `app.name`.
|
||||
*/
|
||||
productName?: string;
|
||||
/**
|
||||
* Whether crash reports should be sent to the server. Default is `true`.
|
||||
*/
|
||||
uploadToServer?: boolean;
|
||||
/**
|
||||
* Default is `false`.
|
||||
*/
|
||||
ignoreSystemCrashHandler?: boolean;
|
||||
/**
|
||||
* An object you can define that will be sent along with the report. Only string
|
||||
* properties are sent correctly. Nested objects are not supported. When using
|
||||
* Windows, the property names and values must be fewer than 64 characters.
|
||||
*/
|
||||
extra?: Record<string, string>;
|
||||
/**
|
||||
* Directory to store the crash reports temporarily (only used when the crash
|
||||
* reporter is started via `process.crashReporter.start`).
|
||||
*/
|
||||
crashesDirectory?: string;
|
||||
}
|
||||
|
||||
export interface FileFilter {
|
||||
|
||||
// Docs: http://electronjs.org/docs/api/structures/file-filter
|
||||
|
@ -250,62 +281,3 @@ export interface MouseInputEvent extends InputEvent {
|
|||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface CrashReporterStartOptions {
|
||||
/**
|
||||
* URL that crash reports will be sent to as POST.
|
||||
*/
|
||||
submitURL: string;
|
||||
/**
|
||||
* Defaults to `app.name`.
|
||||
*/
|
||||
productName?: string;
|
||||
/**
|
||||
* Deprecated alias for `{ globalExtra: { _companyName: ... } }`.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
companyName?: string;
|
||||
/**
|
||||
* Whether crash reports should be sent to the server. If false, crash reports will
|
||||
* be collected and stored in the crashes directory, but not uploaded. Default is
|
||||
* `true`.
|
||||
*/
|
||||
uploadToServer?: boolean;
|
||||
/**
|
||||
* If true, crashes generated in the main process will not be forwarded to the
|
||||
* system crash handler. Default is `false`.
|
||||
*/
|
||||
ignoreSystemCrashHandler?: boolean;
|
||||
/**
|
||||
* If true, limit the number of crashes uploaded to 1/hour. Default is `false`.
|
||||
*
|
||||
* @platform darwin,win32
|
||||
*/
|
||||
rateLimit?: boolean;
|
||||
/**
|
||||
* If true, crash reports will be compressed and uploaded with `Content-Encoding:
|
||||
* gzip`. Not all collection servers support compressed payloads. Default is
|
||||
* `false`.
|
||||
*
|
||||
* @platform darwin,win32
|
||||
*/
|
||||
compress?: boolean;
|
||||
/**
|
||||
* Extra string key/value annotations that will be sent along with crash reports
|
||||
* that are generated in the main process. Only string values are supported.
|
||||
* Crashes generated in child processes will not contain these extra parameters to
|
||||
* crash reports generated from child processes, call `addExtraParameter` from the
|
||||
* child process.
|
||||
*/
|
||||
extra?: Record<string, string>;
|
||||
/**
|
||||
* Extra string key/value annotations that will be sent along with any crash
|
||||
* reports generated in any process. These annotations cannot be changed once the
|
||||
* crash reporter has been started. If a key is present in both the global extra
|
||||
* parameters and the process-specific extra parameters, then the global one will
|
||||
* take precedence. By default, `productName` and the app version are included, as
|
||||
* well as the Electron version.
|
||||
*/
|
||||
globalExtra?: Record<string, string>;
|
||||
}
|
||||
|
|
|
@ -74,16 +74,15 @@
|
|||
},
|
||||
|
||||
/**
|
||||
* Support for subset of methods of Electron's `crashReporter` type.
|
||||
* Support for subset of methods of Electron's `crashReporter` type.
|
||||
*/
|
||||
crashReporter: {
|
||||
|
||||
/**
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
* @param {Electron.CrashReporterStartOptions} options
|
||||
*/
|
||||
addExtraParameter(key, value) {
|
||||
crashReporter.addExtraParameter(key, value);
|
||||
start(options) {
|
||||
crashReporter.start(options);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CrashReporterStartOptions } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
|
||||
export const ipcRenderer = (window as any).vscode.ipcRenderer as {
|
||||
|
||||
/**
|
||||
|
@ -52,23 +54,32 @@ export const webFrame = (window as any).vscode.webFrame as {
|
|||
export const crashReporter = (window as any).vscode.crashReporter as {
|
||||
|
||||
/**
|
||||
* Set an extra parameter to be sent with the crash report. The values specified
|
||||
* here will be sent in addition to any values set via the `extra` option when
|
||||
* `start` was called.
|
||||
* You are required to call this method before using any other `crashReporter` APIs
|
||||
* and in each process (main/renderer) from which you want to collect crash
|
||||
* reports. You can pass different options to `crashReporter.start` when calling
|
||||
* from different processes.
|
||||
*
|
||||
* Parameters added in this fashion (or via the `extra` parameter to
|
||||
* `crashReporter.start`) are specific to the calling process. Adding extra
|
||||
* parameters in the main process will not cause those parameters to be sent along
|
||||
* with crashes from renderer or other child processes. Similarly, adding extra
|
||||
* parameters in a renderer process will not result in those parameters being sent
|
||||
* with crashes that occur in other renderer processes or in the main process.
|
||||
* **Note** Child processes created via the `child_process` module will not have
|
||||
* access to the Electron modules. Therefore, to collect crash reports from them,
|
||||
* use `process.crashReporter.start` instead. Pass the same options as above along
|
||||
* with an additional one called `crashesDirectory` that should point to a
|
||||
* directory to store the crash reports temporarily. You can test this out by
|
||||
* calling `process.crash()` to crash the child process.
|
||||
*
|
||||
* **Note:** Parameters have limits on the length of the keys and values. Key names
|
||||
* must be no longer than 39 bytes, and values must be no longer than 127 bytes.
|
||||
* Keys with names longer than the maximum will be silently ignored. Key values
|
||||
* longer than the maximum length will be truncated.
|
||||
* **Note:** If you need send additional/updated `extra` parameters after your
|
||||
* first call `start` you can call `addExtraParameter` on macOS or call `start`
|
||||
* again with the new/updated `extra` parameters on Linux and Windows.
|
||||
*
|
||||
* **Note:** On macOS and windows, Electron uses a new `crashpad` client for crash
|
||||
* collection and reporting. If you want to enable crash reporting, initializing
|
||||
* `crashpad` from the main process using `crashReporter.start` is required
|
||||
* regardless of which process you want to collect crashes from. Once initialized
|
||||
* this way, the crashpad handler collects crashes from all processes. You still
|
||||
* have to call `crashReporter.start` from the renderer or child process, otherwise
|
||||
* crashes from them will get reported without `companyName`, `productName` or any
|
||||
* of the `extra` information.
|
||||
*/
|
||||
addExtraParameter(key: string, value: string): void;
|
||||
start(options: CrashReporterStartOptions): void;
|
||||
};
|
||||
|
||||
export const process = (window as any).vscode.process as {
|
||||
|
|
|
@ -82,10 +82,6 @@ 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;
|
||||
|
@ -138,6 +134,11 @@ 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');
|
||||
|
||||
|
@ -806,7 +807,7 @@ export class CodeApplication extends Disposable {
|
|||
return { fileUri: URI.file(path) };
|
||||
}
|
||||
|
||||
private async afterWindowOpen(accessor: ServicesAccessor): Promise<void> {
|
||||
private afterWindowOpen(accessor: ServicesAccessor): void {
|
||||
|
||||
// Signal phase: after window open
|
||||
this.lifecycleMainService.phase = LifecycleMainPhase.AfterWindowOpen;
|
||||
|
@ -819,34 +820,6 @@ 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 {
|
||||
|
|
|
@ -64,9 +64,7 @@ export class ProxyAuthHandler extends Disposable {
|
|||
contextIsolation: true,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
devTools: false,
|
||||
v8CacheOptions: 'bypassHeatCheck'
|
||||
devTools: false
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ export class SharedProcess implements ISharedProcess {
|
|||
nodeIntegration: true,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
images: false,
|
||||
webgl: false,
|
||||
|
|
|
@ -170,7 +170,6 @@ export class CodeWindow extends Disposable implements ICodeWindow {
|
|||
nodeIntegration: true,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
webviewTag: true,
|
||||
zoomFactor: zoomLevelToZoomFactor(windowConfig?.zoomLevel)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogReturnValue, MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogReturnValue, CrashReporterStartOptions, MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { IOpenedWindow, IWindowOpenable, IOpenEmptyWindowOptions, IOpenWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
|
@ -98,6 +98,7 @@ export interface ICommonElectronService {
|
|||
// Development
|
||||
openDevTools(options?: OpenDevToolsOptions): Promise<void>;
|
||||
toggleDevTools(): Promise<void>;
|
||||
startCrashReporter(options: CrashReporterStartOptions): Promise<void>;
|
||||
sendInputEvent(event: MouseInputEvent): Promise<void>;
|
||||
|
||||
// Connectivity
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, Menu, BrowserWindow, app, clipboard, powerMonitor } from 'electron';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, CrashReporterStartOptions, crashReporter, Menu, BrowserWindow, app, clipboard, powerMonitor } from 'electron';
|
||||
import { OpenContext } from 'vs/platform/windows/node/window';
|
||||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { IOpenedWindow, IOpenWindowOptions, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
|
@ -20,6 +20,7 @@ import { dirExists } from 'vs/base/node/pfs';
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { INativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { MouseInputEvent } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { totalmem } from 'os';
|
||||
|
@ -37,7 +38,8 @@ export class ElectronMainService implements IElectronMainService {
|
|||
@IDialogMainService private readonly dialogMainService: IDialogMainService,
|
||||
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
|
||||
@IEnvironmentService private readonly environmentService: INativeEnvironmentService,
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService
|
||||
@ITelemetryService private readonly telemetryService: ITelemetryService,
|
||||
@ILogService private readonly logService: ILogService
|
||||
) {
|
||||
}
|
||||
|
||||
|
@ -477,6 +479,12 @@ export class ElectronMainService implements IElectronMainService {
|
|||
}
|
||||
}
|
||||
|
||||
async startCrashReporter(windowId: number | undefined, options: CrashReporterStartOptions): Promise<void> {
|
||||
this.logService.trace('ElectronMainService#crashReporter', JSON.stringify(options));
|
||||
|
||||
crashReporter.start(options);
|
||||
}
|
||||
|
||||
async sendInputEvent(windowId: number | undefined, event: MouseInputEvent): Promise<void> {
|
||||
const window = this.windowById(windowId);
|
||||
if (window && (event.type === 'mouseDown' || event.type === 'mouseUp')) {
|
||||
|
|
|
@ -64,7 +64,6 @@ export interface ParsedArgs {
|
|||
'disable-updates'?: boolean;
|
||||
'disable-crash-reporter'?: boolean;
|
||||
'crash-reporter-directory'?: string;
|
||||
'crash-reporter-id'?: string;
|
||||
'skip-add-to-recently-opened'?: boolean;
|
||||
'max-memory'?: string;
|
||||
'file-write'?: boolean;
|
||||
|
@ -183,7 +182,6 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
|
|||
'disable-updates': { type: 'boolean' },
|
||||
'disable-crash-reporter': { type: 'boolean' },
|
||||
'crash-reporter-directory': { type: 'string' },
|
||||
'crash-reporter-id': { type: 'string' },
|
||||
'disable-user-env-probe': { type: 'boolean' },
|
||||
'skip-add-to-recently-opened': { type: 'boolean' },
|
||||
'unity-launch': { type: 'boolean' },
|
||||
|
|
|
@ -256,7 +256,7 @@ export class EnvironmentService implements INativeEnvironmentService {
|
|||
get serviceMachineIdResource(): URI { return resources.joinPath(URI.file(this.userDataPath), 'machineid'); }
|
||||
|
||||
get disableUpdates(): boolean { return !!this._args['disable-updates']; }
|
||||
get crashReporterId(): string | undefined { return this._args['crash-reporter-id']; }
|
||||
get disableCrashReporter(): boolean { return !!this._args['disable-crash-reporter']; }
|
||||
get crashReporterDirectory(): string | undefined { return this._args['crash-reporter-directory']; }
|
||||
|
||||
get driverHandle(): string | undefined { return this._args['driver']; }
|
||||
|
|
|
@ -200,7 +200,6 @@ export class IssueMainService implements ICommonIssueService {
|
|||
preload: URI.parse(require.toUrl('vs/base/parts/sandbox/electron-browser/preload.js')).fsPath,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
zoomFactor: zoomLevelToZoomFactor(data.zoomLevel),
|
||||
...this.environmentService.sandbox ?
|
||||
|
@ -266,7 +265,6 @@ export class IssueMainService implements ICommonIssueService {
|
|||
preload: URI.parse(require.toUrl('vs/base/parts/sandbox/electron-browser/preload.js')).fsPath,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
zoomFactor: zoomLevelToZoomFactor(data.zoomLevel),
|
||||
...this.environmentService.sandbox ?
|
||||
|
|
|
@ -70,18 +70,14 @@ export class LaunchMainService implements ILaunchMainService {
|
|||
@IConfigurationService private readonly configurationService: IConfigurationService
|
||||
) { }
|
||||
|
||||
async start(args: ParsedArgs, userEnv: IProcessEnvironment): Promise<void> {
|
||||
start(args: ParsedArgs, userEnv: IProcessEnvironment): Promise<void> {
|
||||
this.logService.trace('Received data from other instance: ', args, userEnv);
|
||||
|
||||
// Since we now start to open a window, make sure the app has focus.
|
||||
// Focussing a window will not ensure that the application itself
|
||||
// has focus, so we use the `steal: true` hint to force focus.
|
||||
app.focus({ steal: true });
|
||||
const urlsToOpen = parseOpenUrl(args);
|
||||
|
||||
// Check early for open-url which is handled in URL service
|
||||
const urlsToOpen = parseOpenUrl(args);
|
||||
if (urlsToOpen.length) {
|
||||
let whenWindowReady: Promise<unknown> = Promise.resolve();
|
||||
let whenWindowReady: Promise<any> = Promise.resolve<any>(null);
|
||||
|
||||
// Create a window if there is none
|
||||
if (this.windowsMainService.getWindowCount() === 0) {
|
||||
|
@ -95,12 +91,12 @@ export class LaunchMainService implements ILaunchMainService {
|
|||
this.urlService.open(url);
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
// Otherwise handle in windows service
|
||||
else {
|
||||
return this.startOpenWindow(args, userEnv);
|
||||
}
|
||||
return this.startOpenWindow(args, userEnv);
|
||||
}
|
||||
|
||||
private startOpenWindow(args: ParsedArgs, userEnv: IProcessEnvironment): Promise<void> {
|
||||
|
|
|
@ -10,7 +10,7 @@ import { IUpdateRequest, IStorageDatabase, IStorageItemsChangeEvent } from 'vs/b
|
|||
import { Disposable, IDisposable, dispose } from 'vs/base/common/lifecycle';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey, currentSessionDateStorageKey } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { instanceStorageKey, firstSessionDateStorageKey, lastSessionDateStorageKey, currentSessionDateStorageKey, crashReporterIdStorageKey } from 'vs/platform/telemetry/common/telemetry';
|
||||
|
||||
type Key = string;
|
||||
type Value = string;
|
||||
|
@ -49,6 +49,16 @@ export class GlobalStorageDatabaseChannel extends Disposable implements IServerC
|
|||
this.logService.error(`[storage] init(): Unable to init global storage due to ${error}`);
|
||||
}
|
||||
|
||||
// This is unique to the application instance and thereby
|
||||
// should be written from the main process once.
|
||||
//
|
||||
// THIS SHOULD NEVER BE SENT TO TELEMETRY.
|
||||
//
|
||||
const crashReporterId = this.storageMainService.get(crashReporterIdStorageKey, undefined);
|
||||
if (crashReporterId === undefined) {
|
||||
this.storageMainService.store(crashReporterIdStorageKey, generateUuid());
|
||||
}
|
||||
|
||||
// Apply global telemetry values as part of the initialization
|
||||
// These are global across all windows and thereby should be
|
||||
// written from the main process once.
|
||||
|
|
|
@ -57,3 +57,4 @@ export const currentSessionDateStorageKey = 'telemetry.currentSessionDate';
|
|||
export const firstSessionDateStorageKey = 'telemetry.firstSessionDate';
|
||||
export const lastSessionDateStorageKey = 'telemetry.lastSessionDate';
|
||||
export const machineIdKey = 'telemetry.machineId';
|
||||
export const crashReporterIdStorageKey = 'crashReporter.guid';
|
||||
|
|
|
@ -23,6 +23,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
|
|||
|
||||
interface IConfiguration extends IWindowsConfiguration {
|
||||
update: { mode: string; };
|
||||
telemetry: { enableCrashReporter: boolean };
|
||||
debug: { console: { wordWrap: boolean } };
|
||||
editor: { accessibilitySupport: 'on' | 'off' | 'auto' };
|
||||
}
|
||||
|
@ -34,6 +35,7 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
|||
private nativeFullScreen: boolean | undefined;
|
||||
private clickThroughInactive: boolean | undefined;
|
||||
private updateMode: string | undefined;
|
||||
private enableCrashReporter: boolean | undefined;
|
||||
private debugConsoleWordWrap: boolean | undefined;
|
||||
private accessibilitySupport: 'on' | 'off' | 'auto' | undefined;
|
||||
|
||||
|
@ -90,6 +92,12 @@ export class SettingsChangeRelauncher extends Disposable implements IWorkbenchCo
|
|||
changed = true;
|
||||
}
|
||||
|
||||
// Crash reporter
|
||||
if (typeof config.telemetry?.enableCrashReporter === 'boolean' && config.telemetry.enableCrashReporter !== this.enableCrashReporter) {
|
||||
this.enableCrashReporter = config.telemetry.enableCrashReporter;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// On linux turning on accessibility support will also pass this flag to the chrome renderer, thus a restart is required
|
||||
if (isLinux && typeof config.editor?.accessibilitySupport === 'string' && config.editor.accessibilitySupport !== this.accessibilitySupport) {
|
||||
this.accessibilitySupport = config.editor.accessibilitySupport;
|
||||
|
|
|
@ -17,8 +17,6 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common
|
|||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing';
|
||||
|
||||
export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution {
|
||||
|
||||
|
@ -35,8 +33,6 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution
|
|||
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||
@IExtensionGalleryService private readonly galleryService: IExtensionGalleryService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IEnvironmentService private readonly environmentService: IEnvironmentService,
|
||||
@IJSONEditingService private readonly jsonEditingService: IJSONEditingService
|
||||
) { }
|
||||
|
||||
protected async handleTelemetryOptOut(): Promise<void> {
|
||||
|
@ -140,10 +136,10 @@ export abstract class AbstractTelemetryOptOut implements IWorkbenchContribution
|
|||
},
|
||||
{
|
||||
label: noLabel,
|
||||
run: async () => {
|
||||
run: () => {
|
||||
logTelemetry(true);
|
||||
this.configurationService.updateValue('telemetry.enableTelemetry', false);
|
||||
await this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['enable-crash-reporter'], value: false }], true);
|
||||
this.configurationService.updateValue('telemetry.enableCrashReporter', false);
|
||||
}
|
||||
}
|
||||
],
|
||||
|
@ -168,11 +164,9 @@ export class BrowserTelemetryOptOut extends AbstractTelemetryOptOut {
|
|||
@IExperimentService experimentService: IExperimentService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IExtensionGalleryService galleryService: IExtensionGalleryService,
|
||||
@IProductService productService: IProductService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@IJSONEditingService jsonEditingService: IJSONEditingService
|
||||
@IProductService productService: IProductService
|
||||
) {
|
||||
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService);
|
||||
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService);
|
||||
|
||||
this.handleTelemetryOptOut();
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common
|
|||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IHostService } from 'vs/workbench/services/host/browser/host';
|
||||
import { AbstractTelemetryOptOut } from 'vs/workbench/contrib/welcome/telemetryOptOut/browser/telemetryOptOut';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IJSONEditingService } from 'vs/workbench/services/configuration/common/jsonEditing';
|
||||
import { IElectronService } from 'vs/platform/electron/electron-sandbox/electron';
|
||||
|
||||
export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
|
||||
|
@ -29,11 +27,9 @@ export class NativeTelemetryOptOut extends AbstractTelemetryOptOut {
|
|||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IExtensionGalleryService galleryService: IExtensionGalleryService,
|
||||
@IProductService productService: IProductService,
|
||||
@IEnvironmentService environmentService: IEnvironmentService,
|
||||
@IJSONEditingService jsonEditingService: IJSONEditingService,
|
||||
@IElectronService private readonly electronService: IElectronService
|
||||
) {
|
||||
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService, environmentService, jsonEditingService);
|
||||
super(storageService, openerService, notificationService, hostService, telemetryService, experimentService, configurationService, galleryService, productService);
|
||||
|
||||
this.handleTelemetryOptOut();
|
||||
}
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
import * as nls from 'vs/nls';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as errors from 'vs/base/common/errors';
|
||||
import { equals } from 'vs/base/common/objects';
|
||||
import { equals, deepClone } from 'vs/base/common/objects';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IAction, Separator } from 'vs/base/common/actions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { toResource, IUntitledTextResourceEditorInput, SideBySideEditor, pathsToEditors } from 'vs/workbench/common/editor';
|
||||
import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { ITelemetryService, crashReporterIdStorageKey } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWindowSettings, IOpenFileRequest, IWindowsConfiguration, getTitleBarStyle, IAddFoldersRequest } from 'vs/platform/windows/common/windows';
|
||||
import { IRunActionInWindowRequest, IRunKeybindingInWindowRequest, INativeOpenFileRequest } from 'vs/platform/windows/node/window';
|
||||
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
|
||||
|
@ -22,7 +22,8 @@ import { setFullscreen, getZoomLevel } from 'vs/base/browser/browser';
|
|||
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
import { IResourceEditorInput } from 'vs/platform/editor/common/editor';
|
||||
import { KeyboardMapperFactory } from 'vs/workbench/services/keybinding/electron-browser/nativeKeymapService';
|
||||
import { ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { CrashReporterStartOptions } from 'vs/base/parts/sandbox/common/electronTypes';
|
||||
import { crashReporter, ipcRenderer } from 'vs/base/parts/sandbox/electron-sandbox/globals';
|
||||
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
|
||||
import { IMenuService, MenuId, IMenu, MenuItemAction, ICommandAction, SubmenuItemAction, MenuRegistry } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
|
@ -32,8 +33,8 @@ import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
|||
import { LifecyclePhase, ILifecycleService } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { IWorkspaceFolderCreationData, IWorkspacesService } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { IIntegrityService } from 'vs/workbench/services/integrity/common/integrity';
|
||||
import { isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { isWindows, isMacintosh, isLinux } from 'vs/base/common/platform';
|
||||
import { IProductService, IAppCenterConfiguration } from 'vs/platform/product/common/productService';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
|
@ -45,7 +46,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
|||
import { MenubarControl } from '../browser/parts/titlebar/menubarControl';
|
||||
import { ILabelService } from 'vs/platform/label/common/label';
|
||||
import { IUpdateService } from 'vs/platform/update/common/update';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
|
||||
import { IPreferencesService } from '../services/preferences/common/preferences';
|
||||
import { IMenubarData, IMenubarMenu, IMenubarKeybinding, IMenubarMenuItemSubmenu, IMenubarMenuItemAction, MenubarMenuItem } from 'vs/platform/menubar/common/menubar';
|
||||
import { IMenubarService } from 'vs/platform/menubar/electron-sandbox/menubar';
|
||||
|
@ -107,8 +108,9 @@ export class NativeWindow extends Disposable {
|
|||
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
|
||||
@IWorkingCopyService private readonly workingCopyService: IWorkingCopyService,
|
||||
@IFilesConfigurationService private readonly filesConfigurationService: IFilesConfigurationService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IProductService private readonly productService: IProductService,
|
||||
@IRemoteAuthorityResolverService private readonly remoteAuthorityResolverService: IRemoteAuthorityResolverService
|
||||
@IRemoteAuthorityResolverService private readonly remoteAuthorityResolverService: IRemoteAuthorityResolverService,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -414,6 +416,23 @@ export class NativeWindow extends Disposable {
|
|||
|
||||
// Touchbar menu (if enabled)
|
||||
this.updateTouchbarMenu();
|
||||
|
||||
// Crash reporter (if enabled)
|
||||
if (!this.environmentService.disableCrashReporter && this.configurationService.getValue('telemetry.enableCrashReporter')) {
|
||||
const companyName = this.productService.crashReporter?.companyName || 'Microsoft';
|
||||
const productName = this.productService.crashReporter?.productName || this.productService.nameShort;
|
||||
|
||||
// With a provided crash reporter directory, crashes
|
||||
// will be stored only locally in that folder
|
||||
if (this.environmentService.crashReporterDirectory) {
|
||||
this.setupCrashReporter(companyName, productName, undefined, this.environmentService.crashReporterDirectory);
|
||||
}
|
||||
|
||||
// With appCenter enabled, crashes will be uploaded
|
||||
else if (this.productService.appCenter) {
|
||||
this.setupCrashReporter(companyName, productName, this.productService.appCenter, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private setupOpenHandlers(): void {
|
||||
|
@ -531,6 +550,42 @@ export class NativeWindow extends Disposable {
|
|||
}
|
||||
}
|
||||
|
||||
private async setupCrashReporter(companyName: string, productName: string, appCenter: IAppCenterConfiguration, crashesDirectory: undefined): Promise<void>;
|
||||
private async setupCrashReporter(companyName: string, productName: string, appCenter: undefined, crashesDirectory: string): Promise<void>;
|
||||
private async setupCrashReporter(companyName: string, productName: string, appCenter: IAppCenterConfiguration | undefined, crashesDirectory: string | undefined): Promise<void> {
|
||||
let submitURL: string | undefined = undefined;
|
||||
if (appCenter) {
|
||||
submitURL = isWindows ? appCenter[process.arch === 'ia32' ? 'win32-ia32' : 'win32-x64'] : isLinux ? appCenter[`linux-x64`] : appCenter.darwin;
|
||||
}
|
||||
|
||||
const info = await this.telemetryService.getTelemetryInfo();
|
||||
const crashReporterId = this.storageService.get(crashReporterIdStorageKey, StorageScope.GLOBAL)!;
|
||||
|
||||
// base options with product info
|
||||
const options: CrashReporterStartOptions = {
|
||||
companyName,
|
||||
productName,
|
||||
submitURL: (submitURL?.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', info.sessionId)) || '',
|
||||
extra: {
|
||||
vscode_version: this.productService.version,
|
||||
vscode_commit: this.productService.commit || ''
|
||||
},
|
||||
|
||||
// If `crashesDirectory` is specified, we do not upload
|
||||
uploadToServer: !crashesDirectory,
|
||||
};
|
||||
|
||||
// start crash reporter in the main process first.
|
||||
// On windows crashpad excepts a name pipe for the client to connect,
|
||||
// this pipe is created by crash reporter initialization from the main process,
|
||||
// changing this order of initialization will cause issues.
|
||||
// For more info: https://chromium.googlesource.com/crashpad/crashpad/+/HEAD/doc/overview_design.md#normal-registration
|
||||
await this.electronService.startCrashReporter(options);
|
||||
|
||||
// start crash reporter right here
|
||||
crashReporter.start(deepClone(options));
|
||||
}
|
||||
|
||||
private onAddFoldersRequest(request: IAddFoldersRequest): void {
|
||||
|
||||
// Buffer all pending requests
|
||||
|
|
|
@ -344,14 +344,6 @@ import { IJSONSchema } from 'vs/base/common/jsonSchema';
|
|||
type: 'string',
|
||||
markdownDescription: nls.localize('argv.forceColorProfile', 'Allows to override the color profile to use. If you experience colors appear badly, try to set this to `srgb` and restart.')
|
||||
},
|
||||
'enable-crash-reporter': {
|
||||
type: 'boolean',
|
||||
markdownDescription: nls.localize('argv.enableCrashReporter', 'Allows to disable crash reporting, should restart the app if the value is changed.')
|
||||
},
|
||||
'crash-reporter-id': {
|
||||
type: 'string',
|
||||
markdownDescription: nls.localize('argv.crashReporterId', 'Unique id used for correlating crash reports sent from this app instance.')
|
||||
},
|
||||
'enable-proposed-api': {
|
||||
type: 'array',
|
||||
description: nls.localize('argv.enebleProposedApi', "Enable proposed APIs for a list of extension ids (such as \`vscode.git\`). Proposed APIs are unstable and subject to breaking without warning at any time. This should only be set for extension development and testing purposes."),
|
||||
|
|
|
@ -17,8 +17,8 @@ export interface INativeWorkbenchEnvironmentService extends IWorkbenchEnvironmen
|
|||
|
||||
readonly configuration: INativeEnvironmentConfiguration;
|
||||
|
||||
readonly disableCrashReporter: boolean;
|
||||
readonly crashReporterDirectory?: string;
|
||||
readonly crashReporterId?: string;
|
||||
|
||||
readonly cliPath: string;
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ import { joinPath } from 'vs/base/common/resources';
|
|||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IOutputChannelRegistry, Extensions } from 'vs/workbench/services/output/common/output';
|
||||
import { INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
|
||||
import { isUUID } from 'vs/base/common/uuid';
|
||||
|
||||
export interface ILocalProcessExtensionHostInitData {
|
||||
readonly autoStart: boolean;
|
||||
|
@ -183,23 +182,18 @@ export class LocalProcessExtensionHost implements IExtensionHost {
|
|||
opts.execArgv = ['--inspect-port=0'];
|
||||
}
|
||||
|
||||
// On linux crash reporter needs to be started on child node processes explicitly
|
||||
if (platform.isLinux) {
|
||||
const crashReporterStartOptions: CrashReporterStartOptions = {
|
||||
// Enable the crash reporter depending on environment for local reporting
|
||||
const crashesDirectory = this._environmentService.crashReporterDirectory;
|
||||
if (crashesDirectory) {
|
||||
const crashReporterOptions: CrashReporterStartOptions = {
|
||||
companyName: this._productService.crashReporter?.companyName || 'Microsoft',
|
||||
productName: this._productService.crashReporter?.productName || this._productService.nameShort,
|
||||
submitURL: '',
|
||||
uploadToServer: false
|
||||
uploadToServer: false,
|
||||
crashesDirectory
|
||||
};
|
||||
const crashReporterId = this._environmentService.crashReporterId; // crashReporterId is set by the main process only when crash reporting is enabled by the user.
|
||||
const appcenter = this._productService.appCenter;
|
||||
const uploadCrashesToServer = !this._environmentService.crashReporterDirectory; // only upload unless --crash-reporter-directory is provided
|
||||
if (uploadCrashesToServer && appcenter && crashReporterId && isUUID(crashReporterId)) {
|
||||
const submitURL = appcenter[`linux-x64`];
|
||||
crashReporterStartOptions.submitURL = submitURL.concat('&uid=', crashReporterId, '&iid=', crashReporterId, '&sid=', crashReporterId);
|
||||
crashReporterStartOptions.uploadToServer = true;
|
||||
}
|
||||
opts.env.CRASH_REPORTER_START_OPTIONS = JSON.stringify(crashReporterStartOptions);
|
||||
|
||||
opts.env.CRASH_REPORTER_START_OPTIONS = JSON.stringify(crashReporterOptions);
|
||||
}
|
||||
|
||||
// Run Extension Host as fork of current process
|
||||
|
|
|
@ -215,6 +215,7 @@ export class TestElectronService implements IElectronService {
|
|||
async exit(code: number): Promise<void> { }
|
||||
async openDevTools(options?: Electron.OpenDevToolsOptions | undefined): Promise<void> { }
|
||||
async toggleDevTools(): Promise<void> { }
|
||||
async startCrashReporter(options: Electron.CrashReporterStartOptions): Promise<void> { }
|
||||
async resolveProxy(url: string): Promise<string | undefined> { return undefined; }
|
||||
async readClipboardText(type?: 'selection' | 'clipboard' | undefined): Promise<string> { return ''; }
|
||||
async writeClipboardText(text: string, type?: 'selection' | 'clipboard' | undefined): Promise<void> { }
|
||||
|
|
|
@ -12,10 +12,6 @@ const events = require('events');
|
|||
// const MochaJUnitReporter = require('mocha-junit-reporter');
|
||||
const url = require('url');
|
||||
|
||||
// Disable render process reuse, we still have
|
||||
// non-context aware native modules in the renderer.
|
||||
app.allowRendererProcessReuse = false;
|
||||
|
||||
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
|
||||
|
||||
const optimist = require('optimist')
|
||||
|
@ -121,7 +117,6 @@ app.on('ready', () => {
|
|||
nodeIntegration: true,
|
||||
enableWebSQL: false,
|
||||
enableRemoteModule: false,
|
||||
spellcheck: false,
|
||||
nativeWindowOpen: true,
|
||||
webviewTag: true
|
||||
}
|
||||
|
|
|
@ -2744,10 +2744,10 @@ electron-to-chromium@^1.2.7:
|
|||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz#78ecb8a399066187bb374eede35d9c70565a803d"
|
||||
integrity sha1-eOy4o5kGYYe7N07t412ccFZagD0=
|
||||
|
||||
electron@9.1.0:
|
||||
version "9.1.0"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-9.1.0.tgz#ca77600c9e4cd591298c340e013384114d3d8d05"
|
||||
integrity sha512-VRAF8KX1m0py9I9sf0kw1kWfeC87mlscfFcbcRdLBsNJ44/GrJhi3+E8rKbpHUeZNQxsPaVA5Zu5Lxb6dV/scQ==
|
||||
electron@7.3.2:
|
||||
version "7.3.2"
|
||||
resolved "https://registry.yarnpkg.com/electron/-/electron-7.3.2.tgz#184b69fe9089693e179b3b34effa975dfc8e505d"
|
||||
integrity sha512-5uSWVfCJogiPiU0G+RKi4ECnNs0gPNjAwYVE9KR7RXaOJYcpNIC5RFejaaUnuRoBssJ5B1n/5WU6wDUxvPajWQ==
|
||||
dependencies:
|
||||
"@electron/get" "^1.0.1"
|
||||
"@types/node" "^12.0.12"
|
||||
|
|
Loading…
Reference in a new issue