Hi, I've run into an issue when using runtime ports to communicate between the popup and the background of an extension. Specifically, there seems to be an inconsistency between Chrome and Safari as to when the disconnect event on a port is fired. My expectation is that a disconnect event is fired when the extension popup is closed, but this does not seem to be the case in the Safari browser. The only way I can see this event being fired is to call the port.disconnect() event manually. Is it possible to ensure the disconnect event is called when the popup is closed by any means?
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/Port
port.onDisconnect.addListener(function() {
console.log("Extension disconnected");
});
I've also opened a case via the feedback assistant.