Mozilla Firefox contribution guide will help you if you want to make some open source contributions to the Mozilla Firefox browser. Mozilla Firefox, as we all know, is an open-source browser widely used by millions of users, developers, and cybersecurity experts. The software is free to use, and its source code is available to the public. Anyone, all around the world, can make changes to the software and fix bugs. Have you thought about contributing to the Mozilla Firefox browser yourself, whether through code or by writing documentation? If so, here’s each and every step you need to make your first Mozilla Firefox contribution.
Mozilla firefox Contribution (4 steps):
- Getting the Mozilla Firefox source code.
- Creating a Bugzilla account.
- Making changes to the source code and creating a patch.
- Submitting the patch for review using Phabricator.
If you are really interested in contributing to the other open source projects you can visit our open source category.
How to Get Mozilla Firefox Source Code
This piece deals with building Firefox on Linux systems (any distro is fine). This is the first step in the Mozilla Firefox contribution. To learn more about building Firefox on another platform, you can click here.
To download the source code you have to use Mercurial (also known as hg) which is a distributed version control system used for Firefox development.
First, open a new terminal window to download the source code by following the commands below.
//Create a folder named src and go inside it
mkdir src && cd src
//Get the source code
hg clone https://hg.mozilla.org/mozilla-central

You’ll have to compile the code before you can run it. The compilation process may take hours to complete, so be patient. Also, while compiling the source code you may get various errors. These errors are listed below with the respective commands required to solve them.
To compile the source code:
//Change directory to mozilla-central
cd mozilla-central
//Compile the source
./mach build
Possible errors during code compilation
One of the errors you may get is the rust compiler
version error. This error occurs when you have an older version of rust compiler
installed. To solve it, run the command:
//To update the rust compiler
rustup update

Another error regards cbindgen
: Solve it using the following command:
// Install the latest version of cbindgen
cargo install cbindgen --force

You may get even more errors depending on the packages which you have installed on your system and whether they are up to date. Those errors can be resolved by following the steps displayed in the terminal window.
After installing the required packages you once again have to compile (build) the source code using the command mentioned above. After a successful compilation of the source code, you’re ready to run the Mozilla Firefox browser by using the following command.

//Running the code
./mach run
Creating a Patch
First, you’ll need a Bugzilla account. Create one using your email address or your GitHub account.
Choosing your issue
After creating your Bugzilla account, look for “good first bugs.” These are bugs which are easy to solve and focused on getting beginners familiar with the Firefox source code. After you get familiar with the process and source code, you’ll be able to solve the high-priority bugs. The list of available bugs to solve can be found here. You can filter bugs according to your expertise and the programming languages you are proficient in.
Example
For this tutorial, we’ll use Bug 1475503: Stop using preprocessor in reftest.jsm
, which is the easiest to start with.
Start by reading the information provided by the bug reporter in order to understand the problem. If you still need more information, or you get stuck, you can ask the mentor (reporter) associated with that bug for help.
Whenever you’re solving a new bug, you first have to make sure that the Firefox source code which you have on your system is up to date. You can update your Firefox codebase by running the following command:
//To update the Mozilla Firefox code base
hg pull -u
Let’s find out what the reporter of Bug 1475503 says about it:
There are two preprocessors in same file at locationmozilla-central/layout/tools/reftest/reftest.jsm
. The first preprocessor,#ifdef MOZ_ENABLE_SKIA_PDF
can be removed from that file and added to the file located atmozilla-central/toolkit/modules/AppConstants.jsm
. The second preprocessor can be completely removed. Lastly, the*
beforereftest.jsm
in themozilla-central/layout/tools/reftest/jar.mn
file has to be removed.
How to solve Bug 1475503
First, let’s remove #ifdef MOZ_ENABLE_SKIA_PDF
from reftest.jsm
.

And now add that first preprocessor at the end of the AppConstants.jsm
file.

Second, completely remove the second preprocessor, shown below, from the reftest.jsm
file.
#ifdef XP_MACOSX
try {
var dock = Cc["@mozilla.org/widget/macdocksupport;1"].getService(Ci.nsIMacDockSupport); dock.activateApplication(true);
}
catch(ex) { }
#endif
Finally, remove the *
before the reftest.jsm
in the mozilla-central/layout/tools/reftest/jar.mn
file.

We’ve done the required changes. Next we can build the source code to check whether everything works correctly.
//Compiling the source code
./mach build
Committing the changes
Up until now, the changes we made have been represented as a patch. Now, we have to commit those changes with a commit message. The commit message must contain the bug number with a short description of that bug.

//Adding a commit message
hg commit -m "Bug 1475503 Stop using preprocessor in reftest.jsm"
Submitting Your Patch for Review
Finally, you have made some Mozilla Firefox contributions and now its time to send the changes which you have made for review. First, create a Phabricator account by following the steps here.
Install moz-phab
and Arcanist for submitting patches by using this link.
Before submitting the patch for review using moz-phab
, make sure you run the following command after completing the above two steps. Otherwise, it will give you an error (moz-phab: command not found
).
source ~/.profile
Now you need to install a certificate by using the following command (it’s a one-time process). You’ll need to enter the API token from your Phabricator account.
moz-phab install-certificate
Now you’re ready to submit your patch for review.

moz-phab submit
Resources for Learning More About Open Source
- Open (Source) for Business: A Practical Guide to Open Source Software Licensing — Second Edition
- Managing 3rd Party Software Licences: Taking control of your license portfolio
- Producing Open Source Software: How to Run a Successful Free Software Project
- The Art of Community: Building the New Age of Participation
Liked our Mozilla Firefox contribution guide then support us on Patreon. Your support will surely help us in writing more of such content.
Thanks for reading! And If you are really interested in contributing to the other open source projects you can visit our open source category.
Thanks man 🙂