Skip to content

Commit

Permalink
fix: enable nodeIntegration and webviewTag preferences
Browse files Browse the repository at this point in the history
The default values are now flipped
electron/electron#16235
  • Loading branch information
deepak1556 committed Jun 14, 2019
1 parent 49ac885 commit fe8a5e4
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/builtin/main.js
Expand Up @@ -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();
Expand Down
6 changes: 5 additions & 1 deletion src/vs/code/electron-main/auth.ts
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/vs/code/electron-main/sharedProcess.ts
Expand Up @@ -36,7 +36,7 @@ export class SharedProcess implements ISharedProcess {
backgroundColor: this.themeMainService.getBackgroundColor(),
webPreferences: {
images: false,
webaudio: false,
nodeIntegration: true,
webgl: false,
disableBlinkFeatures: 'Auxclick' // do NOT change, allows us to identify this window as shared-process in the process explorer
}
Expand Down
4 changes: 3 additions & 1 deletion src/vs/code/electron-main/window.ts
Expand Up @@ -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
}
};

Expand Down
Expand Up @@ -385,6 +385,7 @@ export class WebviewElement extends Disposable implements Webview {

this._webview = document.createElement('webview');
this._webview.setAttribute('partition', `webview${Date.now()}`);
this._webview.setAttribute('nodeintegration', 'yes');
this._webview.setAttribute('webpreferences', 'contextIsolation=yes');

this._webview.style.flex = '0 1';
Expand Down
4 changes: 3 additions & 1 deletion test/electron/index.js
Expand Up @@ -106,7 +106,9 @@ app.on('ready', () => {
show: false,
webPreferences: {
backgroundThrottling: false,
webSecurity: false
nodeIntegration: true,
webSecurity: false,
webviewTag: true
}
});

Expand Down

0 comments on commit fe8a5e4

Please sign in to comment.