Enable context isolation (#999)
This commit is contained in:
@@ -355,6 +355,7 @@ function handleAppWillFinishLaunching() {
|
|||||||
function handleAppWebContentsCreated(dc, contents) {
|
function handleAppWebContentsCreated(dc, contents) {
|
||||||
contents.on('will-attach-webview', (event, webPreferences) => {
|
contents.on('will-attach-webview', (event, webPreferences) => {
|
||||||
webPreferences.nodeIntegration = false;
|
webPreferences.nodeIntegration = false;
|
||||||
|
webPreferences.contextIsolation = true;
|
||||||
});
|
});
|
||||||
contents.on('will-navigate', (event, navigationUrl) => {
|
contents.on('will-navigate', (event, navigationUrl) => {
|
||||||
const parsedUrl = new URL(navigationUrl);
|
const parsedUrl = new URL(navigationUrl);
|
||||||
|
@@ -45,6 +45,7 @@ function createMainWindow(config, options) {
|
|||||||
fullscreen: false,
|
fullscreen: false,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
webviewTag: true,
|
webviewTag: true,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -71,6 +72,7 @@ function createMainWindow(config, options) {
|
|||||||
|
|
||||||
mainWindow.webContents.on('will-attach-webview', (event, webPreferences) => {
|
mainWindow.webContents.on('will-attach-webview', (event, webPreferences) => {
|
||||||
webPreferences.nodeIntegration = false;
|
webPreferences.nodeIntegration = false;
|
||||||
|
webPreferences.contextIsolation = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
mainWindow.once('ready-to-show', () => {
|
mainWindow.once('ready-to-show', () => {
|
||||||
|
Reference in New Issue
Block a user