Bug 1566315 Comment 0 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Static prefs are defined in modules/libpref/init/StaticPrefList.yaml. Non-static prefs are defined in various files, something like this list:
```
modules/libpref/init/all.js
browser/app/profile/firefox.js
mobile/android/app/mobile.js
devtools/client/preferences/devtools-client.js
devtools/client/preferences/debugger.js
security/manager/ssl/security-prefs.js
services/sync/services-sync.js
modules/libpref/test/unit/data/testParser.js
devtools/shared/preferences/devtools-shared.js
mobile/android/app/geckoview-prefs.js
devtools/client/webconsole/test/mocha-test-setup.js
devtools/client/netmonitor/launchpad.js
browser/branding/official/pref/firefox-branding.js
browser/branding/nightly/pref/firefox-branding.js
browser/branding/unofficial/pref/firefox-branding.js
browser/branding/aurora/pref/firefox-branding.js
devtools/client/webide/preferences/webide.js
toolkit/components/telemetry/datareporting-prefs.js
services/sync/tests/unit/prefs_test_prefs_store.js
testing/marionette/prefs/marionette.js
devtools/startup/preferences/devtools-startup.js
extensions/pref/autoconfig/test/unit/autoconfig.js
remote/pref/remote.js
services/common/services-common.js
toolkit/components/telemetry/healthreport-prefs.js
modules/libpref/test/unit/data/testPrefSticky.js
modules/libpref/test/unit/data/testPrefLocked.js
modules/libpref/test/unit/extdata/testExt.js
browser/app/profile/channel-prefs.js
mobile/android/installer/mobile-l10n.js
```
(Note that these files are not JavaScript. The `.js` suffix is due to historical reasons.)

The most important of these is modules/libpref/init/all.js, because it's by far the biggest.

If a pref is defined in both StaticPrefList.yaml and all.js, the definition in all.js will take precedence. But we want to avoid any such duplication when possible (by removing the all.js definition) because it's confusing.

It would be good to have a script that detects these double definitions. This script could be used to remove double definitions, and once they are all removed, be used to prevent double definitions by causing a build error when one is introduced. We could start by checking all.js, and then consider expanding to the other .js files.

One important part of this is that both StaticPrefList.yaml and all.js get preprocessed by preprocessor.py, so the script must deal with that.

modules/libpref/init/generate_static_pref_list.py is the script that currently converts StaticPrefList.yaml to StaticPrefList.h during the build. The obvious way to implement the double definition detection would be to extend it.
Static prefs are defined in modules/libpref/init/StaticPrefList.yaml. Non-static prefs are defined in various files, something like this list:
```
modules/libpref/init/all.js
browser/app/profile/firefox.js
mobile/android/app/mobile.js
devtools/client/preferences/devtools-client.js
devtools/client/preferences/debugger.js
devtools/shared/preferences/devtools-shared.js
mobile/android/app/geckoview-prefs.js
browser/branding/official/pref/firefox-branding.js
browser/branding/nightly/pref/firefox-branding.js
browser/branding/unofficial/pref/firefox-branding.js
browser/branding/aurora/pref/firefox-branding.js
devtools/client/webide/preferences/webide.js
devtools/startup/preferences/devtools-startup.js
browser/app/profile/channel-prefs.js
mobile/android/installer/mobile-l10n.js
mobile/android/locales/en-US/mobile-l10n.js
```
(Note that these files are not JavaScript. The `.js` suffix is due to historical reasons.)

The most important of these is modules/libpref/init/all.js, because it's by far the biggest.

If a pref is defined in both StaticPrefList.yaml and all.js, the definition in all.js will take precedence. But we want to avoid any such duplication when possible (by removing the all.js definition) because it's confusing.

It would be good to have a script that detects these double definitions. This script could be used to remove double definitions, and once they are all removed, be used to prevent double definitions by causing a build error when one is introduced. We could start by checking all.js, and then consider expanding to the other .js files.

One important part of this is that both StaticPrefList.yaml and all.js get preprocessed by preprocessor.py, so the script must deal with that.

modules/libpref/init/generate_static_pref_list.py is the script that currently converts StaticPrefList.yaml to StaticPrefList.h during the build. The obvious way to implement the double definition detection would be to extend it.

Back to Bug 1566315 Comment 0