Mozilla Source Code Directory Structure

In This Article
    1. .cargo
    2. .vscode
    3. accessible
    4. addon-sdk
    5. browser
      1. browser/extensions
      2. browser/themes
    6. build
    7. caps
    8. chrome
    9. config
    10. db
      1. db/sqlite3
    11. devtools
    12. docshell
    13. dom
    14. editor
    15. embedding
    16. extensions
      1. extensions/auth
      2. extensions/cookie
      3. extensions/permissions
      4. extensions/pref
      5. extensions/spellcheck
      6. extensions/universalchardet
    17. gfx
    18. gradle
    19. hal
    20. image
    21. intl
      1. intl/chardet
      2. intl/locale
      3. intl/lwbrk
      4. intl/strres
      5. intl/uconv
      6. intl/unicharutil
    22. ipc
    23. js
      1. js/src
      2. js/jsd
      3. js/xpconnect
    24. layout
      1. layout/base
      2. layout/forms
      3. layout/generic
      4. layout/mathml
      5. layout/svg
      6. layout/tables
      7. layout/xul
    25. media
    26. memory
    27. mfbt
    28. mobile
      1. mobile/android
    29. modules
      1. modules/libjar
      2. modules/libpref
      3. modules/zlib
    30. mozglue
    31. netwerk
    32. nsprpub
      1. nsprpub/lib
    33. other-licenses
    34. parser
      1. parser/expat
      2. parser/html
      3. parser/htmlparser
      4. parser/xml
    35. probes
    36. python
      1. python/mach
    37. rdf
    38. security
    39. services
    40. servo
    41. startupcache
    42. storage
    43. taskcluster
    44. testing
    45. third_party
    46. toolkit
      1. toolkit/mozapps/extensions/test/xpinstall
    47. tools
    48. uriloader
      1. uriloader/base
      2. uriloader/exthandler
      3. uriloader/prefetch
    49. view
    50. widget
    51. xpcom
    52. xpfe
      1. xpfe/components
  1. Moved/Renamed/Deleted Directories
    1. b2g
    2. content
    3. extensions
      1. extensions/content-packs
      2. extensions/cview
      3. extensions/datetime
      4. extensions/finger
      5. extensions/gnomevfs
      6. extensions/help
      7. extensions/irc
      8. extensions/java
      9. extensions/layout-debug
      10. extensions/lightning
      11. extensions/mono
      12. extensions/p3p
      13. extensions/python
      14. extensions/reporter
      15. extension/schema-validation
      16. extension/spatialnavigation
      17. extensions/sql
      18. extensions/sroaming
      19. extensions/transformiix
      20. extensions/tridentprofile
      21. extensions/typeaheadfind
      22. extensions/universalchardet
      23. extensions/venkman
      24. extensions/wallet
      25. extensions/webdav
      26. extensions/webservices
      27. extensions/xforms
      28. extensions/xmlextras
      29. extensions/xml-rpc
      30. extensions/xmlterm
    4. intl
      1. intl/ctl
    5. profile
    6. xulrunner

Sections of this document may be out of date. In some cases, code mentioned below has been moved to a new location or removed from mozilla-central entirely. Code search tools such as DXR or searchfox are the best way to explore the Mozilla source code.

The code for all projects in the Mozilla family (such as Firefox, Thunderbird, etc.) is combined into a single source tree. The tree contains the source code as well as the code required to build each project on supported platforms (Linux, Windows, macOS, etc). This article provides an overview of what the various directories contain.

To simply take a look at the Mozilla source code, you do not need to download it. You can look at the source directly with your web browser using DXR (start at for the complete mozilla 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 Mercurial.

This document describes the directory structure that can be pulled by -- i.e., directories that are used by at least some of the Mozilla project's client products. There are other directories in the Mozilla CVS repository, such as those for Web tools and those for the Classic codebase.

See source code directories overview for a somewhat different (older) version of the same information. Also see the more detailed overview of the pieces of Gecko.


Configuration files for the Cargo package manager.


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.


The add-on SDK for creating Firefox add-ons using standard Web Technologies.


Contains the front end code (in XUL, Javascript, XBL, and C++) for the Firefox browser. Many of these files started off as a copy of files in xpfe/.


Contains PDF.js and Shumway built-in extensions.


Contains images and CSS files to skin the browser for each OS (Linux, Mac and Windows)


Miscellaneous files used by the build process. See also config/.


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 registry (See here) used with toolkit/. These files were originally copies of files in rdf/chrome/ (SeaMonkey still uses these).


More files used by the build process, common includes for the makefiles, etc. See also build/.


Container for database-accessing modules.


The SQLite database, used by storage.


The Firefox Developer Tools server and client components.


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.


  • 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. (The parts that are not DOM-specific, i.e., the generic binding between XPCOM and JavaScript, live in js/src/xpconnect/.)
  • Implementations of a few of the core "DOM Level 0" objects, such as window, window.navigator, window.location, etc.


The editor directory contains C++ interfaces, C++ code, and 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.


  • The backend for HTML and text editing. This is not only used for the mail composer and the page editor composer, but also for rich text editing inside webpages. Textarea and input fields are using such an editor as well (in the plaintext variant). See Mozilla Editor.
  • The frontend for the HTML editor that is part of SeaMonkey.


This directory contains IDL, headers, and support files needed in order to embed Gecko in applications.

See also: Embedding Mozilla.


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.


Implementation of the negotiate auth method for HTTP and other protocols. Has code for SSPI, GSSAPI, etc. See Integrated Authentication.


Permissions backend for cookies, images, etc., as well as the user interface to these permissions and other cookie features.




Preference-related extensions.


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.

It is also the home of the new graphics architecture based on cairo (via a C++ wrapper called thebes). See NewGFXAPIs and GFXEvolution.


Containing files related to a JVM (Java Virtual Machine) 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 mozilla supports.


Internationalization and localization support. See L10n:NewProjects.


Code for "sniffing" the character encoding of Web pages.


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).



