搜尋 Mozilla 技術支援網站

防止技術支援詐騙。我們絕對不會要求您撥打電話或發送簡訊,或是提供個人資訊。請用「回報濫用」功能回報可疑的行為。

Learn More

此討論串已經關閉並封存。 如果您有需要幫助,請新增一個新問題

How to change settings or preferences in firefox source code?

  • 6 回覆
  • 1 有這個問題
  • 52 次檢視
  • 最近回覆由 cor-el

more options

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.

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.

所有回覆 (6)

more options

Hi

If you are looking to work with the code of Firefox, this site will help you to get started:

https://firefox-source-docs.mozilla.org/index.html

more options

I have done all of those already, But I want the change the default preferences in firefox.

more options

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.


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
more options

But i want it to be defaulted so when i build it it always has those settings without having to put these files

more options

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.

more options

I will lock this thread since you decided to create a new thread.