Some useful settings for Firefox

Post tutorials, HOWTO's and other useful resources here.
Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#1 by Rapha_ » 07 Sep 2021, 13:11

You can retrieve Bookmarks from a previous version through the menu "Show all bookmarks" then Backup bookmarks.json ...then after Import

If you want to keep all your Firefox settings, configure it exactly as you want (Preferences, addons etc...) and copy the hidden subfolder of guest .mozilla (/home/guest/.mozilla/) into the rootcopy folder of Porteus (/rootcopy/home/guest/.mozilla/)


I was pleased to be able to recover all the passwords of Firefox under Windows to place them under Linux

you have to copy 2 files in your profile folder :
- key4.db
- logins.json

There are other old files that can be recovered, but there should not be too much difference between the versions (compatibility problem). Here is the list of files:

Profiles - Where Firefox stores your bookmarks, passwords and other user data
https://support.mozilla.org/en-US/kb/pr ... -user-data



Also, I learned with the help of Ed_P, that you can avoid the regular "update prompt" message with the policies.json file edition
Sujet : [Solved] Firefox can't update to the latest version

It is also possible to prevent the default browser ask and the refresh message from Firefox.
You can also add other useful settings for Firefox.

The detail of each parameter of the file policies.json is given here for the Firefox v.89 and previous versions :
https://github.com/mozilla/policy-templ ... /README.md

For more recent versions, see the "readme" file:
https://github.com/mozilla/policy-templates/releases

First of all, you have to create 2 new folders "distribution" (and its parent folders) from the "rootcopy" folder

Go to the "rootcopy" folder then launch in the terminal :

Code: Select all

mkdir -p usr/lib64/firefox/distribution
and also (depending on the version you have) :

Code: Select all

mkdir -p usr/lib64/firefox-88.0/
Place in each of the folders the file "policies.json" that you will have created. it is in fact a new *.txt file that you will have renamed "policies.json".
there are some strict rules to respect : there is a comma to add between each argument, an open brace and a closed one for each of them {}
- Data is separated by commas
- Objects are encapsulated within the opening and closing curly brackets
Help yourself to this page, which allows you to test your code to see if there are any errors:

The JSON Validator
https://jsonlint.com/

Here is an example of my file policies.json that allows you to :

Turn off application updates.
- Disable the Refresh Firefox button
- Disable Telemetry
- Disable third-party cookies
- rejects cookies for trackers
- enable tracking protection
- fingerprinting scripts on websites are blocked

Code: Select all

{
	"policies": {
		"DisableAppUpdate": true,
		"DisableProfileRefresh": true,
		"DisableTelemetry": true,
		"Cookies": {
			"AcceptThirdParty": "never",
			"RejectTracker": true
		},
		"EnableTrackingProtection": {
			"Value": true,
			"Fingerprinting": true
		}
	}
}

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Some useful settings for Firefox

Post#2 by Ed_P » 07 Sep 2021, 15:54

An interesting posting Rapha_. Thank you.
Rapha_ wrote:
07 Sep 2021, 13:11
You can retrieve Bookmarks from a previous version through the menu "Show all bookmarks" then Backup bookmarks.json ...then after Import
What version of Firefox are you using? I'm using 87.0 and my labels are a little different than yours. "Show your bookmarks" (ctrl+shift+O) > "Show All Bookmarks" > "Import and Backup" > "Restore" > "Choose File" to find and select a "JSON" to restore from.
Ed

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#3 by Rapha_ » 11 Sep 2021, 21:32

I have forgotten to add the option - Don't check if Firefox is the default browser at startup -

The user preferences stored in prefs.js are differents, they can be configured with the about:config in the address bar ...

We can find information about the parameters of the "about:config" here :
http://kb.mozillazine.org/Category:Preferences

@ Ed_P
yes I have the same thing as you. I made it shorter

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#4 by Rapha_ » 14 Sep 2021, 15:40

To complete, a very useful command to clean Sqlite files (firefox database)

Code: Select all

