Fix devtools open in mixed sandbox mode

This commit is contained in:
Hari Juturu 2017-07-11 18:18:36 -07:00
parent 30df0f3306
commit 9a3b78d9fe
4 changed files with 24 additions and 7 deletions

View file

@ -34,13 +34,16 @@ app.once('ready', () => {
const argv = {
sandbox: null,
noSandbox: null
noSandbox: null,
sandboxDevtools: null,
noSandboxDevtools: null
}
let connected = false
function finish () {
if (connected && argv.sandbox != null && argv.noSandbox != null) {
if (connected && argv.sandbox != null && argv.noSandbox != null
&& argv.noSandboxDevtools != null && argv.sandboxDevtools != null) {
client.once('end', () => {
app.exit(0)
})
@ -54,6 +57,18 @@ app.once('ready', () => {
finish()
})
noSandboxWindow.webContents.once('devtools-opened', () => {
argv.noSandboxDevtools = true
finish()
})
noSandboxWindow.webContents.openDevTools()
sandboxWindow.webContents.once('devtools-opened', () => {
argv.sandboxDevtools = true
finish()
})
sandboxWindow.webContents.openDevTools()
ipcMain.on('argv', (event, value) => {
if (event.sender === sandboxWindow.webContents) {
argv.sandbox = value