Hack 22. Edit Configuration Files
Modify configuration files where it makes sense to do so, and ignore the rest. Table 1-1 in the introduction to Chapter 1 describes the location of the two important file areas that Firefox uses: the install area and the profile area. This hack runs through the files in those two folders, pointing out which ones can be modified for good effect and which ones are pointless to modify. If changes are made to these files using the Firefox GUI, then a restart is rarely required. If files are changed by hand, as described here, then a full restart of the browser is almost always required and is always a sensible policy. Note that on Windows, the %TMP% directory is also used. The self-extracting Firefox installer temporarily unpacks its files into that directory. On Linux, you must untar non-RPM install bundles by hand to an arbitrary temporary directory before install. On all operating systems, OS files, or at least desktop files, are also touched during install. Many of the following files can be modified with a simple text editor, although few are designed with that in mind. Of the rest, mostly binary files, small tools exist that can expose their content. To get these tools, either compile Firefox [Hack #93] or explore the contents of a nightly build [Hack #92] . The preference system [Hack #23] spans the install and profile areas. It is not discussed in detail here. 3.2.1. Files in the Install AreaHere is a breakdown of the install-area subdirectories. A file with a .xpt suffix is a binary XPIDL type library, similar in concept to Microsoft ATL type libraries. A .jar file is an archive in PK-Zip (.ZIP) format:
On Linux/Unix only, the registry file in the install area is the do-nothing top-level registry of Firefox versions installed at this location. There can only ever be one version. This file is present only because there is a similar but more useful file on Windows. 3.2.2. Files in the Profile AreaHere is a breakdown of the profile area subdirectories. Any directory named Profiles or default that is a sibling of the Firefox (or firefox) directory is a profile for the Mozilla Application Suite Version 1.x. Also at that top level is the operating-system-wide registry.dat (mozver.dat and appreg on Linux/Unix) file, which records information about all Mozilla-based installations on the current host for the current OS user, and all profiles for that OS user. Inside the Firefox directory is the profile area proper. Two generated files for Linux/Unix located here shouldn't be touched. The profiles proper have random characters in their top-level directory names. New profiles have eight characters of random digits; older profiles migrated to the current version have only three digits. These are salted directory names, a term borrowed from cryptography. Since files inside this directory are sometime updated in response to data delivered over the Web, it is safer if this directory's name is not publicly known. That reduces the chance of relatively obscure Trojan horse attacks, although the jury is out on whether such measures are excessive or not. These salted names also pose challenges for profile migration [Hack #25] . The files in the salted directory hold all state (all information changes) derived from the browser session. All files can be hacked, except for .dat files in Mozilla Mdb/Mork formatthey are in too obscure a format to modify easilyand the XUL.mfl file, which is a binary cache of compiled chrome. Modifying the xpti.dat file is also useless. All files can be deleted and will be regenerated as empty files the next time the browser starts up. It is unwise to delete the certificate database [Hack #17] because then Firefox cannot visit secure websites. The localstore.rdf file contains the last known positions of all windows and any values specified with the XUL persist attribute. compatibility.ini is used as a timestamp flag for re-registering extensions [Hack #84] . Here are the other folders:
browser.cache.disk.parent_directory /* default = path to Cache parent */
Any directories named ImapMail, Mail, or News are installed by Mozilla Mail or Thunderbird, not Firefox. Extensions can also write files directly into the topmost profile directory where all the other stateful files are stored. Aggressively written extensions can modify any user-accessible file on the local disk and can modify the Windows Registry on Windows. |