find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \; 
Sqlite database keeps collecting cruft as time passes, which can be cleaned by the 'vacuum;' command. This command cleans up the cruft in all sqlite files relating to the user you have logged in as. This command has to be run when firefox is not running, or it will exit displaying the pid of the firefox running.
[Source : https://www.commandlinefu.com/commands/ ... s-database.]

(There are a lot of interesting commands on this site!)

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Some useful settings for Firefox

Post#5 by Ed_P » 14 Sep 2021, 19:17

Rapha_ wrote:
14 Sep 2021, 15:40
To complete, a very useful command to clean Sqlite files (firefox database)

Code: Select all

find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \;
Where did you get the sqlite3 app?

Did you happen to come across a policies.json file command for specifying an alternate location for the disk cache?
Ed

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#6 by Rapha_ » 14 Sep 2021, 22:18

Where did you get the sqlite3 app?
SQLite3 files are in your Firefox profil (.mozilla/firefox/.default-release/)

*.sqlite + key4.db + cert9.db :

Code: Select all

file *.sqlite

Code: Select all

file *.db

Did you happen to come across a policies.json file command for specifying an alternate location for the disk cache?
it isn't clear if it works (or not) inside policies.json....see the "browser.cache.disk.parent_directory" in preferences :
https://github.com/mozilla/policy-templ ... references
browser.cache.disk.parent_directory - string - Firefox 68, Firefox ESR 68 - Profile temporary directory
If set, changes the location of the disk cache. This policy doesn't work. It's being worked on.

You can try by the prefs.js file with "about:config" , see here :
https://support.mozilla.org/de/questions/1317032

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Some useful settings for Firefox

Post#7 by Ed_P » 14 Sep 2021, 23:50

Interesting. :o :)

Code: Select all

