sending a response for async listeners #23709
Labels
Content:WebExt
WebExtensions docs
help wanted
If you know something about this topic, we would love your help!
p3
We don't have visibility when this will be addressed.
MDN URL
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessageExternal
What specific section or headline is this issue about?
addListener syntax/sendResponse
What information was incorrect, unhelpful, or incomplete?
this sounds like a personal choice (but it is not, see below):
My understanding is that async functions can call sync functions in their inside, so there is no reason why an async listener could not call a sync function sendResponse.
Which means the sending is ended before the next code statement in the async listener. (Sending could just be a handing over to a messaging system, like putting a letter into a physical mailbox of the postal service). No reason why that could not be done sync in the async listener, in theory? It does not seem to be forbidden by JS.
What did you expect to see?
does not work. what is written is valid only for a sync listener.
for an async listener, the message must be returned by the listener statement:
return response;
so there is no choice in this case.
So this is not personal option:
and it might help to rephrase it.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/mozilla/add-ons/webextensions/api/runtime/onmessageexternal
The text was updated successfully, but these errors were encountered: