We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 17b5fc0 commit 1b701e9Copy full SHA for 1b701e9
1 file changed
src/background/index.mjs
@@ -185,7 +185,15 @@ function setPortProxy(port, proxyTabId) {
185
port._reconnectAttempts = 0
186
console.debug('[background] Reset reconnect attempts after successful proxy message.')
187
}
188
- port.postMessage(msg)
+ if (port._isClosed) {
189
+ console.debug('[background] Main port closed; skipping proxy message.')
190
+ return
191
+ }
192
+ try {
193
+ port.postMessage(msg)
194
+ } catch (e) {
195
+ console.warn('[background] Failed to post message to main port (likely disconnected):', e)
196
197
198
port._portOnMessage = (msg) => {
199
if (msg?.session && !msg?.stop) {
0 commit comments