Check that sender is a WebContents instance
This commit is contained in:
parent
ddedcf22d1
commit
56a8eb3a94
3 changed files with 18 additions and 12 deletions
|
@ -3,6 +3,8 @@
|
|||
const {Buffer} = require('buffer')
|
||||
const electron = require('electron')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const {WebContents} = process.atomBinding('web_contents')
|
||||
|
||||
const {ipcMain, isPromise, webContents} = electron
|
||||
|
||||
const fs = require('fs')
|
||||
|
@ -150,8 +152,8 @@ const removeRemoteListenersAndLogWarning = (meta, args, callIntoRenderer) => {
|
|||
let message = `Attempting to call a function in a renderer window that has been closed or released.` +
|
||||
`\nFunction provided here: ${meta.location}`
|
||||
|
||||
if (args.length > 0 && args[0].sender && args[0].sender.eventNames) {
|
||||
const sender = args[0].sender
|
||||
if (args.length > 0 && (args[0].sender instanceof WebContents)) {
|
||||
const {sender} = args[0]
|
||||
const remoteEvents = sender.eventNames().filter((eventName) => {
|
||||
return sender.listeners(eventName).includes(callIntoRenderer)
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue