Firefox Nightly in Visual Studio

Building Firefox nightly

The Mozilla’s documentation about compiling Firefox is pretty straightforward. On Windows, you basically need just

  1. Build prerequisities which mostly means some Visual Studio edition + MozillaBuild package.
  2. Second step is just to go to extracted MozillaBuild package folder and start apropriate command prompt (bash + some paths).
  3. In this new command window, get sources using hg (Mercurial client, which is part of MozillaBuild package & paths).
  4. Set to some folder where you would like to deploy Firefox sources and start hg. The command is:

    hg clone

  5. start the build in using:
    ./mach build
  6. Start the built Firefox, using
    ./mach run

Using Firefox nightly from Visual Studio

Now you should have Firefox running, built by the Mozilla scripts. There is no way how to build everything in Visual Studio, but you can open the browser in that and debug it. Its limited to just browser itself and some internal libraries are not included, for example NSS (library serving the work with HTTPS). To generate the Visual Studio project you need to return to your MozillaBuild prompt, (you should sill be in your mozilla sources folder) and enter:

./mach build-backend -b VisualStudio

after this command, you will get a .sln file generated in your Firefox sources folder under


You can open this in Visual Studio (2013 in my case) without a problem.

Enable logging of LOG messages

When you will be looking at code you will find, that there is a pretty amount of log messages being logged using LOG or LOG3 macros. These are actually logging if you enable logging for your module. If you want to log everything, just set these Windows variables before starting new firefox.exe:
set NSPR_LOG_FILE=%TEMP%\fflog.txt

Then the log file is generated under %TEMP%\fflog.txt. To open just use

notepad.exe %TEMP%\fflog.txt

Debugging Firefox in Visual Studio

Its actually not a big deal, just attach your Visual Studio to running firefox.exe and set a breakpoint and you are good to go.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s