browser.runtime.onMessage in content script intermittently fails on iOS 18.5 (Safari Web Extensions)

Hi everyone,

I’m encountering a critical reliability issue with message passing in my Safari Web Extension on iOS 18.4.1 and iOS 18.5.

In my extension, I’m using the standard messaging API. The background script sends a message to the content script using browser.tabs.sendMessage(...), and the content script registers a listener via:

browser.runtime.onMessage.addListener(handler);

This setup has been working reliably in all prior versions of iOS. However, after updating to iOS 18.4.1 and 18.5, I’ve noticed the following behavior:

  • ✅ The content script is successfully injected, and onMessage.addListener is registered (I see logging confirming this).
  • ✅ The background script sends the message using the correct tabId (also confirmed via logs).
  • ❌ The content script’s onMessage listener is not consistently triggered.
  • ⚠️ This issue is intermittent, sometimes the message is received, sometimes it is silently dropped.
  • ❌ No exceptions or errors are thrown in either script, the message appears to be sent, but not picked up from the content script message listener.

Have you opened a bug report yet @lumbardhelshani ? I think we're seeing the same issue at our company and I want to make sure this gets Apple's attention to consider a fix. Another thread here with a similar report: https://developer.apple.com/forums/thread/784680

Please let me know if you do open a bug report (or if you've already done so). More info here: https://developer.apple.com/bug-reporting/

browser.runtime.onMessage in content script intermittently fails on iOS 18.5 (Safari Web Extensions)
 
 
Q