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 https://hg.mozilla.org/mozilla-central

  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

.\obj-i686-pc-mingw32\msvc\mozilla.sln

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
set NSPR_LOG_MODULES=all:5

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.

Testing HTTP 2.0 in a browser

You most probably already know how the good old buddy HTTP works. Its very simple, very straightforward and also very old. After some evolution, started by Google with SPDY, we currently have draft of a IETF standard for v 2.0 of this protocol, called also HTTP/2. All this evolution was driven by the desire to make web page loading faster and eventually to reduce the data amounts downloaded on our phones.

The best way is to try. The http2 Implementations tracking page shows that there is a Microsoft implementation, revealing a HTTP/2 supporting server url at:

https://h2duo.cloudapp.net/

Also, the current Firefox Nightly can be enabled to support this version. The steps to enable Http/2 in it are to open about:config and switch these two to true:

  • network.http.spdy.enabled.http2draft
  • security.ssl.enable_alpn

When enabled in FF Nightly, you can navigate to

https://h2duo.cloudapp.net/Mux

Which is a page showing one of HTTP/2 advantages called Multiplexing, which is ability to download large amount of resources simultaneously. The testing page should load he left image much faster. Also when you look at the request, you will see HTTP 2.0, like on following screen.

http2Server