Mozilla Firefox open source contribution

Mozilla Firefox Contribution easy guide for Beginner’s 2020

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
Creating a new directory and downloading the source code
Creating a new directory and downloading the source code

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
Rust compiler version error
Rust compiler version error

Another error regards cbindgen: Solve it using the following command:

// Install the latest version of cbindgen 
cargo install cbindgen --force
cbindgen version error
cbindgen version error

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.

Successfully build the Mozilla Firefox source code
Successfully build now run the Mozilla Firefox Browser
//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.


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 location mozilla-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 at mozilla-central/toolkit/modules/AppConstants.jsm. The second preprocessor can be completely removed. Lastly, the * before reftest.jsm in the mozilla-central/layout/tools/reftest/ file has to be removed. 

How to solve Bug 1475503

First, let’s remove #ifdef MOZ_ENABLE_SKIA_PDF from reftest.jsm.

mozilla firefox contribution patch 1

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

mozilla firefox contribution patch 2

Second, completely remove the second preprocessor, shown below, from the reftest.jsm file.

#ifdef XP_MACOSX 
try { 
var dock = Cc[";1"].getService(Ci.nsIMacDockSupport); dock.activateApplication(true); 
catch(ex) { } 

Finally, remove the * before the reftest.jsm in the mozilla-central/layout/tools/reftest/ file.

mozilla firefox contribution patch 3

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.

Committing the changes which we made to the code
Committing the changes which we made to the code
//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.

Submitting the changes to the phabricator code review tool
Submitting the changes to the phabricator code review tool
moz-phab submit

Resources for Learning More About Open Source

  1. Open (Source) for Business: A Practical Guide to Open Source Software Licensing — Second Edition
  2. Managing 3rd Party Software Licences: Taking control of your license portfolio
  3. Producing Open Source Software: How to Run a Successful Free Software Project
  4. 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.

1 thought on “Mozilla Firefox Contribution easy guide for Beginner’s 2020”

Comments are closed.