- Downloading the source code
- Finding your way through the code
- How to get help
- Finding what to work on
- Hacking the code
- Learning Bugzilla
Let's get started.
The Firefox source code lives in a Mercurial repository named mozilla-central. Mercurial is a distributed version control system and it's usually pre-installed with developer tools in Linux and Mac OS, and you can get it with MozillaBuild on Windows (more details in the Compiling section). After you have Mercurial installed, open the terminal and type:
hg clone https://hg.mozilla.org/mozilla-central/ mozilla
This will put the source code inside a folder named mozilla in your current working directory.
Building Firefox might seem a daunting task at first. There are many different configuration options and combinations, but you'll usually not need to worry or know about most of them. If you have installed all the required tools and downloaded the source code, just follow the steps and you should not have major problems to do it. The best guide to start is the Simple Firefox build. A full build is a slow process which make take any time between 20min and 2 hours, depending on your computer and OS. You really need to succesfully build Firefox before continuing on the following steps.
Source code organization
The next problem is "where does the app/front-end code live?". You can navigate and search through the full source code online in MXR, which also makes it easy to link to specific files or lines in the source. The code is organized into various top-level folders. The front-end code lives in browser/ (In your HG tree, it would be
mozilla/browser/). For a quick start, the most important files that you probably want to poke around are:
- main front-end code: browser.js
- structure: browser.xul
- tabs-related code: tabbrowser.xml
- general appeareance: browser.css
- OS specific appearance: windows (2), mac, linux
Knowing where to ask for help
#developers and #fx-team on the Mozilla IRC server is a good place to start. People should be able to guide you through the codebase and point you to the right direction. But don't expect everything easy in your hands. Do your research first: look at the code, this wiki and Google. This will give you experience on how to figure more things on your own. Use Mercurial to look at the history of a file, see the comments on the bugs and use the hg blame to see who wrote the code you're interested.
Finding what to work on
There are many ways to find interesting things to work on. One good way is to search Bugzilla for bugs marked as [good first bug]. In addition, the UX team always have lists of new features and improvements wanted for Firefox. Here is a handy list prepared for the Stanford Bootcamp. Other than that, feel free to ask around: there's no shortage of things to work on, and people will point you in the right directions.
Hacking the code
After you've edited and saved the files, you need to recompile your changes. If all your changes were done in the browser/ folder, you just need to go open the terminal, go to the top-level folder were Firefox was compiled, and type:
make -C browser
This will be much faster than the initial, full compilation. Note that these rules vary for different parts of the code.
After your code is ready, you probably want to get your work included in Firefox itself. Every change to the code needs to have an associated bug in Bugzilla, our tracking system. After you have created a bugzilla account, file a bug in the proper component and attach your changes using a patch file that you can generate through:
hg diff > my-patch
After you do that, you'll request feedback and review from the peers associated with the area of the code that you want changed. Every change in the code needs to be reviewed by a peer. During the review process the reviewer will analyze your changes and might ask for modifications or improvements. After the review is done, someone will check in your code and your work will now be in Firefox! Congratulations!