mozilla/gecko-dev
Architecture
Firefox is a multi-process browser built on the Gecko rendering engine, the SpiderMonkey JavaScript engine, and a custom IPC framework called IPDL. This page describes the process model, the layered structure of the source tree, and the main data flows that connect them.
Process model
Modern Firefox runs as a tree of cooperating processes. The parent (or "default") process owns the UI, networking, and disk I/O. It launches child processes for tasks that benefit from isolation: rendering web content, decoding media, running GPU work, sandboxing extensions, and more.
graph TD
Parent[Parent process<br/>browser chrome, networking, profile, prefs]
Content1[Content process #1<br/>web pages, JS, layout]
Content2[Content process #2<br/>web pages, JS, layout]
GPU[GPU process<br/>WebRender, compositor]
RDD[RDD process<br/>media decoding]
Socket[Socket process<br/>DNS, HTTP, TLS]
Utility[Utility process<br/>misc sandboxed work]
Extension[Extension process<br/>WebExtensions]
Parent -->|IPDL| Content1
Parent -->|IPDL| Content2
Parent -->|IPDL| GPU
Parent -->|IPDL| RDD
Parent -->|IPDL| Socket
Parent -->|IPDL| Utility
Parent -->|IPDL| Extension
Content1 -->|IPDL| GPU
Content2 -->|IPDL| GPUProcess types and their responsibilities are defined in ipc/glue/GeckoChildProcessHost.cpp and xpcom/build/GeckoProcessTypes.h.
See process model for details on each process kind.
Layered structure
The source tree layers roughly like this, from low to high:
graph BT
MFBT[mfbt/<br/>C++ template library]
MozGlue[mozglue/<br/>early-startup glue]
XPCOM[xpcom/<br/>component framework, threads, refcount]
NSPR[nsprpub/<br/>portable runtime]
IPC[ipc/<br/>IPDL, channels]
JS[js/src<br/>SpiderMonkey]
NSS[security/nss<br/>crypto + TLS]
Network[netwerk/<br/>HTTP, DNS, sockets]
Storage[storage/<br/>SQLite wrapper]
DOM[dom/<br/>WebIDL impls]
GFX[gfx/<br/>graphics + WebRender]
Layout[layout/<br/>CSS layout]
Image[image/<br/>image decoders]
Toolkit[toolkit/<br/>shared widgets, components]
Browser[browser/<br/>desktop UI]
Mobile[mobile/<br/>Android UI]
Devtools[devtools/]
MFBT --> XPCOM
NSPR --> XPCOM
MozGlue --> XPCOM
XPCOM --> IPC
XPCOM --> JS
XPCOM --> Network
XPCOM --> Storage
NSS --> Network
JS --> DOM
Network --> DOM
Storage --> DOM
GFX --> Layout
DOM --> Layout
Image --> Layout
Layout --> Toolkit
Toolkit --> Browser
Toolkit --> Mobile
Browser --> DevtoolsLower layers know nothing about higher layers; the build system enforces this through moz.build rules.
Page rendering data flow
The end-to-end "URL bar to pixels" path:
sequenceDiagram
participant URLBar as Browser UI
participant Docshell as DocShell (parent)
participant Net as netwerk (parent/socket)
participant Content as Content process
participant Layout as Layout (PresShell)
participant GFX as WebRender (GPU)
URLBar->>Docshell: LoadURI
Docshell->>Net: NewChannel + AsyncOpen
Net->>Net: DNS, TCP, TLS, HTTP
Net-->>Content: Document bytes (IPC)
Content->>Content: Parse HTML (parser/html)
Content->>Content: Build DOM (dom/base)
Content->>Content: Style + CSS cascade (servo)
Content->>Layout: Construct frame tree
Layout->>Layout: Reflow + paint
Layout->>GFX: Display list
GFX->>GFX: Build WebRender scene
GFX-->>URLBar: Composited frameKey entry points:
- URL load:
docshell/base/nsDocShell.cpp - HTML parsing:
parser/html/nsHtml5Parser.cpp - Style:
servo/components/style/ - Reflow:
layout/generic/nsIFrame.cpp - WebRender:
gfx/wr/
JavaScript execution
Web content scripts run in content processes, on a per-window/realm basis, inside SpiderMonkey (js/src/). The browser chrome itself (browser/, toolkit/) is also JavaScript, running in system principals in the parent process. The bridge between C++ XPCOM and JS is js/xpconnect/. Modern WebIDL bindings (dom/bindings/) bypass XPConnect for performance.
Build pipeline
graph LR
Configure[mach configure<br/>moz.configure] --> Build[mach build]
Build --> Mozbuild[python/mozbuild<br/>reads moz.build]
Mozbuild --> Backend[backend.mk + Makefiles]
Backend --> Compile[compile<br/>clang/rustc/javac]
Compile --> Link[link]
Link --> Package[mach package]
Key cross-cutting systems
- IPDL — declarative IPC between processes. See systems/ipc-and-ipdl.md.
- Fission — site isolation: every origin gets its own content process. See features/fission.md.
- Sandboxing — per-platform sandboxes for content/GPU/RDD. See security.md.
- Telemetry / Glean — metrics. See features/telemetry-glean.md.
Where to look next
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.