The JavaScript engine, also known as SpiderMonkey. See also JavaScript.


JavaScript debugging library. See JavaScript Debugging.


Support code for calling JavaScript code from C++ code and C++ code from JavaScript code, using XPCOM interfaces. See XPConnect.


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 MathML.


Rendering tree objects for SVG.


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.


Implementations of classes like WeakPtr. Multi-platform assertions etc. More on MFBT



Firefox for Android


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. See also Network library documentation.


Netscape Portable Runtime. Used as an abstraction layer to things like threads, file I/O, and socket I/O. See Netscape Portable Runtime.


Mostly unused; might be used on Mac?


Contains libraries that are not covered by the MPL but are used in some mozilla 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 HTML parser (for everything except about:blank).


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.


Files related to dtrace.


Cross module python code.


The code for the Mach building tool.


RDF handling APIs. See RDF and RDFAlso contains the chrome registry code used by SeaMonkey, although toolkit apps (such as Firefox and Thunderbird) use the copy forked into chrome.


Contains NSS and PSM, to support cryptographic functions in mozilla (like S/MIME, SSL, etc). See Network Security Services (NSS) and Personal Security Manager (PSM).


Firefox accounts and sync (history, preferences, tabs, bookmarks, telemetry, startup time, which addons are installed, etc). See here.


Servo, the parallel browser engine project.


XXX this needs a description.


Storage: XPCOM wrapper for sqlite. Wants to unify storage of all profile-related data. Supersedes mork. See also Unified Storage.


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, mostly used for debugging.


XXX this needs a description.


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).


Cross-Platform Component Object Model. Also contains data structures used by the rest of the mozilla code. See also XPCOM Project.


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.

Moved/Renamed/Deleted Directories


Source code for the Boot2Gecko project used when building FirefoxOS.


The data structures that represent the structure of Web pages (HTML, SVG, XML documents, elements, text nodes, etc.) These objects contain the implementation of many DOM interfaces and also implement some behaviors associated with those objects, such as link handling, form control behavior, and form submission.

This directory also contains the code for XUL, XBL, XTF, <canvas>, as well as the code implementing XSLT and event handling.



Content- and locale-pack switching user interface.


Component viewer, which allows to view the currently registered components and interfaces.


Support for the datetime protocol.


Support for the finger protocol.


Interface to gnome-vfs to allow using all protocols supported by gnome-vfs inside of mozilla.


Help viewer and help content. See Mozilla Help Viewer Project.


This is ChatZilla, the IRC (Internet Relay Chat) component. See ChatZilla.


XPCOM<->Java bridge ("JavaXPCOM", formerly known as Javaconnect). Unrelated to the code in java/.


Layout debugger. Intended as replacement for "viewer". Can be used to run layout regression tests and has support for other layout debugging features.


The Lightning project, "an extension to tightly integrate calendar functionality (scheduling, tasks, etc.) into Thunderbird." See Lightning.


A two-way bridge between the CLR/.NET/Mono/C#/etc. world and XPCOM.


Implementation of W3C's Platform for Privacy Preferences standard. See Platform for Privacy Preferences (P3P).


Support for implementing XPCOM components in python. See PyXPCOM.


An extension to report problems with web pages. Client-side part. See Mozilla Reporter.


Allows to validate XML trees according to specified XML Schemas.


Spatial navigation, navigating between links of a document according to their on-screen position. See Spatial Navigation.


Support for accessing SQL databases from XUL applications. See SQL Support in Mozilla.


Session roaming, i.e. support for storing a profile on a remote server.


XSLT support. XSL Transformations is a language used to transform XML documents into other XML documents. See XSL Transformations.


Support for importing profiles from MSIE.


Find As You Type allows quick web page navigation when you type a succession of characters in the body of the displayed page. See Find As You Type.


Universal character set detector.


The JavaScript Debugger.


Password and Form Manager.


WebDAV code; exposes special APIs for accessing WebDAV servers. Used by the Calendar project.


Support for Webservices. See Web Services.


Code for the XForms extension. See XForms.


Several XML-related extensions. See XML Extras.


XML Remote Procedure Calls. Unowned these days. See XML-RPC in Mozilla.


XMLTerm, a terminal implemented using mozilla technology. Only available on GTK builds.



Code for dealing with Complex Text Layout, related to shaping of south Asian languages (not built by default, needs --enable-ctl).


Code for profile handling, the profile manager backend and frontend.


Code for XULRunner. See also XULRunner.