add spec
This commit is contained in:
parent
9e3b8ade12
commit
e4524ce42e
3 changed files with 150 additions and 0 deletions
|
@ -338,6 +338,27 @@ ipcMain.on('crash-service-pid', (event, pid) => {
|
|||
event.returnValue = null
|
||||
})
|
||||
|
||||
ipcMain.on('test-webcontents-navigation-observer', (event, options) => {
|
||||
let contents = null
|
||||
let destroy = () => {}
|
||||
if (options.id) {
|
||||
const w = BrowserWindow.fromId(options.id)
|
||||
contents = w.webContents
|
||||
destroy = () => w.close()
|
||||
} else {
|
||||
contents = webContents.create()
|
||||
destroy = () => contents.destroy()
|
||||
}
|
||||
|
||||
contents.once(options.name, () => destroy())
|
||||
|
||||
contents.once('destroyed', () => {
|
||||
event.sender.send(options.responseEvent)
|
||||
})
|
||||
|
||||
contents.loadURL(options.url)
|
||||
})
|
||||
|
||||
// Suspend listeners until the next event and then restore them
|
||||
const suspendListeners = (emitter, eventName, callback) => {
|
||||
const listeners = emitter.listeners(eventName)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue