Mozilla

The articles below include content about downloading and building Mozilla code. In addition, you'll find helpful articles about how the code works, how to build add-ons for Mozilla applications and the like.

Accessibility and Mozilla
Accessibility is the idea that software (among other things) should be designed to be usable and, as much as possible, convenient to use for people with disabilities. Mozilla strives to make its software accessible; the documents below cover the ways in which we do so.
Add-ons
Add-ons allow developers to extend and modify the functionality of Firefox.
Adding a new CSS property
This page describes how to add a new CSS property to the style system.  The style system is the part of the code in Gecko that is responsible for producing a computed value for every property for every element.  See the Gecko Overview for more information about the style system.
Adding a new event
Roughly, there are 3 types of event. First, you need to choose which type you need.
Adding a new word to the en-US dictionary
Occasionally bugs are filed pointing out situations where perfectly legitimate words are missing from the English spell check dictionary in Firefox. This article describes the process for adding a word to the dictionary.
Adding phishing protection data providers
Phishing protection technology lets Firefox help protect users by comparing the URLs the user visits to a blacklist of known scam sites, and presenting a warning to the user when they visit a site on the list.
An introduction to hacking Mozilla
If you find errors in this document, or if you want to contribute updated or additional sections, please contact Kai Engert.
Android-specific test suites
There are several Android-specific test suites that run against the Firefox for Android codebase:
API change rules
Until further notice, the following rules govern API changes:
Application cache implementation overview
This happens in nsHttpChannel::OpenCacheEntry(). All top level document loading (navigation) channels are set ChooseApplicationCache flag, which happens in nsDocShell::DoURILoad(). Channels having that flag set are searching for nsIApplicationCache object prior inspecting normal HTTP cache. nsIApplicationCacheService::ChooseApplicationCache is given the URL the channel is about to load. It synchronously returns an nsIApplicationCache object representing the most recent cache version from the most recent cache group containing the entry under the URL or a matching namespace.
Benchmarking
Debug builds (--enable-debug) and non-optimized builds (--disable-optimize) are much slower. Any performance metrics gathered by such builds are largely unrelated to what would be found in a release browser.
Bird's Eye View of the Mozilla Framework
Browser chrome tests
The browser chrome test suite is an automated testing framework designed to allow testing of application chrome windows using JavaScript. It currently allows you to run JavaScript code in the same scope as the main Firefox browser window and report results using the same functions as the Mochitest test framework. As all tests, they won't work in a build with tests disabled (--disable-tests).
Browser security
An important aspect of developing code for any browser, including Firefox, as well as any Web-oriented project, is its security. These articles provide important guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines.
Bugzilla
bugzilla.mozilla.org (often abbreviated b.m.o) is Mozilla.org's bug-tracking system, a database for recording bugs and enhancement requests for Firefox, Thunderbird, SeaMonkey, Camino, and other mozilla.org projects.
Building Mozilla
Testing
Building SpiderMonkey with UBSan
1. Compile a recent version of LLVM & Clang.
C++ portability guide
What follows is a set of rules, guidelines, and tips that we have found to be useful in making C++ code portable across many machines and compilers.
Calendar
Editorial review completed.
Chat Core
Chat Core is the shared code for instant messaging that is shared by Instantbird and Thunderbird. It provides a number of functions and capabilities, including:
Choosing the right memory allocator
There are a lot of different memory allocators in the Mozilla source tree. This article looks over some of them and tries to sort out which should be used under what circumstances.
ChromeWorkers and the Chrome worker loader
To complement the open Web Worker functionality, Mozilla has introduced the ChromeWorker interface, which provides this capability within application chrome. That makes it available not only to the application itself, but also to add-ons.
Command Line Options
Command line options are used to specify various startup options for Mozilla applications.
Connect with Mozilla
Enable, inspire and collaborate to make the Web the primary platform used to create experiences across all connected devices.
Continuous Integration
When you push a commit to mozilla-central or a related repository, it initiates a large chain of builds and tests across multiple types of infrastructure.  This document will help you understand all the pieces that comprise Mozilla's continuous integration systems.
Creating a Firefox sidebar
Web publishers can offer visitors a Firefox sidebar to encourage their engagement. There are two ways to create a sidebar for Firefox users: the Social API and an extension. You can choose either depending on your needs and resources.
Creating a Language Pack
To create a language pack, or a localization repack, you first need to go through the initial setup process.
Creating a localized Windows installer of SeaMonkey
Preamble: not all of the programs listed below are necessary. Some of them are simply the ones I use because I like them, while others are scripts that I've created to speed up the work. You can in every case choose the program you prefer to do some operations, and you can also decide not to use any of my scripts and manually enter all of the commands by hand. It's your choice!
Creating a Login Manager storage module
The Login Manager manages and stores user passwords. Extensions can replace the built-in password storage with their own implementation. This can be useful if you want to integrate a gecko application's password management with an existing password management system, or use your own password storage format or database.
Creating a spell check dictionary add-on
This page describes how to package a Hunspell spell check dictionary as a Firefox add-on, or how to update your existing add-on, so that it can be installed, uninstalled and updated without a restart.
Creating JavaScript callbacks in components
XPCOM components use IDL to create interfaces. These interfaces are used to manipulate the component in C++ and JavaScript. A common pattern used with interfaces to create a bi-directional communication between two groups of code is the observer (or listener) pattern. Basically, the component defines an observer (or listener) interface which is implemented by some external code and this implementation is passed to the component. The component can then call methods on the observer interface to signal the external code when predefined events occur. Here is a very simple example of the observer pattern:
Creating Mercurial User Repositories
When working with Mercurial, it is often nice to publish your changes on a server as a backup or so others can examine and work with them. If you have Level 1 commit access or higher, then you should have an LDAP account which allows you to push to user repos in the /users directory of hg.mozilla.org.
Creating MozSearch plugins
Firefox 2 uses a simplified form of the OpenSearch format for storing search plugins. A MozSearch search plugin is an XML file that describes the search engine, its URL, and the parameters that need to be passed to that URL.
Creating reftest-based unit tests
Technical review completed.
Creating Sandboxed HTTP Connections
Starting with Gecko 1.8.1 (Firefox 2), it is possible to create sandboxed HTTP connections which don't affect the user's cookies. This article will cover the basics of doing HTTP connections from XPCOM JavaScript, and should easily translate to C++ XPCOM.
Debugging
Debugging a project as large as Mozilla can be a daunting task. Fortunately, over the years, Mozilla developers have come up with not just technologies and features to help you debug code, but have devised tips and techniques that can help too. Also available are assorted tools that you can use when debugging.
Developer guide
There are lots of ways to contribute to the Mozilla project: coding, testing, improving the build process and tools, or contributing to the documentation. This guide provides information that will not only help you get started as a Mozilla contributor, but that you'll find useful to refer to even if you are already an experienced contributor.
Displaying Places information using views
Views are one component of the Places model-view-controller design. Use them to display nsINavHistoryResult objects to the user. See Querying Places for information about obtaining and using nsINavHistoryResult objects, which this page assumes you are familiar with.
Error codes returned by Mozilla APIs
The following tables list errors that can occur when calling various Mozilla APIs. Each error is listed by its name and an error code in parentheses. An error will typically be displayed on the error console, but can be captured using a try-catch block in JavaScript. These constants can be accessed through Components.results. For example, by using Components.results.NS_ERROR_NOT_INITIALIZED
Firefox
Firefox is Mozilla's popular Web browser, available for multiple platforms including Windows, OS X, and Linux on the desktop and all Android and iOS mobile devices. With broad compatibility, the latest in Web technologies, and powerful development tools, Firefox is a great choice for both Web developers and end users.
Firefox for Android
For more and more people mobile devices are the primary way, or even the only way, to access the Web. Firefox for Android (codenamed Fennec) is an open, hackable, standards-based browser, just like the desktop Firefox.
Firefox for iOS
For more and more people mobile devices are the primary way, or even the only way, to access the Web. Firefox for iOS (codenamed Fennec like its Android counterpart) is an open, hackable, standards-based browser, just like the desktop Firefox.
Firefox Marketplace
In this zone you'll find all the information you need to prepare and publish apps on the Firefox Marketplace. Find guidance on how to make apps successful, delivery options, publishing and updating apps, and the libraries and APIs to make use of Marketplace features.
Firefox Operational Information Database: SQLite
A large amount of operational information about websites visited and browser configuration is stored in relational databases in SQLite used by Firefox. The SQLite Manager add-on allows convenient browsing of this information.  (Install the SQLite Mangager add-on, click Tools -> SQLite Manager.  In the manager, select the database you want to explore in the '(Select Profile Database)' pulldown, click 'Go', select one of the tables listed in the left column and see the current contents of the database in the 'Browse & Search' tab.)
Firefox OS for TV
 Welcome to the landing page for Firefox OS for TV and connected devices. This is written for web developers who are interested in Firefox OS for TV current and future work, and developing web apps for TV. The articles linked below provide everything you need to build and run a Firefox OS TV simulator, get started writing apps and deploying them to TV, understand TV implementation and UX differences, and more.
