Quick answer: no. You don’t need to check that.
A longer answer and to expand on what @juraj.masiar said:
When sending messages, you can use runtime.sendMessage()
to send them to any extension based on its id:
Sends a single message to event listeners within your extension or a different extension.
If sending to your extension, omit the extensionId
argument. The runtime.onMessage
event will be fired in each page in your extension, except for the frame that called runtime.sendMessage
.
from MDN on runtime.sendMessage()
When receiving and listening to messages, runtime.onMessage
only listens to messages sent by your extension:
Use this event to listen for messages from another part of your extension.
from MDN runtime.onMessage
and if you want to listen to messages from other extensions, as Juraj mentioned, you use runtime.onMessageExternal
Use this event to listen for messages from other extensions or web pages.
from MDN runtime.onMessageExternal