refactor: clean up the default app implementation (#14719)
* Disable nodeIntegration * Enable contextIsolation * Re-implement the CSP security check to handle running in contextIsolation * Disable bad DCHECKS for the promise helper * Remove the unused "-d" flag for the electron binary * Added a way to hide the default help output for electron devs who don't want to see it every time
This commit is contained in:
parent
a24307b8e8
commit
32a9df2940
10 changed files with 346 additions and 296 deletions
|
@ -8,28 +8,32 @@ app.on('window-all-closed', () => {
|
|||
app.quit()
|
||||
})
|
||||
|
||||
exports.load = (appUrl) => {
|
||||
app.on('ready', () => {
|
||||
const options = {
|
||||
width: 900,
|
||||
height: 600,
|
||||
autoHideMenuBar: true,
|
||||
backgroundColor: '#FFFFFF',
|
||||
webPreferences: {
|
||||
nodeIntegrationInWorker: true
|
||||
},
|
||||
useContentSize: true,
|
||||
show: false
|
||||
}
|
||||
if (process.platform === 'linux') {
|
||||
options.icon = path.join(__dirname, 'icon.png')
|
||||
}
|
||||
exports.load = async (appUrl) => {
|
||||
await app.whenReady()
|
||||
|
||||
mainWindow = new BrowserWindow(options)
|
||||
const options = {
|
||||
width: 900,
|
||||
height: 600,
|
||||
autoHideMenuBar: true,
|
||||
backgroundColor: '#FFFFFF',
|
||||
webPreferences: {
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
preload: path.resolve(__dirname, 'renderer.js'),
|
||||
webviewTag: false
|
||||
},
|
||||
useContentSize: true,
|
||||
show: false
|
||||
}
|
||||
|
||||
mainWindow.on('ready-to-show', () => mainWindow.show())
|
||||
if (process.platform === 'linux') {
|
||||
options.icon = path.join(__dirname, 'icon.png')
|
||||
}
|
||||
|
||||
mainWindow.loadURL(appUrl)
|
||||
mainWindow.focus()
|
||||
})
|
||||
mainWindow = new BrowserWindow(options)
|
||||
|
||||
mainWindow.on('ready-to-show', () => mainWindow.show())
|
||||
|
||||
mainWindow.loadURL(appUrl)
|
||||
mainWindow.focus()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue