I am currently migrating a chrome extension to firefox by using mozilla’s webextension-polyfill library. The problem is that firefox addons cannot communicate with webpages using runtime.message API. In chrome, one can specify externally_connectable URL’s and send message to background script’s listener.
When I look up the docs&forums for an alternative, the suggested way is to send a window message from webpage and listening it from the content scripts. However, even mozilla docs discourage this implementation. (source: https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage#Using_window.postMessage_in_extensions)
Moreover, we also need to return the result of background message listener to the webpage. With window.sendMessage API doing this is not so inspiring. Chrome does this by sending response to the callback function which is a parameter of runtime.sendMessage.(callbacks are also not inspiring )
Is there any other way to communicate with a specified webpage from addon or is there any plan of adding webpage messaging support to addons?