WebExtension - interactions between multiple extensions possible?

An example of what I mean:

I combine a feed reader (brief) with a scriptblocker (uMatrix)
“Brief” runs in its seperate firefox tab in "chrome://brief/content/brief.xul"
I can set uMatrix to also be active in that directory and so I can allow/forbid
rss feeds from running JS, pictures, CSS and stuff.

However this does not work in Chromium Browsers. (uMatrix is also available in Chrome store)
If I try a similar feed reader there, uMatrix will not show options for domains.
I guess it can’t intereact with another extension there.

So I am wondering if this will (still) be possible with Firefox and WebExtension?

Related question:
Are Chrome extionsions supposed to run in Firefox or does it have to be adapted?
Is there already a way to install .crx files in Firefox (Dev/Nightly) ?

It is possible from FF54 with runtime.onMessageExternal

https://blog.mozilla.org/addons/2017/03/13/webextensions-firefox-54/

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/runtime/onMessageExternal

.crx is just a fancy name for ZIP archive, same as XPI
Just change it to XPI and you can install it via debugger, subject to all the APIs in it being supported by Firefox.

1 Like

Hm, nice. I have just one question:
Is there any way to identify/verify the message sender?

runtime.onMessageExternal gives you a sender as the 2nd argument, but the .id property of that is “The ID of the extension that sent the message, if the message was sent by an extension. Note that this is the extension’s internal ID, not the ID in the manifest.json applications key.”.
In Firefox those are chosen at random for every installation, so as the receiver of the (first) message, you cant know it.

You can set the ID manually in manifest.json

"applications": {
  "gecko": {
    "id": "addon@example.com",
    "strict_min_version": "42.0"
  }
}

Also worth noting:

Some WebExtension APIs use the add-on ID and expect it to be the same from one browser session to the next. If you use these APIs, then you must set the ID explicitly using the applications key. This applies to the following APIs:

storage.sync
identity.getRedirectURL

“Note that this is the extension’s internal ID, not the ID in the manifest.json applications key.”

Doesn’t that mean it’s the UUID in the moz-extension://-URL, and not the applications.gecko.id?

Also worth noting: …

That’s because the mapping applications.gecko.id <–> UUID cant be stored without an id, right?

I have not tested them since I am on FF53 so I cant say for sure.

You can also read the chrome doc, Cross-extension messaging