diff --git a/build/builtin/main.js b/build/builtin/main.js index 849027ad2b9..b094a67cac5 100644 --- a/build/builtin/main.js +++ b/build/builtin/main.js @@ -10,7 +10,7 @@ const path = require('path'); let window = null; app.once('ready', () => { - window = new BrowserWindow({ width: 800, height: 600 }); + window = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true, webviewTag: true } }); window.setMenuBarVisibility(false); window.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true })); // window.webContents.openDevTools(); diff --git a/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts b/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts index 47c51b87902..548cc9489f0 100644 --- a/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts +++ b/src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts @@ -515,11 +515,27 @@ suite('Quick Open Scorer', () => { let query = 'vscode'; - let res = [resourceA, resourceB].sort((r1, r2) => compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => -1)); + let res = [resourceA, resourceB].sort((r1, r2) => { + return compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => { + if (r1 as any /* TS fail */ === resourceA) { + return -1; + } + + return 1; + }); + }); assert.equal(res[0], resourceA); assert.equal(res[1], resourceB); - res = [resourceB, resourceA].sort((r1, r2) => compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => -1)); + res = [resourceB, resourceA].sort((r1, r2) => { + return compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => { + if (r1 as any /* TS fail */ === resourceB) { + return -1; + } + + return 1; + }); + }); assert.equal(res[0], resourceB); assert.equal(res[1], resourceA); }); diff --git a/src/vs/code/electron-main/auth.ts b/src/vs/code/electron-main/auth.ts index ed92533c32f..6fbd3fcce46 100644 --- a/src/vs/code/electron-main/auth.ts +++ b/src/vs/code/electron-main/auth.ts @@ -54,7 +54,11 @@ export class ProxyAuthHandler { width: 450, height: 220, show: true, - title: 'VS Code' + title: 'VS Code', + webPreferences: { + nodeIntegration: true, + webviewTag: true + } }; const focusedWindow = this.windowsMainService.getFocusedWindow(); diff --git a/src/vs/code/electron-main/sharedProcess.ts b/src/vs/code/electron-main/sharedProcess.ts index 70b6ec75768..60926b0d146 100644 --- a/src/vs/code/electron-main/sharedProcess.ts +++ b/src/vs/code/electron-main/sharedProcess.ts @@ -38,6 +38,7 @@ export class SharedProcess implements ISharedProcess { images: false, webaudio: false, webgl: false, + nodeIntegration: true, disableBlinkFeatures: 'Auxclick' // do NOT change, allows us to identify this window as shared-process in the process explorer } }); diff --git a/src/vs/code/electron-main/window.ts b/src/vs/code/electron-main/window.ts index 3889550305b..d031b8b673f 100644 --- a/src/vs/code/electron-main/window.ts +++ b/src/vs/code/electron-main/window.ts @@ -134,7 +134,9 @@ export class CodeWindow extends Disposable implements ICodeWindow { // want to enforce that Code stays in the foreground. This triggers a disable_hidden_ // flag that Electron provides via patch: // https://github.com/electron/libchromiumcontent/blob/master/patches/common/chromium/disable_hidden.patch - backgroundThrottling: false + backgroundThrottling: false, + nodeIntegration: true, + webviewTag: true } }; diff --git a/src/vs/platform/clipboard/electron-browser/clipboardService.ts b/src/vs/platform/clipboard/electron-browser/clipboardService.ts index 9952574fb54..0fa18f71ce7 100644 --- a/src/vs/platform/clipboard/electron-browser/clipboardService.ts +++ b/src/vs/platform/clipboard/electron-browser/clipboardService.ts @@ -14,11 +14,11 @@ export class ClipboardService implements IClipboardService { _serviceBrand: any; - writeText(text: string, type?: string): void { + writeText(text: string, type?: 'selection' | 'clipboard'): void { clipboard.writeText(text, type); } - readText(type?: string): string { + readText(type?: 'selection' | 'clipboard'): string { return clipboard.readText(type); } diff --git a/src/vs/platform/windows/electron-main/windowsService.ts b/src/vs/platform/windows/electron-main/windowsService.ts index b4851c55d0c..4722e6c8e9b 100644 --- a/src/vs/platform/windows/electron-main/windowsService.ts +++ b/src/vs/platform/windows/electron-main/windowsService.ts @@ -352,7 +352,8 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH async openExternal(url: string): Promise { this.logService.trace('windowsService#openExternal'); - return shell.openExternal(url); + shell.openExternal(url); + return true; } async startCrashReporter(config: Electron.CrashReporterStartOptions): Promise { diff --git a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts index 16a5eef9fc9..2a963f3a3ab 100644 --- a/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts +++ b/src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts @@ -138,7 +138,7 @@ suite('ExtHostConfiguration', function () { testObject = all.getConfiguration('workbench'); actual = testObject.get('colorCustomizations')!; - delete actual['statusBar.foreground']; + actual['statusBar.foreground'] = undefined; assert.equal(actual['statusBar.foreground'], undefined); testObject = all.getConfiguration('workbench'); actual = testObject.get('colorCustomizations')!; diff --git a/test/electron/index.js b/test/electron/index.js index b0d82f6d1bd..1d9ef60b846 100644 --- a/test/electron/index.js +++ b/test/electron/index.js @@ -113,7 +113,9 @@ app.on('ready', () => { show: false, webPreferences: { backgroundThrottling: false, - webSecurity: false + nodeIntegration: true, + webSecurity: false, + webviewTag: true } });