How to change settings or preferences in firefox source code?
I want to change some settings in Firefox from the source code, and I cant figure It out. I Have Heard Of autoconfig but that's for in the directory of Firefox.
Všetky odpovede (6)
Hi
If you are looking to work with the code of Firefox, this site will help you to get started:
I have done all of those already, But I want the change the default preferences in firefox.
There is no need to edit the source code to change the default value of a pref. You can do this via a policies.json file or via autoconfig.cfg file in case the pref is not supported by a policy.
- https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
- https://support.mozilla.org/en-US/kb/customizing-firefox-using-policiesjson
- https://github.com/mozilla/policy-templates/
To use Autoconfig, place two files into the Firefox installation directory.
- on Windows, they go into the same directory where Firefox is installed
- on macOS, they go into the Contents/Resources directory of the Firefox.app
The autoconfig.js file that specifies to use autoconfig.cfg is placed into the "defaults\pref" directory where the channel-prefs.js file is located. The autoconfig.cfg file is placed at the top level of the Firefox directory.
- autoconfig.cfg and autoconfig.js need to start with a comment line (//)
- autoconfig.js needs to use Unix line endings (LF instead of CR/LF)
The content of autoconfig.js:
// pref("general.config.filename", "autoconfig.cfg"); pref("general.config.obscure_value", 0); pref("general.config.sandbox_enabled", false);
These functions can be used in autoconfig.cfg:
defaultPref(); // set new default value, requires special data: format for localized prefs pref(); // set pref, allow changes in current session lockPref(); // lock pref, disallow changes
But i want it to be defaulted so when i build it it always has those settings without having to put these files
I have built firefox using mozillabuild but I want the change the default settings or preferences, for example the homepage or more preferences page. I want to do this directly from the code.
I will lock this thread since you decided to create a new thread.
- /questions/1421343 Firefox source code: How Do I set custom preferences or settings?