Gecko
Gecko is the name of the layout engine developed by the Mozilla Project. It was originally named NGLayout. Gecko's function is to read web content, such as HTML, CSS, XUL, JavaScript, and render it on the user's screen or print it. In XUL-based applications Gecko is used to render the application's user interface as well.
Getting from Content to Layout
Gecko maintains two separate representations of a document in memory: the content tree and the frame tree.  Changes to a document originate in the content tree (from DOM modification by scripting, insertion of elements from the parser, etc.) and are propogated to the layout tree through magic that primarily resides in http://mxr.mozilla.org/mozilla-central/source/layout/base/nsCSSFrameConstructor.cpp
Git
The current official git mirror of the Firefox code base (also known as "gecko" or "mozilla-central") can be found at https://github.com/mozilla/gecko-dev.  This repository contains all of the branches that are part of mainline development, including the train branches mozilla-central (nightly), mozilla-aurora (developer edition), mozilla-beta, and mozilla-release.
Hacking with Bonsai
Bonsai was originally created to solve the problem of tree instability. The original Navigator code base had large sections that were shared across multiple platforms. Many times, code checked in would compile or run on a handful of platforms. Also, with as many as 100 engineers, it was very difficult to determine what happened in the tree that caused the instability. Bonsai was created to solve these problems.
How Mozilla determines MIME Types
How test harnesses work
Technical review completed.
How to add a build-time test
How to get a process dump with Windows Task Manager
When tracking down the causes of process hangs, it is often helpful to obtain a process dump while the process is experiencing a hang.  This article describes how to get a process dump with Task Manager on Windows. (To get a process dump for Thunderbird or some other product, substitute the product name where ever you see Firefox in these instructions.)
How to get a stacktrace for a bug report
If you file a bug report in Bugzilla about a crash you should include a stacktrace (call stack) in your report. A stacktrace will tell Mozilla developers what crashed and provide a starting point for investigating its cause. This article describes how to use the Mozilla Crash Reporter (Breakpad) to get a crash ID, which our engineers can use to get a stacktrace, and alternative ways to get a stacktrace if you can't get a crash ID.
How to get a stacktrace with WinDbg
Sometimes you need to get a stacktrace (call stack) for a crash or hang but Talkback or Breakpad fail because it's a special crasher or a hang. This article describes how to get a stacktrace in those cases with WinDbg on Windows. (To get a stacktrace for Thunderbird or some other product, substitute the product name where ever you see Firefox in this instructions.)
How to implement a custom autocomplete search component
The XUL textbox element supports an autocomplete mechanism that is used to create a textbox with a popup containing a list of possible completions for what the user has started to type. There are actually two autocomplete mechanisms:
How to investigate Disconnect failures
This article will guide you on how to investigate disconnect failures.  An example of such a failure
How to Report a Hung Firefox
Is your Firefox not responding? Or are you regularly seeing the "Firefox is running but is not responding..." dialog? This usually means that something in Firefox is hung. This may be because of a code error within Firefox itself, such as a deadlock or infinite loop, or it may be caused by 3rd-party software such as a Firefox extension, antivirus software, or even malware or a virus on your computer.
HTTP Cache
Httpd.js
IME handling guide
This document explains how Gecko handles IME.
Implementing Download Resuming
This document describes how an embedder or other Gecko/Necko-using application can implement download resuming.
Implementing Pontoon in a Mozilla project
Pontoon is a web-based, What-You-See-Is-What-You-Get (WYSIWYG), localization (l10n) tool. At Mozilla, we currently use Pontoon to localize various Mozilla projects and the Firefox OS app interface, known as Gaia. Pontoon is a very simple and intuitive tool that requires little to no technical skill for localizers to use, which will decrease your time-to-publish for localized versions of your project. Here we'll discuss how you can add Pontoon to your Mozilla project.
Implementing QueryInterface
This document describes the right way to write QueryInterface().
Instantbird
Instantbird is an instant messaging application with close ties to Mozilla. These pages document Instantbird and also provide links to documentation about the Chat Core backend which is also used in Thunderbird.
Integrated Authentication
This entails support for the the Simple and Protected GSS-API Negotiation Mechanism (SPNEGO) internet standard (RFC 2478) to negotiate either Kerberos, NTLM, or other authentication protocols supported by the operating system.
Internationalized Domain Names (IDN) Support in Mozilla Browsers
Netscape 7.1 is the first commercial browser that has built-in support for Internationalized Domain Name under the new IETF RFC's established in 2003.
IPC Protocol Definition Language (IPDL)
IPDL, short for "IPC (Inter-process communication) Protocol Definition Language", is a Mozilla-specific language allowing C++ code to pass messages between processes or threads in an organized and secure way. All messages for multi-process plugins and tabs in Firefox are declared in the IPDL language.
JavaScript code modules
JavaScript code modules let multiple privileged JavaScript scopes share code. For example, a module could be used by Firefox itself as well as by extensions, in order to avoid code duplication.
JavaScript libraries from Mozilla projects
In addition to Firefox and other applications, Mozilla developers have created a number of useful JavaScript libraries you can use in your projects. Documentation for these libraries can be found here.
js-ctypes
js-ctypes allows application and extension code to call back and forth to native code written in C. C++ support is possible through vtable pointers see Using COM from js-ctypes. For a discussion on extended C++ support see bug 505907. Other work made possible by js-ctypes is JNI, this is elaborated on in the JNI.jsm section and not the js-ctypes section due to the JSM abstracting away all of the js-ctypes. Unlike binary XPCOM components, it allows developers to ship a single binary for use with multiple versions of Firefox.
Localization at Mozilla
Localization (L10n) is the process of translating software user interfaces from one language to another and adapting it to suit a foreign culture. These resources are for anyone with an interest in the technical aspects involved in localization.
Mercurial
Mobile
Firefox OS is an open source mobile operating system which uses Linux and Mozilla's Gecko engine to run a user interface and set of applications written entirely in HTML, CSS and JavaScript.
Mozilla Development Strategies
This article offers some strategies and suggestions to help developers stay productive.
Mozilla Development Tools
This page lists the various development tools that we operate and/or maintain here at mozilla.org. Naturally, source code for all of these tools is also available. The tools needed to build Mozilla are described on the build page for your platform.
Mozilla DOM Hacking Guide
Mozilla gives you the opportunity not only to use very powerful and complete DOM support, but also to work on a world-class implementation of one of the greatest Internet technologies ever created.
Mozilla external string guide
The Mozilla codebase used to have a notion of "external" strings, which were the string classes visible to code outside of the Mozilla codebase (Extensions, XULRunner applications, and embedders). These classes were removed a long time ago. The only remaining string classes are the "internal" ones, which are documented here.
Mozilla Framework Based on Templates (MFBT)
The Mozilla Framework Based on Templates ("mfbt") is the central repository for macros, functions, and data structures used throughout Mozilla code, including in the JavaScript engine.
Mozilla MathML Project
The Mozilla MathML project is Mozilla's project to build and enhance MathML support within Firefox and other Mozilla-based applications. For a quick overview, see the slides for the innovation fairs at Mozilla Summit 2013.
Mozilla Port Blocking
On 08/15/2001, Cert issued a Vulnerability Note VU#476267 for a "Cross-Protocol" scripting attack, known as the HTML Form Protocol Attack which allowed sending arbitrary data to most TCP ports. A simple exploit of this hole allows an attacker to send forged unsigned mail through a mail server behind your firewall: A really nasty hole.
Mozilla project presentations
This article provides links to presentations covering various aspects of the Mozilla project.
Mozilla projects on GitHub
Although Mozilla's major, core projects are located on the Mozilla Mercurial server, such as mozilla-central, there are a number of tools, services, and so forth whose code is hosted on GitHub. This article offers a quick guide to getting started with Mozilla code on GitHub as well as a list of many of the most interesting GitHub repositories containing Mozilla project code.
Mozilla Quirks Mode Behavior
The following is a rough  list of the differences that exist between Mozilla's standards mode and quirks mode behavior.
Mozilla Style System
The Style System is the module of Mozilla's code responsible for the loading and parsing of CSS style sheets, and the computation of computed values for all CSS properties. The handling of those computed values is the responsibility of other parts of the code.
Mozilla Style System Documentation
See also the style techtalk for more complete although less detailed documentation.
Mozilla SVG Project
Since you have come this far, you probably already know that SVG stands for Scalable Vector Graphics, and that it is an XML language for sophisticated 2-dimensional graphics. SVG is to graphics what XHTML is to text, MathML is to mathematical equations and CML is to the description of chemical molecules.
Mozilla technologies
Mozilla has several technologies used as components of its projects. These are documented here.
Mozilla Web Developer Community
Technical review completed.
Mozilla Web Developer FAQ
This document answers questions that Web authors ask frequently specifically in connection with Firefox and other Gecko-based browsers. There are links to more general Web authoring FAQs at the end of this document.
Mozilla Web Services Security Model
Namespace
Below, find links to articles about C++ classes Mozilla uses within various namespaces, primarily the mozilla namespace.
omni.ja (formerly omni.jar)
Firefox and Thunderbird achieve performance improvements by moving many of their internal parts from being standalone files or sets of JAR files into just one JAR file called omni.ja; this reduces the amount of I/O needed to load the application.  This article covers the contents of the archive and techniques for inspecting those contents.
Performance
The articles linked to from here will help you improve performance, whether you're developing core Mozilla code or an add-on.
Preferences
The preference system makes it possible to store data for Mozilla applications using a key/value pairing system. These articles provide information about how to use the preference system.
Productization guide
Productization is the choice of ''default'' search engines, content and protocol handlers, bookmarks, links to recommended sites on the in-product pages, etc. The web services that make up the productization of Mozilla software are often specific to a local market. For example, a search provider can deliver a very good quality of search results — but only in a specific country or language, and we have to take this into account when considering default search engines for a locale. Hence there is a need to customize the set of default web services on a per-locale basis in order to ensure a good user experience across all locales.
Profile Manager
Firefox and other XULRunner applications store user settings and data in special folders, called profiles.    Firefox provides a built-in applet to manage these profiles, but it will eventually be going away (see bug 214675), so a new standalone Profile Manager application has been created, which works with any XULRunner application, and has many features not found in Firefox's built-in version.
Projects
Here you'll find links to documentation about various Mozilla projects; these are often parts of Firefox or other products, but may also be used in other projects as well.
QA: Quality assurance at Mozilla
Here you'll find articles and tools to help you gear up to join the QA team testing Firefox to ensure that each release is as good as it can be.
Redis Tips
This document is a collection of some examples and tips for using redis, the open-source data structure server.  It is intended primarily for developers, and deliberately omits some topics that will be important in any redis deployment, like security and backups.
SeaMonkey
SeaMonkey is Mozilla's all in one internet suite. These pages document SeaMonkey's MailNews component and also provide links to documentation about the MailNews backend which is also used in other projects such as Eudora/Penelope, Thunderbird, Correo, etc.
Setting up an update server
The goal of this document is to provide basic instructions on setting up your own update server.
Signing Mozilla apps for Mac OS X
Technical review completed.
Task graph
After a change to the Gecko source code is pushed to version-control, jobs for that change appear on Treeherder. How does this work?
Testing Mozilla code
Testing your code is important! Before you can even get your code committed into the source tree, you have to test it, and larger patches have to have automated tests. These articles will help you master (and continue to excel at) testing Mozilla code.
The Mozilla platform
The Mozilla project encompasses several technologies that, together, comprise the Mozilla platform. These links will direct you to documentation about each of these, as well as how to use the Mozilla platform to build your own projects.
The Rust programming language
Rust is a new open-source systems programming language created by Mozilla and a community of volunteers, designed to help developers create fast, secure applications which take full advantage of the powerful features of modern multi-core processors. It prevents segmentation faults and guarantees thread safety, all with an easy-to-learn syntax.
Thunderbird
Thunderbird is Mozilla's mail/messaging application. These pages document Thunderbird and also provide links to documentation about the MailNews backend which is also used in other projects such as Eudora/Penelope, Seamonkey, Correo, etc.
Using Mozilla code in other projects
There are several ways you can use Mozilla code in your own project.
Using popup notifications
Popup notifications, also known as "doorhanger notifications", are presented to notify the user of something that's important but may not need immediate attention. These non-modal notifications let the user make decisions when they have a moment to do so, instead of being forced to deal with them at possibly inconvenient times. For example, this popup notification is displayed when a web site requests geolocation information:
Using RAII classes in Mozilla
RAII classes are useful when two operations (e.g., Lock/Unlock, AddRef/Release, PushState/PopState) must be paired.
Using tab-modal prompts
Prior to Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1), prompts (that is, alerts and other modal prompts) were window modal. That is, when an alert occurred, it blocked the user interface on all tabs in the window until the user dismissed the prompt.
Using the Mozilla source server
Using the Mozilla source server is now even more feature-packed. The nightly debug builds are now also Source Indexed so that by following a couple of simple steps you can also have the source code served to you for debugging without a local build
Using the Mozilla symbol server
The Mozilla project runs a symbol server for trunk Firefox nightly and release builds on Windows. Symbols are available for at least 30 previous days worth of nightly builds, and Firefox releases from 2.0.0.4. This allows debugging of those builds without forcing all users to download large debugging files. The server functions like Microsoft's symbol server so the documentation there can be useful.
WebIDL bindings
The WebIDL bindings are generated at build time based on two things: the actual WebIDL file and a configuration file that lists some metadata about how the WebIDL should be reflected into Gecko-internal code.
XMLHttpRequest changes for Gecko1.8
This document describes some of the changes that have been made to Gecko's XMLHttpRequest implementation since version 1.7 (i.e., the version of Gecko that shipped with Firefox 1.0). These changes only apply to XUL extensions and XUL applications. They do not apply to web applications.
XPI
Cross-Platform Installer Module (XPI) is a ZIP file used to install packages, utilizing the XPInstall technology. XPI modules (so called "Bundles") are employed to install a wide variety of software, including Plugins, Extensions, Themes, and Thunderbird dictionaries.
XPIDL
XPIDL is an Interface Description Language used to specify XPCOM interface classes.
Zombie compartments
This page tells you how to detect and avoid zombie compartments, which are a particular kind of memory leak.  They can be caused by bugs in Firefox itself, or by bugs in Firefox add-ons.

Document Tags and Contributors

 Last updated by: alispivak,