guest@porteus:~/.mozilla/firefox$ ls -l ~/.mozilla/firefox/dxsqumip.default/*.sqlite
-rw-r--r-- 1 guest users  229376 Sep 13 10:57 /home/guest/.mozilla/firefox/dxsqumip.default/content-prefs.sqlite
-rw-r--r-- 1 guest users 1572864 Sep 14 19:25 /home/guest/.mozilla/firefox/dxsqumip.default/cookies.sqlite
-rw-r--r-- 1 guest users 1409024 Sep 14 19:40 /home/guest/.mozilla/firefox/dxsqumip.default/favicons.sqlite
-rw-r--r-- 1 guest users  262144 Sep 14 19:39 /home/guest/.mozilla/firefox/dxsqumip.default/formhistory.sqlite
-rw-r--r-- 1 guest users   98304 Sep 14 19:25 /home/guest/.mozilla/firefox/dxsqumip.default/permissions.sqlite
-rw-r--r-- 1 guest users 5242880 Sep 14 19:40 /home/guest/.mozilla/firefox/dxsqumip.default/places.sqlite
-rw-r--r-- 1 guest users   65536 Sep 14 19:40 /home/guest/.mozilla/firefox/dxsqumip.default/protections.sqlite
-rw-r--r-- 1 guest users    7168 Sep 14 19:40 /home/guest/.mozilla/firefox/dxsqumip.default/storage.sqlite
-rwxrwxrwx 1 guest users 5832704 Sep 14 16:25 /home/guest/.mozilla/firefox/dxsqumip.default/webappsstore.sqlite*
guest@porteus:~/.mozilla/firefox$ find ~/.mozilla/firefox/dxsqumip.default/*.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/content-prefs.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/cookies.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/favicons.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/formhistory.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/permissions.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/places.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/protections.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/storage.sqlite
/home/guest/.mozilla/firefox/dxsqumip.default/webappsstore.sqlite
guest@porteus:~/.mozilla/firefox$ find ~/.mozilla/firefox/ -type f -name "*.sqlite" -exec sqlite3 {} VACUUM \;
guest@porteus:~/.mozilla/firefox$ ls -l ~/.mozilla/firefox/dxsqumip.default/*.sqlite
-rw-r--r-- 1 guest users  229376 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/content-prefs.sqlite
-rw-r--r-- 1 guest users  622592 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/cookies.sqlite
-rw-r--r-- 1 guest users 1081344 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/favicons.sqlite
-rw-r--r-- 1 guest users  262144 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/formhistory.sqlite
-rw-r--r-- 1 guest users   98304 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/permissions.sqlite
-rw-r--r-- 1 guest users 1343488 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/places.sqlite
-rw-r--r-- 1 guest users   65536 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/protections.sqlite
-rw-r--r-- 1 guest users    7168 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/storage.sqlite
-rwxrwxrwx 1 guest users 5373952 Sep 14 19:41 /home/guest/.mozilla/firefox/dxsqumip.default/webappsstore.sqlite*
guest@porteus:~/.mozilla/firefox$ 
Any info on what VACUUM deletes? Code based on date, last used, number of times used?
Rapha_ wrote:
14 Sep 2021, 22:18
You can try by the prefs.js file with "about:config" , see here :
https://support.mozilla.org/de/questions/1317032
https://support.mozilla.org/de/questions/1317032 wrote: For #2, the about:config screen changed some time ago; there's no more right-click context menu. Was that an old forum thread or a current article?
Yup, that's what I have encountered.
https://support.mozilla.org/de/questions/1317032 wrote: (1) In a new tab, type or paste about:config in the address bar and press Enter/Return. Click the button accepting the risk.

(2) In the search box in the page, type or paste the new preference name

browser.cache.disk.parent_directory

If this preference was already created and has some value assigned to it, click the garbage can at the right end of the row to create it again.

(3) On the bar with the preference name, click the radio button next to String and click the + button to add the preference. Then Firefox should display the new value.

(4) Type or paste the new parent folder (Firefox will create its cache2 folder inside this folder) and click the blue checkmark button or press Enter to save the change.
:good:

Now just need to determine where this change is saved in ~/.mozilla/firefox.

Thank you Rapha_. :beer:
Ed

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#8 by Rapha_ » 15 Sep 2021, 01:50

Any info on what VACUUM deletes? Code based on date, last used, number of times used?
I found this ...
Description

The VACUUM command rebuilds the database file, repacking it into a minimal amount of disk space. There are several reasons an application might do this:

Unless SQLite is running in "auto_vacuum=FULL" mode, when a large amount of data is deleted from the database file it leaves behind empty space, or "free" database pages. This means the database file might be larger than strictly necessary. Running VACUUM to rebuild the database reclaims this space and reduces the size of the database file.

Frequent inserts, updates, and deletes can cause the database file to become fragmented - where data for a single table or index is scattered around the database file. Running VACUUM ensures that each table and index is largely stored contiguously within the database file. In some cases, VACUUM may also reduce the number of partially filled pages in the database, reducing the size of the database file further.

When content is deleted from an SQLite database, the content is not usually erased but rather the space used to hold the content is marked as being available for reuse. This can allow deleted content to be recovered by a hacker or by forensic analysis. Running VACUUM will clean the database of all traces of deleted content, thus preventing an adversary from recovering deleted content.
[Source : https://www.sqlite.org/lang_vacuum.html]

Tolkem
Black ninja
Black ninja
Posts: 34
Joined: 10 Aug 2019, 05:53
Distribution: Porteus 4.0 KDE

Some useful settings for Firefox

Post#9 by Tolkem » 15 Sep 2021, 03:13

There's this https://ffprofile.com/
Firefox Profilemaker
Welcome to the Firefox Profilemaker!
This tool will help you to create a Firefox profile with the defaults you like.

You select which features you want to enable and disable and in the end you get a download link for a zip-file with your profile template. You can for example disable some functions, which send data to Mozilla and Google, or disable several annoying Firefox functions like Mozilla Hello or the Pocket integration.

Each Setting has a short explanation and for the non obvious settings links to resources describing the feature and the possible problems with it.
This tool can do wonders! :)

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Some useful settings for Firefox

Post#10 by Ed_P » 15 Sep 2021, 14:45

Tolkem wrote:
15 Sep 2021, 03:13
There's this https://ffprofile.com/
An interesting find Tolkem. Thank you. :beer:
Ed

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#11 by Rapha_ » 16 Sep 2021, 00:42

Any info on what VACUUM deletes?
:pressure:
Be careful with this command,

:angry7:
I just realized that I lost a lot of links in my bookmarks from the new file "places.sqlite" !

I don't know why it happened : is it a compatibility problem with an old sqlite file ?


I had to recover the original file that I had saved

Make backups!

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Some useful settings for Firefox

Post#12 by Ed_P » 16 Sep 2021, 12:00

Rapha_ wrote:
16 Sep 2021, 00:42
Make backups!
Always good advice. :)
Ed

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#13 by Rapha_ » 16 Sep 2021, 21:50

Finally, it wasn't so bad
it was related to the settings of my bookmarks : a very long menu that was missing a half

I tried to repair it with commands (but nothing worked)

I re-did a cleanup with the original file like this :

Code: Select all

sqlite3 places.sqlite 'VACUUM;'
And the half of the menu was gone again...


I tried again with the original file but this time by changing the location of this sub-menu:

And it works! :Yahoo!:

Rapha_
Shogun
Shogun
Posts: 238
Joined: 12 Jun 2021, 21:59
Distribution: Xfce 4.12 - 5.rc3 - x86_64
Location: France

Some useful settings for Firefox

Post#14 by Rapha_ » 16 Sep 2021, 22:03

Tolkem wrote: There's this https://ffprofile.com/
Thank you !
I'm doing some tests with these configs...

Tolkem
Black ninja
Black ninja
Posts: 34
Joined: 10 Aug 2019, 05:53
Distribution: Porteus 4.0 KDE

Some useful settings for Firefox

Post#15 by Tolkem » 18 Sep 2021, 14:23

Ed_P wrote:
15 Sep 2021, 14:45
Tolkem wrote:
15 Sep 2021, 03:13
There's this https://ffprofile.com/
An interesting find Tolkem. Thank you. :beer:
Rapha_ wrote:
16 Sep 2021, 22:03
Tolkem wrote: There's this https://ffprofile.com/
Thank you !
I'm doing some tests with these configs...
You're welcome, both of you! :beer:

Post Reply