chrome.tabs.sendMessage does not timeout

I have an extension working on Chrome and Firefox. I recently used the converter to create a Safari Web Extension. That worked really well and the extension mostly works in Safari.

However I am seeing one bug:

When the user invoke the extension popup menu I send a message using chrome.tabs.sendMessage to the active tab. In the case where I have no content script for this page URL there is no listener for the message.

In Chrome and Firefox I get a response and chrome.runtime.lastError is set so I can display a default popup menu. But in Safari I get no error or response.

I have worked around this by using browserAction.setPopup

For pages with no content script it will use the default popup which does not attempt to send a message to the content script.

I changed all my content scripts to send a message to my background script which causes it to call chrome.browserAction.setPopup to switch to the popup menu which does send a message to the content script.

chrome.tabs.sendMessage does not timeout
 
 
Q