Skip to content

Commit df5b5ce

Browse files
author
Benjamin Pasero
committed
debt - port over some electron6 changes
1 parent d50852d commit df5b5ce

9 files changed

Lines changed: 36 additions & 10 deletions

File tree

build/builtin/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const path = require('path');
1010
let window = null;
1111

1212
app.once('ready', () => {
13-
window = new BrowserWindow({ width: 800, height: 600 });
13+
window = new BrowserWindow({ width: 800, height: 600, webPreferences: { nodeIntegration: true, webviewTag: true } });
1414
window.setMenuBarVisibility(false);
1515
window.loadURL(url.format({ pathname: path.join(__dirname, 'index.html'), protocol: 'file:', slashes: true }));
1616
// window.webContents.openDevTools();

src/vs/base/parts/quickopen/test/common/quickOpenScorer.test.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,27 @@ suite('Quick Open Scorer', () => {
515515

516516
let query = 'vscode';
517517

518-
let res = [resourceA, resourceB].sort((r1, r2) => compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => -1));
518+
let res = [resourceA, resourceB].sort((r1, r2) => {
519+
return compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => {
520+
if (r1 as any /* TS fail */ === resourceA) {
521+
return -1;
522+
}
523+
524+
return 1;
525+
});
526+
});
519527
assert.equal(res[0], resourceA);
520528
assert.equal(res[1], resourceB);
521529

522-
res = [resourceB, resourceA].sort((r1, r2) => compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => -1));
530+
res = [resourceB, resourceA].sort((r1, r2) => {
531+
return compareItemsByScore(r1, r2, query, true, ResourceAccessor, cache, (r1, r2, query, ResourceAccessor) => {
532+
if (r1 as any /* TS fail */ === resourceB) {
533+
return -1;
534+
}
535+
536+
return 1;
537+
});
538+
});
523539
assert.equal(res[0], resourceB);
524540
assert.equal(res[1], resourceA);
525541
});

src/vs/code/electron-main/auth.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ export class ProxyAuthHandler {
5454
width: 450,
5555
height: 220,
5656
show: true,
57-
title: 'VS Code'
57+
title: 'VS Code',
58+
webPreferences: {
59+
nodeIntegration: true,
60+
webviewTag: true
61+
}
5862
};
5963

6064
const focusedWindow = this.windowsMainService.getFocusedWindow();

src/vs/code/electron-main/sharedProcess.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class SharedProcess implements ISharedProcess {
3838
images: false,
3939
webaudio: false,
4040
webgl: false,
41+
nodeIntegration: true,
4142
disableBlinkFeatures: 'Auxclick' // do NOT change, allows us to identify this window as shared-process in the process explorer
4243
}
4344
});

src/vs/code/electron-main/window.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ export class CodeWindow extends Disposable implements ICodeWindow {
134134
// want to enforce that Code stays in the foreground. This triggers a disable_hidden_
135135
// flag that Electron provides via patch:
136136
// https://github.com/electron/libchromiumcontent/blob/master/patches/common/chromium/disable_hidden.patch
137-
backgroundThrottling: false
137+
backgroundThrottling: false,
138+
nodeIntegration: true,
139+
webviewTag: true
138140
}
139141
};
140142

src/vs/platform/clipboard/electron-browser/clipboardService.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export class ClipboardService implements IClipboardService {
1414

1515
_serviceBrand: any;
1616

17-
writeText(text: string, type?: string): void {
17+
writeText(text: string, type?: 'selection' | 'clipboard'): void {
1818
clipboard.writeText(text, type);
1919
}
2020

21-
readText(type?: string): string {
21+
readText(type?: 'selection' | 'clipboard'): string {
2222
return clipboard.readText(type);
2323
}
2424

src/vs/platform/windows/electron-main/windowsService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,8 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
352352
async openExternal(url: string): Promise<boolean> {
353353
this.logService.trace('windowsService#openExternal');
354354

355-
return shell.openExternal(url);
355+
shell.openExternal(url);
356+
return true;
356357
}
357358

358359
async startCrashReporter(config: Electron.CrashReporterStartOptions): Promise<void> {

src/vs/workbench/test/electron-browser/api/extHostConfiguration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ suite('ExtHostConfiguration', function () {
138138

139139
testObject = all.getConfiguration('workbench');
140140
actual = testObject.get('colorCustomizations')!;
141-
delete actual['statusBar.foreground'];
141+
actual['statusBar.foreground'] = undefined;
142142
assert.equal(actual['statusBar.foreground'], undefined);
143143
testObject = all.getConfiguration('workbench');
144144
actual = testObject.get('colorCustomizations')!;

test/electron/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ app.on('ready', () => {
113113
show: false,
114114
webPreferences: {
115115
backgroundThrottling: false,
116-
webSecurity: false
116+
nodeIntegration: true,
117+
webSecurity: false,
118+
webviewTag: true
117119
}
118120
});
119121

0 commit comments

Comments
 (0)