fix: remove catch-all HandleScope (#22531)

This commit is contained in:
Jeremy Apthorp 2020-03-10 18:16:58 -07:00 committed by GitHub
parent 4bca5205bb
commit 19314d3caf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 131 additions and 75 deletions

View file

@ -1,5 +1,8 @@
import { expect } from 'chai'
import { BrowserWindow, ipcMain, IpcMainInvokeEvent } from 'electron'
import { emittedOnce } from './events-helpers'
const v8Util = process.electronBinding('v8_util')
describe('ipc module', () => {
describe('invoke', () => {
@ -103,6 +106,17 @@ describe('ipc module', () => {
ipcMain.removeHandler('test')
}
})
it('throws an error in the renderer if the reply callback is dropped', async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
ipcMain.handleOnce('test', () => new Promise(resolve => {
setTimeout(() => v8Util.requestGarbageCollectionForTesting())
/* never resolve */
}))
w.webContents.executeJavaScript(`(${rendererInvoke})()`)
const [, { error }] = await emittedOnce(ipcMain, 'result')
expect(error).to.match(/reply was never sent/)
})
})
describe('ordering', () => {