Skip to content

Commit

Permalink
debt - further reduce electron-browser layer (microsoft#178504)
Browse files Browse the repository at this point in the history
* debt - move more tests out of `electron-browser`

* move more tests

* move preload script as well

* fix
  • Loading branch information
bpasero authored Mar 28, 2023
1 parent de3b0db commit b0b6933
Show file tree
Hide file tree
Showing 39 changed files with 361 additions and 2,619 deletions.
4 changes: 2 additions & 2 deletions build/gulpfile.vscode.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const vscodeResources = [
'out-build/vs/base/common/performance.js',
'out-build/vs/base/node/{stdForkStart.js,terminateProcess.sh,cpuUsage.sh,ps.sh}',
'out-build/vs/base/browser/ui/codicons/codicon/**',
'out-build/vs/base/parts/sandbox/electron-browser/preload.js',
'out-build/vs/base/parts/sandbox/electron-sandbox/preload.js',
'out-build/vs/workbench/browser/media/*-theme.css',
'out-build/vs/workbench/contrib/debug/**/*.json',
'out-build/vs/workbench/contrib/externalTerminal/**/*.scpt',
Expand Down Expand Up @@ -199,7 +199,7 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
const out = sourceFolderName;

const checksums = computeChecksums(out, [
'vs/base/parts/sandbox/electron-browser/preload.js',
'vs/base/parts/sandbox/electron-sandbox/preload.js',
'vs/workbench/workbench.desktop.main.js',
'vs/workbench/workbench.desktop.main.css',
'vs/workbench/api/node/extensionHostProcess.js',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,15 @@
// #######################################################################

/**
* @type {import('../electron-sandbox/globals')}
* @type {import('./globals')}
*/
const globals = {

/**
* A minimal set of methods exposed from Electron's `ipcRenderer`
* to support communication to main process.
*
* @typedef {import('../electron-sandbox/electronTypes').IpcRenderer} IpcRenderer
* @typedef {import('./electronTypes').IpcRenderer} IpcRenderer
* @typedef {import('electron').IpcRendererEvent} IpcRendererEvent
*
* @type {IpcRenderer}
Expand Down Expand Up @@ -194,7 +194,7 @@
},

/**
* @type {import('../electron-sandbox/globals').IpcMessagePort}
* @type {import('./globals').IpcMessagePort}
*/
ipcMessagePort: {

Expand Down Expand Up @@ -224,7 +224,7 @@
/**
* Support for subset of methods of Electron's `webFrame` type.
*
* @type {import('../electron-sandbox/electronTypes').WebFrame}
* @type {import('./electronTypes').WebFrame}
*/
webFrame: {

Expand All @@ -244,7 +244,7 @@
* Note: when `sandbox` is enabled, the only properties available
* are https://github.com/electron/electron/blob/master/docs/api/process.md#sandbox
*
* @typedef {import('../electron-sandbox/globals').ISandboxNodeProcess} ISandboxNodeProcess
* @typedef {import('./globals').ISandboxNodeProcess} ISandboxNodeProcess
*
* @type {ISandboxNodeProcess}
*/
Expand Down Expand Up @@ -293,7 +293,7 @@
/**
* Some information about the context we are running in.
*
* @type {import('../electron-sandbox/globals').ISandboxContext}
* @type {import('./globals').ISandboxContext}
*/
context: {

Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/test/common/labels.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ suite('Labels', () => {
assert.deepStrictEqual(labels.shorten(['a', 'a\\b', 'a\\b\\c', 'd\\b\\c', 'd\\b']), ['a', 'a\\b', 'a\\b\\c', 'd\\b\\c', 'd\\b']);
assert.deepStrictEqual(labels.shorten(['a', 'a\\b', 'b']), ['a', 'a\\b', 'b']);
assert.deepStrictEqual(labels.shorten(['', 'a', 'b', 'b\\c', 'a\\c']), ['.\\', 'a', 'b', 'b\\c', 'a\\c']);
assert.deepStrictEqual(labels.shorten(['src\\vs\\workbench\\parts\\execution\\electron-browser', 'src\\vs\\workbench\\parts\\execution\\electron-browser\\something', 'src\\vs\\workbench\\parts\\terminal\\electron-browser']), ['…\\execution\\electron-browser', '…\\something', '…\\terminal\\…']);
assert.deepStrictEqual(labels.shorten(['src\\vs\\workbench\\parts\\execution\\electron-sandbox', 'src\\vs\\workbench\\parts\\execution\\electron-sandbox\\something', 'src\\vs\\workbench\\parts\\terminal\\electron-sandbox']), ['…\\execution\\electron-sandbox', '…\\something', '…\\terminal\\…']);
});

(isWindows ? test.skip : test)('shorten - not windows', () => {
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/issue/electron-main/issueMainService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export class IssueMainService implements IIssueMainService {
title: options.title,
backgroundColor: options.backgroundColor || IssueMainService.DEFAULT_BACKGROUND_COLOR,
webPreferences: {
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js').fsPath,
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-sandbox/preload.js').fsPath,
additionalArguments: [`--vscode-window-config=${ipcObjectUrl.resource.toString()}`],
v8CacheOptions: this.environmentMainService.useCodeCache ? 'bypassHeatCheck' : 'none',
enableWebSQL: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ export class SharedProcess extends Disposable implements ISharedProcess {
backgroundColor: this.themeMainService.getBackgroundColor(),
title: 'shared-process',
webPreferences: {
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js').fsPath,
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-sandbox/preload.js').fsPath,
additionalArguments: [`--vscode-window-config=${configObjectUrl.resource.toString()}`],
v8CacheOptions: this.environmentMainService.useCodeCache ? 'bypassHeatCheck' : 'none',
nodeIntegration: true,
Expand Down
2 changes: 1 addition & 1 deletion src/vs/platform/windows/electron-main/windowImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
show: !isFullscreenOrMaximized, // reduce flicker by showing later
title: this.productService.nameLong,
webPreferences: {
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-browser/preload.js').fsPath,
preload: FileAccess.asFileUri('vs/base/parts/sandbox/electron-sandbox/preload.js').fsPath,
additionalArguments: [`--vscode-window-config=${this.configObjectUrl.resource.toString()}`],
v8CacheOptions: this.environmentMainService.useCodeCache ? 'bypassHeatCheck' : 'none',
enableWebSQL: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { URI } from 'vs/base/common/uri';
import { join } from 'vs/base/common/path';
import { UTF16le, detectEncodingByBOMFromBuffer, UTF8_with_bom, UTF16be, toCanonicalName } from 'vs/workbench/services/textfile/common/encoding';
import { VSBuffer } from 'vs/base/common/buffer';
import files from 'vs/workbench/services/textfile/test/browser/fixtures/files';
import files from 'vs/workbench/services/textfile/test/common/fixtures/files';
import createSuite from 'vs/workbench/services/textfile/test/common/textFileService.io.test';
import { isWeb } from 'vs/base/common/platform';
import { IWorkingCopyFileService, WorkingCopyFileService } from 'vs/workbench/services/workingCopy/common/workingCopyFileService';
Expand Down
Binary file not shown.

This file was deleted.

Loading

0 comments on commit b0b6933

Please sign in to comment.