feat: Add option to conditionally disable site instance patches (#18396)
* chore: allow conditional disable of the site instance override patches at runtime * feat: add app.allowRendererProcessReuse property to allow runtime disable of site instance overrides spec: add tests for the new allowRendererProcessReuse property feat: add console warnings / errors for loading non context-aware native modules * Only error if the patch is disabled * Warn all the time, this will ship in Electron 7
This commit is contained in:
parent
26155c8a00
commit
87ae9324ac
17 changed files with 221 additions and 89 deletions
33
spec/fixtures/api/site-instance-overrides/main.js
vendored
Normal file
33
spec/fixtures/api/site-instance-overrides/main.js
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
const { app, BrowserWindow, ipcMain } = require('electron')
|
||||
const path = require('path')
|
||||
|
||||
process.on('uncaughtException', (e) => {
|
||||
console.error(e)
|
||||
process.exit(1)
|
||||
})
|
||||
|
||||
app.allowRendererProcessReuse = JSON.parse(process.argv[2])
|
||||
|
||||
const pids = []
|
||||
let win
|
||||
|
||||
ipcMain.on('pid', (event, pid) => {
|
||||
pids.push(pid)
|
||||
if (pids.length === 2) {
|
||||
console.log(JSON.stringify(pids))
|
||||
if (win) win.close()
|
||||
app.quit()
|
||||
} else {
|
||||
if (win) win.reload()
|
||||
}
|
||||
})
|
||||
|
||||
app.whenReady().then(() => {
|
||||
win = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
preload: path.resolve(__dirname, 'preload.js')
|
||||
}
|
||||
})
|
||||
win.loadFile('index.html')
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue