electron-push-receiver
electron-push-receiver copied to clipboard
Don't send messages to destroyed webContents
This commit:
- Prevents sending messages to destroyed webContents (which result in a crash)
- Allows registering multiple webContents for push notifications
We need this because we are listening for notifcations in a specific webContents. If it crashes we create a new one and call setup again, without this change the next push notification that came in would cause a crash.
cc @MatthieuLemoine I tried to make the minimal change to make this work, but I think I'd like to do some refactoring later on to make it s.t. each call to setup is isolated from one another, what do you think?
Hit a weird electron crash, so I removed the call to isDestroyed
: https://github.com/electron/electron/issues/11797
Hey it seems like the crash I was experiencing might be unrelated to this project, doing some more digging now...
Okay - the other crash I was getting was https://github.com/electron/electron/issues/11797 I think this change is still needed to prevent the main process from crashing when the webContents that's setup to receive notifications crashes...