debt - port over some electron6 changes

This commit is contained in:
Benjamin Pasero 2019-07-08 08:43:11 +02:00
parent d50852db1a
commit df5b5cecfe
9 changed files with 36 additions and 10 deletions

View file

@ -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();

View file

@ -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);
});

View file

@ -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();

View file

@ -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
}
});

View file

@ -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
}
};

View file

@ -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);
}

View file

@ -352,7 +352,8 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
async openExternal(url: string): Promise<boolean> {
this.logService.trace('windowsService#openExternal');
return shell.openExternal(url);
shell.openExternal(url);
return true;
}
async startCrashReporter(config: Electron.CrashReporterStartOptions): Promise<void> {

View file

@ -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')!;

View file

@ -113,7 +113,9 @@ app.on('ready', () => {
show: false,
webPreferences: {
backgroundThrottling: false,
webSecurity: false
nodeIntegration: true,
webSecurity: false,
webviewTag: true
}
});