Wandering Thoughts archives

2022-12-31

Going from a Firefox preference to the underlying configuration setting

Suppose, not entirely hypothetically, that you have a Firefox "Preferences" option and you'd like to know for sure what about:config setting corresponds to it. One way to do this is to look it up in the Firefox source code, which is probably most readily done online through searchfox.org. This has to be done in two steps because there's a little bit of indirection in the Firefox code base (due to localization).

First, search for the full text of the Preference option, such as "Autofill logins and passwords", but you have to do it without quotes (unlike typical Internet search engine behavior). This will typically get you at least a file under browser/locales/en-US (assuming you're using the English text), in this case browser/locales/en-US/browser/preferences/preferences.ftl. Click on the hard to see line number and you'll jump right to where it's mentioned in the file, and you'll get something like (in this case):

# Checkbox which controls filling saved logins into fields automatically when they appear, in some cases without user interaction.
forms-fill-logins-and-passwords =
    .label = Autofill logins and passwords
    .accesskey = i

Now take that name ('forms-fill-logins-and-passwords') and search for it in the code. This should get you at least two hits in the main Firefox code, one in the file you just found it in and one in, in this case, browser/components/preferences/privacy.inc.xhtml. Once again you can click on the little line numbers to jump to the right spot in the file, which will give you a blob of XML that looks like:

<checkbox id="passwordAutofillCheckbox"
    data-l10n-id="forms-fill-logins-and-passwords"
    search-l10n-id="forms-fill-logins-and-passwords.label"
    preference="signon.autofillForms"
    flex="1" />

The 'preference=' is the about:config setting name that this works on.

Not all Preferences options and about:config settings are related in as straightforward a way as this, but this works a lot of the time.

You can also work the process in reverse. Given an about:config setting, you can search for it, find the relevant preferences/ XML (if there is any), get the localization label, and find the text of the label in your language. Sometimes simply knowing the section of Firefox's Preferences that controls the about:config setting is a good lead, especially once you throw in the l10n ID name.

(When you start with an about:config setting, you'll get a lot more hits because you also find where that setting is used and looked at.)

web/FirefoxPreferenceToConfigSetting written at 22:45:18; Add Comment


Page tools: See As Normal.
Search:
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.