Firefox Source Code Directory Structure¶
This article provides an overview of what the various directories contain.
To simply take a look at the Firefox source code, you do not need to download it. You can look at the source directly with your web browser using Searchfox (start at https://searchfox.org/mozilla-central/source for the complete firefox source code of branch HEAD).
This document describes the directory structure – i.e., directories that are used by at least some of the Mozilla project’s client products. There are other directories in the other Mozilla repository, such as those for Web tools and those for the Classic codebase.
Configuration files used by the Visual Studio Code IDE when working in the mozilla-central tree.
Files for accessibility (i.e., MSAA (Microsoft Active Accessibility), ATK (Accessibility Toolkit, used by GTK+ 2) support files). See Accessibility.
Contains images and CSS files to skin the browser for each OS (Linux, Mac and Windows)
Capability-based web page security management. It contains C++ interfaces and code for determining the capabilities of content based on the security settings or certificates (e.g., VeriSign). See Component Security .
More files used by the build process, common includes for the makefiles, etc.
Contains the documentation configuration (Sphinx based), the index page and the contribution pages.
Implementation of the docshell, the main object managing things related to a document window. Each frame has its own docshell. It contains methods for loading URIs, managing URI content listeners, etc. It is the outermost layer of the embedding API used to embed a Gecko browser into an application.
Contains several extensions to mozilla, which can be enabled at
compile-time using the
--enable-extensions configure argument.
Note that some of these are now built specially and not using the
--enable-extensions option. For example, disabling xmlextras is done
Implementation of the negotiate auth method for HTTP and other protocols. Has code for SSPI, GSSAPI, etc. See Integrated Authentication.
Spellchecker for mailnews and composer.
Detects the character encoding of text.
Contains interfaces that abstract the capabilities of platform specific graphics toolkits, along with implementations on various platforms. These interfaces provide methods for things like drawing images, text, and basic shapes. It also contains basic data structures such as points and rectangles used here and in other parts of Mozilla.
Containing files related to a Java build system.
Contains platform specified functions (e.g. obtaining battery status, sensor information, memory information, Android alarms/vibrate/notifications/orientation, etc)
Image rendering library. Contains decoders for the image formats Firefox supports.
Code related to determination of locale information from the operating environment.
Code related to line breaking and word breaking.
Code related to string resources used for localization.
Code that converts (both ways: encoders and decoders) between UTF-16 and many other character encodings.
Code related to implementation of various algorithms for Unicode text, such as case conversion.
Container for implementations of IPC (Inter-Process Communication).
Code that implements a tree of rendering objects that describe the types and locations of the objects that are displayed on the screen (such as CSS boxes, tables, form controls, XUL boxes, etc.), and code that manages operations over that rendering tree (such as creating and destroying it, doing layout, painting, and event handling). See documentation and other information.
Code that deals with the rendering tree.
Rendering tree objects for HTML form controls.
The basic rendering object interface and the rendering tree objects for basic CSS boxes.
Rendering tree objects for CSS/HTML tables.
Additional rendering object interfaces for XUL and the rendering tree objects for XUL boxes.
Contains sources of used media libraries for example libpng.
Cross-platform wrappers for memallocs functions etc.
Firefox for Android and Geckoview
Compression/Archiving, math library, font (and font compression), Preferences Library
Code to read zip files, used for reading the .jar files that contain the files for the mozilla frontend.
Library for reading and writing preferences.
Source code of zlib, used at least in the networking library for compressed transfers.
Glue library containing various low-level functionality, including a dynamic linker for Android, a DLL block list for Windows, etc.
Networking library, also known as Necko. Responsible for doing actual transfers from and to servers, as well as for URI handling and related stuff.
Netscape Portable Runtime. Used as an abstraction layer to things like threads, file I/O, and socket I/O. See NSPR.
Mostly unused; might be used on Mac?
Contains libraries that are not covered by the MPL but are used in some Firefox code.
Group of structures and functions needed to parse files based on XML/HTML.
Copy of the expat source code, which is the XML parser used by mozilla.
The legacy HTML parser that’s still used for about:blank. Parts of it are also used for managing the conversion of the network bytestream into Unicode in the XML parsing case.
The code for integrating expat (from parser/expat) into Gecko.
Cross module python code.
Firefox accounts and sync (history, preferences, tabs, bookmarks, telemetry, startup time, which addons are installed, etc). See here.
XXX this needs a description.
Scripts and code to automatically build and test Mozilla trees for the continuous integration and release process.
Common testing tools for mozilla codebase projects, test suite definitions for automated test runs, tests that don’t fit anywhere else, and other fun stuff.
Vendored dependencies maintained outside of Mozilla.
The “new toolkit” used by Thunderbird, Firefox, etc. This contains numerous front-end components shared between applications as well as most of the XBL-implemented parts of the XUL language (most of which was originally forked from versions in xpfe/).
The installer, which contains code for installing Mozilla and for installing XPIs/extensions. This directory also contains code needed to build installer packages. See XPInstall and the XPInstall project page.
Some tools which are optionally built during the mozilla build process.
Content dispatch in Mozilla. Used to load uris and find an appropriate content listener for the data. Also manages web progress notifications. See Document Loading: From Load Start to Finding a Handler and The Life Of An HTML HTTP Request.
Used to handle content that Mozilla can’t handle itself. Responsible for showing the helper app dialog, and generally for finding information about helper applications.
Service to prefetch documents in order to have them cached for faster loading.
View manager. Contains cross-platform code used for painting, scrolling, event handling, z-ordering, and opacity. Soon to become obsolete, gradually.
A cross-platform API, with implementations on each platform, for dealing with operating system/environment widgets, i.e., code related to creation and handling of windows, popups, and other native widgets and to converting the system’s messages related to painting and events into the messages used by other parts of Mozilla (e.g., view/ and content/, the latter of which converts many of the messages to yet another API, the DOM event API).
XPFE (Cross Platform Front End) is the SeaMonkey frontend. It contains the XUL files for the browser interface, common files used by the other parts of the mozilla suite, and the XBL files for the parts of the XUL language that are implemented in XBL. Much of this code has been copied to browser/ and toolkit/ for use in Firefox, Thunderbird, etc.
Components used by the Mozilla frontend, as well as implementations of interfaces that other parts of mozilla expect.