Safari Web Extensions: message listener responses in frames are not respected

Setup:
A chrome.runtime.onMessage listener attached on the top frame which sends no response, and another listener attached on a frame which sends a response. The background page sends a message to the tab.

What happens:
The top frame listener is invoked and returns undefined. A response is returned to the background sendMessage call.

What should happen:
The listener on attached on a frame should be invoked after the top frame listener and checked for either a response or returning true with an intention to respond asynchronously and only then a response should be returned to the background page.

Replies

Same problem reported here (it's not related to iframes only, but general the sendMessage API):
https://developer.apple.com/forums/thread/659681
The only way around would be to use connect/port API. But it's not exactly easy to refactor existing code...
One could maybe build a polyfill that would use connect/ports.

Anyway, is this the right place to report bugs? This is 100% a bug.

Anyway, is this the right place to report bugs? This is 100% a bug.

I don't know, but I assume it is as good a place as any.

See my response to your question, if you only need top frame responses there is a solution for your issue
This does sound like a bug. Can you attach a sample extension showing the problem via Feedback Assistant?