Add a spec for the "renderer window closed" error.

This commit is contained in:
Charlie Hess 2017-01-12 15:02:24 -08:00 committed by Kevin Sawicki
parent a0b24bd155
commit b04db2e546
2 changed files with 29 additions and 0 deletions

View file

@ -494,6 +494,18 @@ describe('ipc module', function () {
w.removeListener('test', listener)
assert.equal(w.listenerCount('test'), 0)
})
it('throws an error when a function is called in a destroyed renderer', (done) => {
w = new BrowserWindow({
show: false
})
w.loadURL('file://' + path.join(fixtures, 'api', 'reload-page.html'))
setTimeout(() => {
assert.throws(() => w.webContents.emit('remote-handler'),
/Attempting to call a function in a renderer window that has been closed or released./)
done()
}, 400)
})
})
it('throws an error when removing all the listeners', () => {