We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5b5ea00 commit ba2dd3bCopy full SHA for ba2dd3b
1 file changed
src/background/index.mjs
@@ -159,7 +159,15 @@ function setPortProxy(port, proxyTabId) {
159
port._reconnectAttempts = 0
160
console.debug('[background] Reset reconnect attempts after successful proxy message.')
161
}
162
- port.postMessage(msg)
+ if (port._isClosed) {
163
+ console.debug('[background] Main port closed; skipping proxy message.')
164
+ return
165
+ }
166
+ try {
167
+ port.postMessage(msg)
168
+ } catch (e) {
169
+ console.warn('[background] Failed to post message to main port (likely disconnected):', e)
170
171
172
port._portOnMessage = (msg) => {
173
if (msg?.session && !msg?.stop) {
0 commit comments