mozilla/gecko-dev
Development workflow
The day-to-day workflow for landing changes in mozilla-central (mirrored here as gecko-dev).
Branching
There is no per-feature branching in mozilla-central. All work happens against the tip of central. Long-running work happens on personal user repos, project branches (e.g., try, autoland), or experimental branches that are eventually rebased onto central. The integration branch autoland is where Lando first lands patches; sheriffs merge autoland → central periodically.
A typical change
Pull the latest tip.
hg pull -u # Mercurial # or git pull --rebase # GitMake a feature branch (Git only). In hg you typically commit on top of tip and use bookmarks; with Git you can branch normally.
Edit code. Use
./mach build fasterfor JS/CSS/manifest-only changes; use./mach build <path>to incrementally rebuild a subdir.Run targeted tests.
./mach test path/to/file_to_test ./mach mochitest browser/components/.../test_foo.js ./mach gtest 'GtestName.*' ./mach wpt path/to/wpt/testLint.
./mach lint --outgoing ./mach clang-format --outgoing ./mach eslint --fix path/to/dirPush to try (optional but encouraged for non-trivial changes).
./mach try fuzzy # or for a default selector ./mach try autoTry runs the same tests CI would, but on your unfinished branch. Read the results on Treeherder.
Submit to Phabricator.
moz-phab submitmoz-phabreads your local commit(s), creates one Phabricator revision per commit, and links them in a stack. Each commit must have aBug NNNNNN - descriptionfirst line.Address review. Update commits in place (
hg commit --amendorgit commit --amend/git rebase -i), thenmoz-phab submitagain.Land. Once reviewers mark the stack Accepted, click "Land" in Phabricator. Lando picks up the request, rebases onto
autoland, and lands the patch. The change appears ingecko-devshortly after.
Build modes
./mach build— full build (C++, Rust, JS chrome, packaging)../mach build faster— skip native compilation; rebuild only chrome/JS/CSS. Fast, useful for chrome work../mach build <subdir>— incremental build of one piece (./mach build dom/etc.)../mach configure— re-run configure if.mozconfigchanged../mach clobber—rm -rfthe objdir.
.mozconfig patterns
A debug build:
ac_add_options --enable-debug
ac_add_options --disable-optimize
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-debugAn optimized build with debug symbols:
ac_add_options --enable-release
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-optMany specialized configs ship under build/ (e.g., build/mozconfig.common.override, the artifact build configs).
Artifact builds
For UI/JS-only contributors, you can use prebuilt platform binaries:
ac_add_options --enable-artifact-buildsThis downloads a recent Nightly's compiled C++/Rust and only builds the JS/CSS/chrome layer. Drastically faster.
Mach commands cheat sheet
./mach help # list everything
./mach search <symbol> # source search via Searchfox-like local index
./mach run # launch the build
./mach run --debugger=lldb # run under a debugger
./mach try # push to try
./mach lint --outgoing # lint only changed files
./mach python <path> # run a tree script with PYTHONPATH set up
./mach awsy-test # AWSY memory tests
./mach raptor # browser-level perf tests
./mach talos # Talos perf
./mach build-backend # regenerate Makefiles after moz.build editsRebasing on a moving tree
mozilla-central moves fast — often hundreds of commits per day. Long-running patches need frequent rebasing. The recommended pattern is a small stack of commits, regularly rebased.
Backouts
If your change regresses tests or performance, sheriffs may back it out. Don't take it personally: it's standard procedure. Backouts get their own commit messages: Backed out changeset XXXXXX (bug NNNNNN) for reason on a CLOSED TREE.
Adding a new file
When you create new source files, you usually must reference them in a moz.build next to them (or its parent). The build will fail if a .cpp is added but not listed in UNIFIED_SOURCES. See tooling and patterns and conventions.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.