Automation comes to the Ghacks user.js configuration for Firefox
The Ghacks user.js configuration file for Firefox contains a list of mostly privacy and security-related preferences for the web browser.
Firefox updates may change preferences. Updates may remove preferences, modify them, or introduce them. That's the core reason why the user.js file is regularly updated.
Users who make use of the Ghacks user.js file had to download the new file from the GitHub repository until now to get the updated version of it for the most recent version of the Firefox browser.
The replacement on the local system depends mostly on how the user.js file is applied. Some users merely replace the old with the new, others go through the list of changes manually to make modifications to their copy.
Leftovers are common regardless of the method used. If you remove a preference from the user.js file, it is not automatically removed from Firefox for instance. You had to reset the preference in about:config to get rid of it for example.
The manual resetting of preferences is error-prone. While you can ignore the issue entirely, you'd end up with a growing number of preferences that are either inactive or no longer working.
Automation of the process
The team, earthling, claustromaniac, and overdodactyl, created scripts to address this issue. The following scripts are available:
- prefsCleaner.bat removes any entries from the prefs.js file that do exist in user.js.
- Scratchpad scripts reset Firefox preferences.
- Updater scripts to back up, download, and apply changes.
You need to copy the prefsCleaner.bat file to the Firefox profile folder. Open about:support in the Firefox address bar and click on the "open folder" button under Application Basics to open the profile folder.
Make sure to close Firefox before you run the batch script in the profile folder. The batch script resets any preference that is also in the user.js file.
The data from the user.js file is then applied again on the next start of the web browser.
Using Scratchpad scripts
Scratchpad scripts will reset preferences as well. Unlike prefsCleaner.bat, these scripts can also reset preferences that are not in the current user.js file.
Several scripts are provided that you may run to reset removed or deprecated preferences, among others.
Running them is a bit complicated, however. You may want to create a backup of the entire Firefox profile before you start.
- Optional: disable the Internet connection of Firefox (or the device).
- Start the Firefox web browser.
- Load about:config so that it is the active tab of the browser.
- Use Shift-F4 to open Scratchpad.
- Use the open button to load the script.
- You can paste the content as well, but need to type "allow pasting" first to enable that functionality.
- Select run to execute the script.
- Check Developer>Browser Console>Logging for output.
- Restart the Firefox web browser.
- If you disabled Internet, re-enable it.
Updater scripts are available for Windows, Mac and Linux machines. The following happens when you run the scripts without parameters:
- Backup of the Firefox user.js file.
- Download of the most recent Ghacks user.js file.
- Use the file user-overrides.js if it exists.
Users who made changes to the Ghacks user.js file prior to adding it to Firefox can use the user-overrides.js file to retain those changes while using updater scripts.
Basically, what you do is add any modified preference to the user-overrides.js file so that the modifications are retained throughout updates. The updater scripts use the file automatically if it exists.
The Windows version of the updater script supports command line parameters. You can run the script with the -Merge pararameter to merge user-overrides.js preferences with the user.js preferences instead of appending them at the end of the user.js file.