Source code for all Mozilla projects hosted in the Mercurial repositories can be searched and viewed online using Searchfox, a fast indexed search engine that runs on AWS.
Do not download the source code by crawling Searchfox; download a tarball (see instructions here) or use Mercurial instead.
Searchfox indexes multiple branches and modules.
Some other Searchfox roots of interest are:
Mozilla Source Code Directory Structure has a short description of the code living in each source directory of the tree.
To view the source code of a specific version, you can also download it. Each product produced by Mozilla is archived there, together with its source code.