Firefox Source Code Directory Structure — Firefox Source Docs documentation
Working on Firefox Firefox Source Code Directory Structure Report an issue / View page source 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/firefox-main/source for the complete firefox source code of branch HEAD).
In order to modify the source, you have to acquire it either by downloading a snapshot of the sources or by checking out the current sources from the repository . 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.
See the more detailed overview of the pieces of Gecko . .cargo Configuration files for the Cargo package manager . .vscode Configuration files used by the Visual Studio Code IDE when working in the Firefox source tree. accessible Files for accessibility (i.e., MSAA (Microsoft Active Accessibility), ATK (Accessibility Toolkit, used by GTK) support files). See Accessibility . browser Contains the front end code (in XUL, Javascript, XBL, and C++) for the Firefox desktop browser.
Many of these files started off as a copy of files in xpfe . browser/extensions Contains PDF.js and WebCompat built-in extensions. browser/themes Contains images and CSS files to skin the browser for each OS (Linux, Mac and Windows) build Miscellaneous files used by the build process. See also config . caps 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 . chrome Chrome registry used with toolkit /. These files were originally copies of files in rdf/chrome/ . config More files used by the build process, common includes for the makefiles, etc. devtools The Firefox Developer Tools server and client components. See contributor and user documentation. docs Contains the documentation configuration ( Sphinx based), the index page and the contribution pages. docshell 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. dom IDL definitions of the interfaces defined by the DOM specifications and Mozilla extensions to those interfaces (implementations of these interfaces are primarily, but not completely, in content). The parts of the connection between JavaScript and the implementations of DOM objects that are specific both to JavaScript and to the DOM.
Implementations of a few of the core “DOM Level 0” objects, such as window , window.navigator , window.location , etc. editor The editor directory contains XUL/Javascript for the embeddable editor component, which is used for the HTML Editor(“Composer”), for plain and HTML mail composition, and for text fields and text areas throughout the product. The editor is designed like a “browser window with editing features”: it adds some special classes for editing text and managing transaction undo/redo, but reuses browser code for nearly everything else. extensions 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 using --disable-xmlextras . extensions/auth Implementation of the negotiate auth method for HTTP and other protocols. Has code for SSPI, GSSAPI, etc. See Integrated Authentication . extensions/pref Preference-related extensions. extensions/spellcheck Spellchecker for mailnews and composer. extensions/universalchardet Detects the character encoding of text. gfx 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. gradle Containing files related to a Java build system. hal Contains platform specified functions (e.g. obtaining battery status, sensor information, memory information, Android alarms/vibrate/notifications/orientation, etc) image Image rendering library.
Contains decoders for the image formats Firefox supports. intl Internationalization and localization support. See L10n:NewProjects . intl/locale Code related to determination of locale information from the operating environment. intl/lwbrk Code related to line breaking and word breaking. intl/strres Code related to string resources used for localization. intl/uconv Code that converts (both ways: encoders and decoders) between UTF-16 and many other character encodings. intl/unicharutil Code related to implementation of various algorithms for Unicode text, such as case conversion. ipc Container for implementations of IPC (Inter-Process Communication). js/src The JavaScript engine, also known as SpiderMonkey .
See also JavaScript . js/xpconnect Support code for calling JavaScript code from C++ code and C++ code from JavaScript code, using XPCOM interfaces. See XPConnect . layout 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 . layout/base Code that deals with the rendering tree. layout/forms Rendering tree objects for HTML form controls. layout/generic The basic rendering object interface and the rendering tree objects for basic CSS boxes. layout/mathml Rendering tree objects for MathML . layout/svg Rendering tree objects for SVG . layout/tables Rendering tree objects for CSS/HTML tables. layout/xul Additional rendering object interfaces for XUL and the rendering tree objects for XUL boxes. media Contains sources of used media libraries for example libpng . memory Cross-platform wrappers for memallocs functions etc. mfbt Implementations of classes like WeakPtr .
Multi-platform assertions etc. mobile mobile/android Firefox for Android and Geckoview modules Compression/Archiving, math library, font (and font compression), Preferences Library modules/libjar Code to read zip files, used for reading the .jar files that contain the files for the mozilla frontend. modules/libpref Library for reading and writing preferences. modules/zlib Source code of zlib, used at least in the networking library for compressed transfers. mozglue Glue library containing various low-level functionality, including a dynamic linker for Android, a DLL block list for Windows, etc. netwerk Networking library , also known as Necko.
Responsible for doing actual transfers from and to servers, as well as for URI handling and related stuff. netwerk/cookie Permissions backend for cookies, images, etc., as well as the user interface to these permissions and other cookie features. nsprpub Netscape Portable Runtime. Used as an abstraction layer to things like threads, file I/O, and socket I/O. See NSPR . nsprpub/lib Mostly unused; might be used on Mac? other-licenses Contains
The rest of this page is on the live site.