Skip to content

Porting a Chrome extension to WebExtensions in half a step

A coworker contacted me today about the Unbias Me extension. It’s a set of simple userscripts that hide profile pictures and names in sites like LinkedIn and GitHub, where unconscious bias can affect your behavior toward women and other groups. She wanted to know if we could have an add-on like this for Firefox.

I gave the add-on a quick look and realized it would be trivial to port it to WebExtensions. WebExtensions already support browser_action and content_scripts, which is what the add-on uses. So, ultimately all I needed to do was add a little bit of metadata:

  "applications": {
    "gecko": {
      "id": "unbias-me@fureigh",
        "strict_min_version": "45.0"

That’s it! You just zip the files together and use the .xpi file extension, and you’re good to go. Here’s the unsigned XPI if you want to give it a try. I sent a PR to the developer, so I hope they can integrate this code and get the add-on listed on our site.

This may seem like an unfair example since content scripts are the simplest form of add-on. However, keep in mind that they’re also the most common form of add-on. Having support for this API means that there are probably thousands of Chrome extensions that can be very easily ported right now to work with release versions of Firefox and to be listed on AMO. If there’s a Chrome extension you would like to see ported to Firefox, you should give this little experiment a try.

{ 8 } Comments

  1. Paul Leo Steinberg | 2016/03/28 at 8:06 PM | Permalink

    “(this will trigger a warning in Chrome, unfortunately)”. Seriously? A build script still to be written that has to fiddle with JSON files instead of just zipping a directory is your idea of “ultimately all I needed to do was add a little bit of metadata”???

    This is a nice example how Mozilla, though having good intentions, is messing everything up, lately. Did you talk to Google to allow this extra key in Chrome? Where is the Chrome bug? What is your strategy if, e.g., different permissions are needed for Firefox and Chrome? Why can’t this be in a separate gecko.json file, at least for now? You could even join entries from gecko.json and manifest.json, so you would only have to specify diverging entries in gecko.json.

  2. Andy McKay | 2016/03/28 at 8:07 PM | Permalink

    Soon the addition of that bit of metadata will soon be unnecessary as per and there will be absolutely no work to do.

  3. Noitidart | 2016/03/28 at 11:35 PM | Permalink

    Very cool. I used to do this as well when testing GChrome Exts in Firefox but I got tired of it so automated the process –

  4. Greg K Nicholson | 2016/03/29 at 3:13 AM | Permalink

    Why do web extensions need to explicitly state that they support Gecko? Websites don’t.

    Why can’t Gecko “just” inspect the extension’s code and see for itself whether it can run the extension?

    (I know, baby steps. I can just see this veering dangerously towards “Works only in Netscape 4.0!” territory.)

  5. jorge | 2016/03/29 at 8:36 AM | Permalink

    @Paul Leo Steinberg: See Andy’s response for the current plan for this. At any rate, hiding a little bit of metadata is a trivially simple task, so I don’t find it at all problematic.

  6. jorge | 2016/03/29 at 8:38 AM | Permalink

    @Greg K Nicholson: While Firefox can do that (and does it), that little piece of metadata also contains the compatibility information and the add-on ID. Andy’s reply explains a plan to make that piece of code optional, though it does rely on AMO assigning a unique ID to the add-on, similarly to what the Chrome store does.

  7. Essel | 2016/05/29 at 2:06 PM | Permalink

    Hi Jorge,

    Sorry but I couldn’t find another way of contacting you,..
    I’ve googled around a little and I can see you’re the Add-ons Developer Relations Lead for Mozilla.
    If you could tell me, in your opinion, where is the definitive place for a non-coder type person to submit suggestions / requests for addons, amongst the community? I don’t want to go to the wrong place and either annoy someone, or have my post likely be ignored due to low traffic.

    Is there a definitive spot you can think of to get the most eager add-on developer eyes?
    (What I’m after is extremely basic, but unfortunately I can’t code at all)

    Thanks for your time, sorry to bug you via this method. Your email I could not find.

  8. jorge | 2016/05/30 at 8:34 AM | Permalink

    You can try posting in the discourse forum.

Post a Comment

Your email is never published nor shared. Required fields are marked *