I ported my first Firefox extension, and I changed almost nothing to get it working.

Install on Firefox View on GitHub

Remember WeatherTab? It’s a new tab extension that I created for Chrome, and I just released its port to Firefox.

According to Mozilla’s documentation, Firefox is almost completely compatible with the extension API supported by Chrome and Opera (and, by extension (puns!), my favorite underdog Vivaldi). They have a page dedicated to helping developers port their Chrome extensions to Firefox. And they’re not kidding; I had to change almost nothing to get WeatherTab working in Firefox.

The extension uses the geolocation permission, which in JavaScript means using navigator.geolocation. I didn’t have to do anything to get this working.

It also uses the storage permission, which means using chrome.storage. Even though this seems Chrome-specific, Firefox states that in most cases, it will work without any developer intervention. In my case, this turned out to not be true, but not for the reason I thought.

Firefox does support the usage of chrome.storage, but it does not support chrome.storage.sync without an application ID. Changing it to chrome.storage.local allowed the extension to work again, but it meant the temperature setting wouldn’t be synchronized across browsers.

I ended up pushing out the first version of the port with chrome.storage.local, then once the extension was live, I grabbed the UUID from the developer page, updated the manifest with it, updated the code to use chrome.storage.sync, and republishing. Now version 1.4.3 is live with the working synced temp setting. (I bumped the version of the Chrome extension to maintain parity between the two.)