Porting a Chrome Extension to Firefox Add-on
While Chrome and Firefox are two very different browsers, Chrome Extension and Firefox Add-on are now more similar than ever. Therefore, it is possible to transplant a Chrome extension to a Firefox Add-on and publish it to the Mozilla store with minor changes. This post is how I transplanted my YouTube Comment Language Filter to Firefox.
Checking the Chrome incompatibilities
First of all, Firefox can run commands with
chrome namespace, such as
chrome.tabs.onUpdated. However, there are still a few codes that Firefox cannot run. Firefox offers a handy website to check check the chrome incompatibilities.
- On your Chrome browser (or on any equivalent Chromium browsers,) visit
- Enable Developer Mode and Press Pack Extension.
- Select your extension directory and pack your extension. That will create a
- Visit the Firefox Extension Test website and upload your .crx file.
- If it says there is no problem, then you are fine.
If there is any problem, I advice you to visit the MDN docs and see what code caused the problem. I didn't have any problem at this stage, so I cannot share any experience here.
Adding Firefox Manifest ID
Firefox also requires an ID inside the
manifest.json file. It is like the following.
This was a little hassle for me since Chrome cannot recognize the above code block. That means you need to keep two files of
manifest.json, one with the above code block (for Firefox) and one without it (for Chrome). If I find a more straightforward way, I will add it here.
Uploading it to the Firefox Add-on Store
- Visit https://addons.mozilla.org/.
- Log in to your developer account (or create a developer account, if you don't have one).
- Visit https://addons.mozilla.org/developers/addon/submit/.
- Follow the guidelines on the screen.
One little tip: make sure you don't include any unnecessary files such as
.DS_Store or anything like that. Using macOS's default Finder compressor will sometimes include these files. I recommend using Keka.\
- It seems that you don't necessarily need a Firefox manifest ID. Therefore – just submit the Chrome version and 99% it will work (If you didn't get any warning on Firefox Extension Test website).