Skip to content

Instantly share code, notes, and snippets.

@paulrouget
Last active November 21, 2021 21:13
Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save paulrouget/11294094 to your computer and use it in GitHub Desktop.
Save paulrouget/11294094 to your computer and use it in GitHub Desktop.
Hacking Firefox

More details here: https://developer.mozilla.org/en/docs/Simple_Firefox_build

Hacking Firefox

Get Firefox' source code:

git clone https://github.com/mozilla/gecko-dev.git
git checkout fx-team

Install dependencies:

./mach bootstrap
# doesn't work on Windows. See link above.

On osx (not needed for other platforms), create a mozconfig file in the source directory, with the following:

# adding .noindex will make sure spotlight
# won't index the objdir (slow).
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj.firefox.noindex

# Needed for osx 10.9 (fix a font issue):
ac_add_options --with-macos-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

Run the following in the dir

./mach build

Wait a while...

./mach run -P dev

Firefox (frontend & devtools) code is located in:

browser/base/content
browser/themes
browser/devtools

Generate a patch:

In your ~/.gitconfig, add:

  [alias]
  hgp = "show --binary --format=\"# HG changeset patch%n# User %an <%ae>%n%B\" -U8"

Then:

git hgp HEAD > myFix.patch
# you can attach this patch to a bugzilla bug

Updated with changes? Run the following

./mach build browser
./mach run -P dev -jsconsole

Running tests for the entire suite

./mach mochitest-devtools browser/devtools

Running tests for a particular patch

./mach mochitest-devtools browser/devtools/path/to/the/test_you_want_to_run.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment