提交 029e9929 编写于 作者: R Robo 提交者: Benjamin Pasero

chore: Update to Electron 6.x (#75802)

上级 64980ea1
disturl "https://atom.io/download/electron" disturl "https://atom.io/download/electron"
target "4.2.10" target "6.0.9"
runtime "electron" runtime "electron"
...@@ -100,7 +100,7 @@ steps: ...@@ -100,7 +100,7 @@ steps:
- script: | - script: |
set -e set -e
DISPLAY=:10 ./scripts/test.sh --build --tfs "Unit Tests" DISPLAY=:10 ./scripts/test.sh --build --tfs --no-sandbox "Unit Tests"
displayName: Run unit tests displayName: Run unit tests
condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false')) condition: and(succeeded(), eq(variables['VSCODE_STEP_ON_IT'], 'false'))
......
...@@ -31,4 +31,4 @@ if (!/yarn\.js$|yarnpkg$/.test(process.env['npm_execpath'])) { ...@@ -31,4 +31,4 @@ if (!/yarn\.js$|yarnpkg$/.test(process.env['npm_execpath'])) {
if (err) { if (err) {
console.error(''); console.error('');
process.exit(1); process.exit(1);
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"git": { "git": {
"name": "chromium", "name": "chromium",
"repositoryUrl": "https://chromium.googlesource.com/chromium/src", "repositoryUrl": "https://chromium.googlesource.com/chromium/src",
"commitHash": "c6a08e5368de4352903e702cde750b33239a50ab" "commitHash": "91f08db83c2ce8c722ddf0911ead8f7c473bedfa"
} }
}, },
"licenseDetail": [ "licenseDetail": [
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
"SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." "SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
], ],
"isOnlyProductionDependency": true, "isOnlyProductionDependency": true,
"version": "69.0.3497.128" "version": "76.0.3809.146"
}, },
{ {
"component": { "component": {
...@@ -48,11 +48,11 @@ ...@@ -48,11 +48,11 @@
"git": { "git": {
"name": "nodejs", "name": "nodejs",
"repositoryUrl": "https://github.com/nodejs/node", "repositoryUrl": "https://github.com/nodejs/node",
"commitHash": "8c70b2084ce5f76ea1e3b3c4ccdeee4483fe338b" "commitHash": "64219741218aa87e259cf8257596073b8e747f0a"
} }
}, },
"isOnlyProductionDependency": true, "isOnlyProductionDependency": true,
"version": "10.11.0" "version": "12.4.0"
}, },
{ {
"component": { "component": {
...@@ -60,12 +60,12 @@ ...@@ -60,12 +60,12 @@
"git": { "git": {
"name": "electron", "name": "electron",
"repositoryUrl": "https://github.com/electron/electron", "repositoryUrl": "https://github.com/electron/electron",
"commitHash": "4e4c7527c63fcf27dffaeb58bde996b8d859c0ed" "commitHash": "407747b48c47cdeed156a73dde1c47609470c95a"
} }
}, },
"isOnlyProductionDependency": true, "isOnlyProductionDependency": true,
"license": "MIT", "license": "MIT",
"version": "4.2.10" "version": "6.0.9"
}, },
{ {
"component": { "component": {
......
disturl "http://nodejs.org/dist" disturl "http://nodejs.org/dist"
target "10.11.0" target "12.4.0"
runtime "node" runtime "node"
...@@ -8,6 +8,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then ...@@ -8,6 +8,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
else else
ROOT=$(dirname $(dirname $(readlink -f $0))) ROOT=$(dirname $(dirname $(readlink -f $0)))
VSCODEUSERDATADIR=`mktemp -d 2>/dev/null` VSCODEUSERDATADIR=`mktemp -d 2>/dev/null`
LINUX_NO_SANDBOX="--no-sandbox" # workaround Electron 6 issue on Linux when running tests in container
fi fi
cd $ROOT cd $ROOT
...@@ -33,16 +34,16 @@ else ...@@ -33,16 +34,16 @@ else
fi fi
# Integration tests in AMD # Integration tests in AMD
./scripts/test.sh --runGlob **/*.integrationTest.js "$@" ./scripts/test.sh $LINUX_NO_SANDBOX --runGlob **/*.integrationTest.js "$@"
# Tests in the extension host # Tests in the extension host
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testWorkspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/singlefolder-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-api-tests/testworkspace.code-workspace --extensionDevelopmentPath=$ROOT/extensions/vscode-api-tests --extensionTestsPath=$ROOT/extensions/vscode-api-tests/out/workspace-tests --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/vscode-colorize-tests/test --extensionDevelopmentPath=$ROOT/extensions/vscode-colorize-tests --extensionTestsPath=$ROOT/extensions/vscode-colorize-tests/out --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/markdown-language-features/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/markdown-language-features --extensionTestsPath=$ROOT/extensions/markdown-language-features/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
mkdir -p $ROOT/extensions/emmet/test-fixtures mkdir -p $ROOT/extensions/emmet/test-fixtures
"$INTEGRATION_TEST_ELECTRON_PATH" $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR "$INTEGRATION_TEST_ELECTRON_PATH" $LINUX_NO_SANDBOX $ROOT/extensions/emmet/test-fixtures --extensionDevelopmentPath=$ROOT/extensions/emmet --extensionTestsPath=$ROOT/extensions/emmet/out/test --disable-telemetry --disable-crash-reporter --disable-updates --disable-extensions --skip-getting-started --disable-inspect --user-data-dir=$VSCODEUSERDATADIR
rm -rf $ROOT/extensions/emmet/test-fixtures rm -rf $ROOT/extensions/emmet/test-fixtures
# Remote Integration Tests # Remote Integration Tests
......
...@@ -21,6 +21,7 @@ process.on('SIGPIPE', () => { ...@@ -21,6 +21,7 @@ process.on('SIGPIPE', () => {
//#endregion //#endregion
//#region Add support for redirecting the loading of node modules //#region Add support for redirecting the loading of node modules
exports.injectNodeModuleLookupPath = function (injectPath) { exports.injectNodeModuleLookupPath = function (injectPath) {
if (!injectPath) { if (!injectPath) {
throw new Error('Missing injectPath'); throw new Error('Missing injectPath');
...@@ -36,10 +37,8 @@ exports.injectNodeModuleLookupPath = function (injectPath) { ...@@ -36,10 +37,8 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
const originalResolveLookupPaths = Module._resolveLookupPaths; const originalResolveLookupPaths = Module._resolveLookupPaths;
// @ts-ignore // @ts-ignore
Module._resolveLookupPaths = function (moduleName, parent, newReturn) { Module._resolveLookupPaths = function (moduleName, parent) {
const result = originalResolveLookupPaths(moduleName, parent, newReturn); const paths = originalResolveLookupPaths(moduleName, parent);
const paths = newReturn ? result : result[1];
for (let i = 0, len = paths.length; i < len; i++) { for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === nodeModulesPath) { if (paths[i] === nodeModulesPath) {
paths.splice(i, 0, injectPath); paths.splice(i, 0, injectPath);
...@@ -47,7 +46,7 @@ exports.injectNodeModuleLookupPath = function (injectPath) { ...@@ -47,7 +46,7 @@ exports.injectNodeModuleLookupPath = function (injectPath) {
} }
} }
return result; return paths;
}; };
}; };
//#endregion //#endregion
...@@ -71,11 +70,10 @@ exports.enableASARSupport = function (nodeModulesPath) { ...@@ -71,11 +70,10 @@ exports.enableASARSupport = function (nodeModulesPath) {
// @ts-ignore // @ts-ignore
const originalResolveLookupPaths = Module._resolveLookupPaths; const originalResolveLookupPaths = Module._resolveLookupPaths;
// @ts-ignore
Module._resolveLookupPaths = function (request, parent, newReturn) {
const result = originalResolveLookupPaths(request, parent, newReturn);
const paths = newReturn ? result : result[1]; // @ts-ignore
Module._resolveLookupPaths = function (request, parent) {
const paths = originalResolveLookupPaths(request, parent);
for (let i = 0, len = paths.length; i < len; i++) { for (let i = 0, len = paths.length; i < len; i++) {
if (paths[i] === NODE_MODULES_PATH) { if (paths[i] === NODE_MODULES_PATH) {
paths.splice(i, 0, NODE_MODULES_ASAR_PATH); paths.splice(i, 0, NODE_MODULES_ASAR_PATH);
...@@ -83,7 +81,7 @@ exports.enableASARSupport = function (nodeModulesPath) { ...@@ -83,7 +81,7 @@ exports.enableASARSupport = function (nodeModulesPath) {
} }
} }
return result; return paths;
}; };
}; };
//#endregion //#endregion
......
...@@ -17,7 +17,7 @@ const paths = require('./paths'); ...@@ -17,7 +17,7 @@ const paths = require('./paths');
// @ts-ignore // @ts-ignore
const product = require('../product.json'); const product = require('../product.json');
// @ts-ignore // @ts-ignore
const app = require('electron').app; const { app, protocol } = require('electron');
// Enable portable support // Enable portable support
const portable = bootstrap.configurePortable(); const portable = bootstrap.configurePortable();
...@@ -33,6 +33,11 @@ app.setPath('userData', userDataPath); ...@@ -33,6 +33,11 @@ app.setPath('userData', userDataPath);
// Update cwd based on environment and platform // Update cwd based on environment and platform
setCurrentWorkingDirectory(); setCurrentWorkingDirectory();
// Register custom schemes with privileges
protocol.registerSchemesAsPrivileged([
{ scheme: 'vscode-resource', privileges: { secure: true, supportFetchAPI: true, corsEnabled: true } }
]);
// Global app listeners // Global app listeners
registerListeners(); registerListeners();
......
此差异已折叠。
...@@ -3,11 +3,11 @@ ...@@ -3,11 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information. * Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import { Menu, MenuItem, BrowserWindow, Event, ipcMain } from 'electron'; import { Menu, MenuItem, BrowserWindow, ipcMain } from 'electron';
import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu'; import { ISerializableContextMenuItem, CONTEXT_MENU_CLOSE_CHANNEL, CONTEXT_MENU_CHANNEL, IPopupOptions } from 'vs/base/parts/contextmenu/common/contextmenu';
export function registerContextMenuListener(): void { export function registerContextMenuListener(): void {
ipcMain.on(CONTEXT_MENU_CHANNEL, (event: Event, contextMenuId: number, items: ISerializableContextMenuItem[], onClickChannel: string, options?: IPopupOptions) => { ipcMain.on(CONTEXT_MENU_CHANNEL, (event: Electron.IpcMainEvent, contextMenuId: number, items: ISerializableContextMenuItem[], onClickChannel: string, options?: IPopupOptions) => {
const menu = createMenu(event, onClickChannel, items); const menu = createMenu(event, onClickChannel, items);
menu.popup({ menu.popup({
...@@ -27,7 +27,7 @@ export function registerContextMenuListener(): void { ...@@ -27,7 +27,7 @@ export function registerContextMenuListener(): void {
}); });
} }
function createMenu(event: Event, onClickChannel: string, items: ISerializableContextMenuItem[]): Menu { function createMenu(event: Electron.IpcMainEvent, onClickChannel: string, items: ISerializableContextMenuItem[]): Menu {
const menu = new Menu(); const menu = new Menu();
items.forEach(item => { items.forEach(item => {
......
...@@ -258,7 +258,7 @@ export class CodeApplication extends Disposable { ...@@ -258,7 +258,7 @@ export class CodeApplication extends Disposable {
this.lifecycleService.kill(code); this.lifecycleService.kill(code);
}); });
ipc.on('vscode:fetchShellEnv', async (event: Event) => { ipc.on('vscode:fetchShellEnv', async (event: Electron.IpcMainEvent) => {
const webContents = event.sender; const webContents = event.sender;
try { try {
...@@ -275,10 +275,10 @@ export class CodeApplication extends Disposable { ...@@ -275,10 +275,10 @@ export class CodeApplication extends Disposable {
} }
}); });
ipc.on('vscode:toggleDevTools', (event: Event) => event.sender.toggleDevTools()); ipc.on('vscode:toggleDevTools', (event: Electron.IpcMainEvent) => event.sender.toggleDevTools());
ipc.on('vscode:openDevTools', (event: Event) => event.sender.openDevTools()); ipc.on('vscode:openDevTools', (event: Electron.IpcMainEvent) => event.sender.openDevTools());
ipc.on('vscode:reloadWindow', (event: Event) => event.sender.reload()); ipc.on('vscode:reloadWindow', (event: Electron.IpcMainEvent) => event.sender.reload());
// Some listeners after window opened // Some listeners after window opened
(async () => { (async () => {
......
...@@ -36,9 +36,8 @@ export class SharedProcess implements ISharedProcess { ...@@ -36,9 +36,8 @@ export class SharedProcess implements ISharedProcess {
backgroundColor: this.themeMainService.getBackgroundColor(), backgroundColor: this.themeMainService.getBackgroundColor(),
webPreferences: { webPreferences: {
images: false, images: false,
webaudio: false,
webgl: false,
nodeIntegration: true, nodeIntegration: true,
webgl: false,
disableBlinkFeatures: 'Auxclick' // do NOT change, allows us to identify this window as shared-process in the process explorer disableBlinkFeatures: 'Auxclick' // do NOT change, allows us to identify this window as shared-process in the process explorer
} }
}); });
......
...@@ -1955,24 +1955,21 @@ class Dialogs { ...@@ -1955,24 +1955,21 @@ class Dialogs {
} }
showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): Promise<IMessageBoxResult> { showMessageBox(options: Electron.MessageBoxOptions, window?: ICodeWindow): Promise<IMessageBoxResult> {
return this.getDialogQueue(window).queue(() => { return this.getDialogQueue(window).queue(async () => {
return new Promise(resolve => { let result: Electron.MessageBoxReturnValue;
const callback = (response: number, checkboxChecked: boolean) => { if (window) {
resolve({ button: response, checkboxChecked }); result = await dialog.showMessageBox(window.win, options);
}; } else {
result = await dialog.showMessageBox(options);
}
if (window) { return { button: result.response, checkboxChecked: result.checkboxChecked };
dialog.showMessageBox(window.win, options, callback);
} else {
dialog.showMessageBox(options, callback);
}
});
}); });
} }
showSaveDialog(options: Electron.SaveDialogOptions, window?: ICodeWindow): Promise<string> { showSaveDialog(options: Electron.SaveDialogOptions, window?: ICodeWindow): Promise<string> {
function normalizePath(path: string): string { function normalizePath(path: string | undefined): string | undefined {
if (path && isMacintosh) { if (path && isMacintosh) {
path = normalizeNFC(path); // normalize paths returned from the OS path = normalizeNFC(path); // normalize paths returned from the OS
} }
...@@ -1980,24 +1977,21 @@ class Dialogs { ...@@ -1980,24 +1977,21 @@ class Dialogs {
return path; return path;
} }
return this.getDialogQueue(window).queue(() => { return this.getDialogQueue(window).queue(async () => {
return new Promise(resolve => { let result: Electron.SaveDialogReturnValue;
const callback = (path: string) => { if (window) {
resolve(normalizePath(path)); result = await dialog.showSaveDialog(window.win, options);
}; } else {
result = await dialog.showSaveDialog(options);
}
if (window) { return normalizePath(result.filePath);
dialog.showSaveDialog(window.win, options, callback);
} else {
dialog.showSaveDialog(options, callback);
}
});
}); });
} }
showOpenDialog(options: Electron.OpenDialogOptions, window?: ICodeWindow): Promise<string[]> { showOpenDialog(options: Electron.OpenDialogOptions, window?: ICodeWindow): Promise<string[]> {
function normalizePaths(paths: string[]): string[] { function normalizePaths(paths: string[] | undefined): string[] | undefined {
if (paths && paths.length > 0 && isMacintosh) { if (paths && paths.length > 0 && isMacintosh) {
paths = paths.map(path => normalizeNFC(path)); // normalize paths returned from the OS paths = paths.map(path => normalizeNFC(path)); // normalize paths returned from the OS
} }
...@@ -2005,32 +1999,25 @@ class Dialogs { ...@@ -2005,32 +1999,25 @@ class Dialogs {
return paths; return paths;
} }
return this.getDialogQueue(window).queue(() => { return this.getDialogQueue(window).queue(async () => {
return new Promise(resolve => {
// Ensure the path exists (if provided) // Ensure the path exists (if provided)
let validatePathPromise: Promise<void> = Promise.resolve(); if (options.defaultPath) {
if (options.defaultPath) { const pathExists = await exists(options.defaultPath);
validatePathPromise = exists(options.defaultPath).then(exists => { if (!pathExists) {
if (!exists) { options.defaultPath = undefined;
options.defaultPath = undefined;
}
});
} }
}
// Show dialog and wrap as promise // Show dialog
validatePathPromise.then(() => { let result: Electron.OpenDialogReturnValue;
const callback = (paths: string[]) => { if (window) {
resolve(normalizePaths(paths)); result = await dialog.showOpenDialog(window.win, options);
}; } else {
result = await dialog.showOpenDialog(options);
}
if (window) { return normalizePaths(result.filePaths);
dialog.showOpenDialog(window.win, options, callback);
} else {
dialog.showOpenDialog(options, callback);
}
});
});
}); });
} }
} }
......
...@@ -7,7 +7,7 @@ import { localize } from 'vs/nls'; ...@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
import * as objects from 'vs/base/common/objects'; import * as objects from 'vs/base/common/objects';
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv'; import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
import { IIssueService, IssueReporterData, IssueReporterFeatures, ProcessExplorerData } from 'vs/platform/issue/node/issue'; import { IIssueService, IssueReporterData, IssueReporterFeatures, ProcessExplorerData } from 'vs/platform/issue/node/issue';
import { BrowserWindow, ipcMain, screen, Event, dialog } from 'electron'; import { BrowserWindow, ipcMain, screen, dialog } from 'electron';
import { ILaunchService } from 'vs/platform/launch/electron-main/launchService'; import { ILaunchService } from 'vs/platform/launch/electron-main/launchService';
import { PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics'; import { PerformanceInfo, isRemoteDiagnosticError } from 'vs/platform/diagnostics/common/diagnostics';
import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService'; import { IDiagnosticsService } from 'vs/platform/diagnostics/node/diagnosticsService';
...@@ -40,7 +40,7 @@ export class IssueService implements IIssueService { ...@@ -40,7 +40,7 @@ export class IssueService implements IIssueService {
} }
private registerListeners(): void { private registerListeners(): void {
ipcMain.on('vscode:issueSystemInfoRequest', async (event: Event) => { ipcMain.on('vscode:issueSystemInfoRequest', async (event: Electron.IpcMainEvent) => {
Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })]) Promise.all([this.launchService.getMainProcessInfo(), this.launchService.getRemoteDiagnostics({ includeProcesses: false, includeWorkspaceMetadata: false })])
.then(result => { .then(result => {
const [info, remoteData] = result; const [info, remoteData] = result;
...@@ -50,7 +50,7 @@ export class IssueService implements IIssueService { ...@@ -50,7 +50,7 @@ export class IssueService implements IIssueService {
}); });
}); });
ipcMain.on('vscode:listProcesses', async (event: Event) => { ipcMain.on('vscode:listProcesses', async (event: Electron.IpcMainEvent) => {
const processes = []; const processes = [];
try { try {
...@@ -79,7 +79,7 @@ export class IssueService implements IIssueService { ...@@ -79,7 +79,7 @@ export class IssueService implements IIssueService {
event.sender.send('vscode:listProcessesResponse', processes); event.sender.send('vscode:listProcessesResponse', processes);
}); });
ipcMain.on('vscode:issueReporterClipboard', (event: Event) => { ipcMain.on('vscode:issueReporterClipboard', (event: Electron.IpcMainEvent) => {
const messageOptions = { const messageOptions = {
message: localize('issueReporterWriteToClipboard', "There is too much data to send to GitHub. Would you like to write the information to the clipboard so that it can be pasted?"), message: localize('issueReporterWriteToClipboard', "There is too much data to send to GitHub. Would you like to write the information to the clipboard so that it can be pasted?"),
type: 'warning', type: 'warning',
...@@ -90,13 +90,14 @@ export class IssueService implements IIssueService { ...@@ -90,13 +90,14 @@ export class IssueService implements IIssueService {
}; };
if (this._issueWindow) { if (this._issueWindow) {
dialog.showMessageBox(this._issueWindow, messageOptions, response => { dialog.showMessageBox(this._issueWindow, messageOptions)
event.sender.send('vscode:issueReporterClipboardResponse', response === 0); .then(result => {
}); event.sender.send('vscode:issueReporterClipboardResponse', result.response === 0);
});
} }
}); });
ipcMain.on('vscode:issuePerformanceInfoRequest', (event: Event) => { ipcMain.on('vscode:issuePerformanceInfoRequest', (event: Electron.IpcMainEvent) => {
this.getPerformanceInfo().then(msg => { this.getPerformanceInfo().then(msg => {
event.sender.send('vscode:issuePerformanceInfoResponse', msg); event.sender.send('vscode:issuePerformanceInfoResponse', msg);
}); });
...@@ -113,14 +114,15 @@ export class IssueService implements IIssueService { ...@@ -113,14 +114,15 @@ export class IssueService implements IIssueService {
}; };
if (this._issueWindow) { if (this._issueWindow) {
dialog.showMessageBox(this._issueWindow, messageOptions, (response) => { dialog.showMessageBox(this._issueWindow, messageOptions)
if (response === 0) { .then(result => {
if (this._issueWindow) { if (result.response === 0) {
this._issueWindow.destroy(); if (this._issueWindow) {
this._issueWindow = null; this._issueWindow.destroy();
this._issueWindow = null;
}
} }
} });
});
} }
}); });
...@@ -148,13 +150,13 @@ export class IssueService implements IIssueService { ...@@ -148,13 +150,13 @@ export class IssueService implements IIssueService {
this.windowsService.openExternal(arg); this.windowsService.openExternal(arg);
}); });
ipcMain.on('vscode:closeIssueReporter', (event: Event) => { ipcMain.on('vscode:closeIssueReporter', (event: Electron.IpcMainEvent) => {
if (this._issueWindow) { if (this._issueWindow) {
this._issueWindow.close(); this._issueWindow.close();
} }
}); });
ipcMain.on('windowsInfoRequest', (event: Event) => { ipcMain.on('windowsInfoRequest', (event: Electron.IpcMainEvent) => {
this.launchService.getMainProcessInfo().then(info => { this.launchService.getMainProcessInfo().then(info => {
event.sender.send('vscode:windowsInfoResponse', info.windows); event.sender.send('vscode:windowsInfoResponse', info.windows);
}); });
...@@ -178,7 +180,10 @@ export class IssueService implements IIssueService { ...@@ -178,7 +180,10 @@ export class IssueService implements IIssueService {
x: position.x, x: position.x,
y: position.y, y: position.y,
title: localize('issueReporter', "Issue Reporter"), title: localize('issueReporter', "Issue Reporter"),
backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR backgroundColor: data.styles.backgroundColor || DEFAULT_BACKGROUND_COLOR,
webPreferences: {
nodeIntegration: true
}
}); });
this._issueWindow.setMenuBarVisibility(false); // workaround for now, until a menu is implemented this._issueWindow.setMenuBarVisibility(false); // workaround for now, until a menu is implemented
...@@ -224,7 +229,10 @@ export class IssueService implements IIssueService { ...@@ -224,7 +229,10 @@ export class IssueService implements IIssueService {
x: position.x, x: position.x,
y: position.y, y: position.y,
backgroundColor: data.styles.backgroundColor, backgroundColor: data.styles.backgroundColor,
title: localize('processExplorer', "Process Explorer") title: localize('processExplorer', "Process Explorer"),
webPreferences: {
nodeIntegration: true
}
}); });
this._processExplorerWindow.setMenuBarVisibility(false); this._processExplorerWindow.setMenuBarVisibility(false);
......
...@@ -359,7 +359,7 @@ export class Menubar { ...@@ -359,7 +359,7 @@ export class Menubar {
const servicesMenu = new Menu(); const servicesMenu = new Menu();
const services = new MenuItem({ label: nls.localize('mServices', "Services"), role: 'services', submenu: servicesMenu }); const services = new MenuItem({ label: nls.localize('mServices', "Services"), role: 'services', submenu: servicesMenu });
const hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", product.nameLong), role: 'hide', accelerator: 'Command+H' }); const hide = new MenuItem({ label: nls.localize('mHide', "Hide {0}", product.nameLong), role: 'hide', accelerator: 'Command+H' });
const hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideothers', accelerator: 'Command+Alt+H' }); const hideOthers = new MenuItem({ label: nls.localize('mHideOthers', "Hide Others"), role: 'hideOthers', accelerator: 'Command+Alt+H' });
const showAll = new MenuItem({ label: nls.localize('mShowAll', "Show All"), role: 'unhide' }); const showAll = new MenuItem({ label: nls.localize('mShowAll', "Show All"), role: 'unhide' });
const quit = new MenuItem(this.likeAction('workbench.action.quit', { const quit = new MenuItem(this.likeAction('workbench.action.quit', {
label: nls.localize('miQuit', "Quit {0}", product.nameLong), click: () => { label: nls.localize('miQuit', "Quit {0}", product.nameLong), click: () => {
...@@ -494,7 +494,7 @@ export class Menubar { ...@@ -494,7 +494,7 @@ export class Menubar {
}, false)); }, false));
} }
private isOptionClick(event: Electron.Event): boolean { private isOptionClick(event: Electron.KeyboardEvent): boolean {
return !!(event && ((!isMacintosh && (event.ctrlKey || event.shiftKey)) || (isMacintosh && (event.metaKey || event.altKey)))); return !!(event && ((!isMacintosh && (event.ctrlKey || event.shiftKey)) || (isMacintosh && (event.metaKey || event.altKey))));
} }
...@@ -588,7 +588,7 @@ export class Menubar { ...@@ -588,7 +588,7 @@ export class Menubar {
} }
} }
private static _menuItemIsTriggeredViaKeybinding(event: Electron.Event, userSettingsLabel: string): boolean { private static _menuItemIsTriggeredViaKeybinding(event: Electron.KeyboardEvent, userSettingsLabel: string): boolean {
// The event coming in from Electron will inform us only about the modifier keys pressed. // The event coming in from Electron will inform us only about the modifier keys pressed.
// The strategy here is to check if the modifier keys match those of the keybinding, // The strategy here is to check if the modifier keys match those of the keybinding,
// since it is highly unlikely to use modifier keys when clicking with the mouse // since it is highly unlikely to use modifier keys when clicking with the mouse
......
...@@ -13,15 +13,6 @@ ...@@ -13,15 +13,6 @@
return; return;
} }
hasRegistered = true; hasRegistered = true;
// @ts-ignore
require('electron').webFrame.registerURLSchemeAsPrivileged('vscode-resource', {
secure: true,
bypassCSP: false,
allowServiceWorkers: false,
supportFetchAPI: true,
corsEnabled: true
});
}; };
}()); }());
......
...@@ -9,7 +9,7 @@ const { join } = require('path'); ...@@ -9,7 +9,7 @@ const { join } = require('path');
const path = require('path'); const path = require('path');
const mocha = require('mocha'); const mocha = require('mocha');
const events = require('events'); const events = require('events');
const MochaJUnitReporter = require('mocha-junit-reporter'); // const MochaJUnitReporter = require('mocha-junit-reporter');
const url = require('url'); const url = require('url');
const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec'; const defaultReporterName = process.platform === 'win32' ? 'list' : 'spec';
...@@ -133,12 +133,13 @@ app.on('ready', () => { ...@@ -133,12 +133,13 @@ app.on('ready', () => {
if (argv.tfs) { if (argv.tfs) {
new mocha.reporters.Spec(runner); new mocha.reporters.Spec(runner);
new MochaJUnitReporter(runner, { // TODO@deepak the mocha Junit reporter seems to cause a hang when running with Electron 6 inside docker container
reporterOptions: { // new MochaJUnitReporter(runner, {
testsuitesTitle: `${argv.tfs} ${process.platform}`, // reporterOptions: {
mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${argv.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined // testsuitesTitle: `${argv.tfs} ${process.platform}`,
} // mochaFile: process.env.BUILD_ARTIFACTSTAGINGDIRECTORY ? path.join(process.env.BUILD_ARTIFACTSTAGINGDIRECTORY, `test-results/${process.platform}-${argv.tfs.toLowerCase().replace(/[^\w]/g, '-')}-results.xml`) : undefined
}); // }
// });
} else { } else {
const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter); const reporterPath = path.join(path.dirname(require.resolve('mocha')), 'lib', 'reporters', argv.reporter);
let Reporter; let Reporter;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册