Throw an error when users attempt to remove all listeners from the IPC modules
This commit is contained in:
parent
71f94c7a3a
commit
db729b5b52
2 changed files with 16 additions and 0 deletions
|
@ -29,4 +29,12 @@ module.exports = function (ipcRenderer, binding) {
|
|||
|
||||
ipcRenderer.send('ELECTRON_BROWSER_SEND_TO', true, webContentsId, channel, ...args)
|
||||
}
|
||||
|
||||
const removeAllListeners = ipcRenderer.removeAllListeners
|
||||
ipcRenderer.removeAllListeners = function (...args) {
|
||||
if (args.length === 0) {
|
||||
throw new Error('Removing all listeners from ipcRenderer will make Electron internals stop working. Please specify a event name')
|
||||
}
|
||||
removeAllListeners.apply(this, args)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue