runtime.onMessageExternal API doesn't work

According to Assessing Your Safari Web Extension’s Browser Compatibility and https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessageExternal, runtime.onMessageExternal API should work in Safari 14. However, the reality is different.

Scenario:

  1. having two web extensions; say A (with runtime.id = '123'), and B (with runtime.id = 'xyz').
  2. go to the Web Inspector of B and run this:

chrome.runtime.onMessageExternal.addListener((message, sender, sendResponse) => {console.log(${sender.id})})

This should make B wait for an external message.

  1. go to the Web Inspector of A and run this:

chrome.runtime.sendMessage('xyz', {message: 'whatever'})

Expect:

  • '123' is printed on the Web Inspector of B
  • This works perfectly fine on Chrome.

Actual:

  • Nothing on the Web Inspector of B
  • Got a Promise on the Web Inspector of A -- {result: undefined, status: "resolved"}

Please confirm this is a bug and please fix.

Answered by Engineer in 677269022

Safari currently doesn't support cross-extension messaging.

Can you please file a bug at https://feedbackassistant.apple.com explaining the use case for why you'd like to do this with your extensions?

Thanks!

Accepted Answer

Safari currently doesn't support cross-extension messaging.

Can you please file a bug at https://feedbackassistant.apple.com explaining the use case for why you'd like to do this with your extensions?

Thanks!

runtime.onMessageExternal API doesn't work
 
 
Q