fix: add isDestroyed check (#31208)
fix: add isDestroyed check (#31208)

* Added isDestroyed check

fix: https://github.com/electron/electron/issues/31196

* fix: unregister frame name

Unregister the frame name so that we do not accidentally unregister the wrong window later on in case there is a timing issue with the events

* fix; check if webContents is destroyed

* fix: check if window/webContents is destroyed

Co-authored-by: Cheng Zhao <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@zcbenz.com>

Co-authored-by: Cheng Zhao <64b2b6d12bfe4baae7dad3d018f8cbf6b0e7a044@zcbenz.com>
electron/electron,gerhardberger/electron,gerhardberger/electron,electron/electron,electron/electron,gerhardberger/electron,electron/electron,gerhardberger/electron,electron/electron,gerhardberger/electron,electron/electron,gerhardberger/electron,electron/electron,gerhardberger/electron