Open g-sam opened 1 year ago
It would be good to retry this on Safari Technology Preview 192, which uses WebKit's version of Web Extensions. Ports specifically have been rewritten there, and an error is thrown if the port is disconnected. There are a couple tests for onDisconnect
.
browser.runtime.connect
port object'sonDisconnect
event should be fired when a connected tab is closed and in various other circumstances, but isn't. It may work whenport.disconnect()
is called explicitly (haven't tested).I found a few other reports of this issue:
The following may be a related bug or simply divergent behaviour: in Chrome,
port.postMessage()
on a disconnected port throws an error. In Safari, it does nothing.