Skip to content

Commit 9b52002

Browse files
authored
fix (electron-chrome-extensions): always disconnect native port when native messaging host is destroyed (#156)
* fix (electron-chrome-extensions): fix typo on native msg disconnect ipc channel name * fix (electron-chrome-extensions): send native disconnect message regardless of native messaging host connection status
1 parent a160f71 commit 9b52002

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

packages/electron-chrome-extensions/src/browser/api/lib/native-messaging-host.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ export class NativeMessagingHost {
125125
}
126126

127127
destroy() {
128-
if (!this.connected) return
129128
this.connected = false
130129
if (this.process) {
131130
this.process.kill()

packages/electron-chrome-extensions/src/renderer/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export const injectExtensionAPIs = () => {
6767
receive(message)
6868
}
6969
ipcRenderer.on(`crx-native-msg-${connectionId}`, onMessage)
70-
ipcRenderer.once(`crx-native-msg-${connectNative}-disconnect`, () => {
70+
ipcRenderer.once(`crx-native-msg-${connectionId}-disconnect`, () => {
7171
ipcRenderer.off(`crx-native-msg-${connectionId}`, onMessage)
7272
disconnect()
7373
})

0 commit comments

Comments
 (0)