MEGANUKE

Enhancing Firefox by tinkering with its guts

So I began my research and found that specific settings for an specific profile are saved in a file called prefs.js. From this file, Firefox reads the values and specifies them and starts a session using them.
A couple of nights ago I was wondering how Firefox worked and if I was able to make it a little better. Something that shouldn't be that hard since we know that Firefox is open source right? But as soon as I checked the source code I was overwhelmed of how many parts does it has. So without getting bummed out and stop I decided to start using another approach. I started simply by checking Firefox settings. and quickly enough I got to another bump. Those settings, while they give you a small amount of power to change some of Firefox behavior, it still doesn't make any real difference.

After some time tinkering with it I discovered another way of interacting with more important Firefox settings at a more granular level. This is about:config. The way Firefox lets you modify its behavior. This Firefox page is has a huge list of values you can change. Finally I got to were I wanted to get, but there was another issue. There are so many values in this page that it will be kind of absurd to change it one by one, So I should find a way to change them by bulk. That was when, by doing some research I found a Github Repo specifically created to address this specific situation. Here is the link:

https://github.com/arkenfox/user.js

Here was were I found that Firefox works with profiles. It creates a set of files and settings to save behavior and configuration for different purposes. So I began my research and found that specific settings for an specific profile are saved in a file called prefs.js. From this file, Firefox reads the values and specifies them and starts a session using them. You can (I Believe) in theory change values directly from this file. But as this file states, you shouldn't change values directly through it. Instead it provides you with two options. Change them directly in about:config or create a file named user.js in your profile root directory and create entries for each specific value here. The file should be created in your profile root directory.

IMPORTANT! Remeber to create a testing or dummy profile for research and to backup to be able to restore in case something breaks


So, now that I knew how to change values and create some kind of template to use it several times I started with the fun part. Check what every entry does and start modifying values accordingly to improve either privacy, security or performance. Which were the pillars for this research.

There are three types of values that you can change, "BOOLEAN", "STRING" or "INTEGERS" (I don't remember seeing any floating points there, but I might be wrong). The values were changed using the following code:

"user_pref("app.normandy.enabled", false);"

You change the value by calling the "user_pref" function. Using the name of the setting as a string and setting its value.

Once you've decided what entries to change you set them in the user.js file. Once it's done, you copy it in your profile root directory and it overwrites the value of the prefs.js file for every entry you've created. While overwriting these changes you overwrite the values of the file, but if you delete the user.js file, the prefs.js file will not return to its original state. That's why you should create a backup of the profile.

I could start naming each value and start explaining what it does and the logic in changing its value, but I could easily get an article as long as Rapunzel's brother beard. Instead, I created a template file that you can use to adapt to your needs and in it I tried to explain with little words what that entry does and set the new value. You can check it here:

https://github.com/alex-matty/FirefoxPrivacyEnhancer

Check it out and if you feel that you could use it feel free to try it out.

See you next time!

MEGANUKE

Published on 8 November 2021

Return to Homepage

You can find me at:

Twitter Youtube Github Soundcloud