On 06/09/12 24:42 AM, Erik Vold wrote:
> I'd like a jetpack to be able to create an API that other addons can use
> to communicate with it.
[..]
> I'm thinking that I could setup a user friendly resource uri and provide
> a jsm that would send json so my jetpack (somehow) would suffice, but
> I'm wondering if anyone has a better idea?
During last conference I was, I explained how a page can query Firefox
to discovered if an Add-on is installed or not, and use the
functionality the add-on provides. Is it something similar?
First of all, the add-on has to explicitly allows this; then the page
can send a `postMessage` to itself to "check" if the add-on is present
(like an handshake) and if it is, use it with `postMessage` APIs.
Currently to do that we have to involve page-mods and the communication
between webpage and add-on is not so straightforward (the `onmessage`
event handlers in the page and in the content script receive both the
messages, also the ones sent by themselves); but I like the fact that
the add-on have to explicitly allows a set of pages to use it, and that
the communication are over `postMessage` APIs, for security reasons.
Maybe we could improve that, and implement similar mechanism for cross
addon communications, to be consistent?