Skip to main content

PrefPicker - Manage & generate prefs.js files

Project description

PrefPicker

CI codecov Matrix PyPI

Manage & generate prefs.js files for use when testing Firefox. This tool is intended to simplify the use and tracking of prefs used by our fuzzing tools. The template files can be modified to allow the creation of custom prefs.js files without the need to maintain a separate mostly duplicate version of a prefs file.

YAML Template Structure

The template document is made up of variants, prefs and values.

pref is the name of the preference that will be added to the prefs.js file. This is an unquoted string. Valid prefs can be found in all.js or in StaticPrefList.yml.

review_on_close is optional. It is a list of relevant Bugzilla IDs used to help avoid obsolete entries. When all bugs in the list are closed the entry will be reviewed and removed if appropriate.

value can be a bool, int, string or null. Adding multiple potential values is possible. When multiple values are present one is chosen at random when generating the output. Using a value of null will exclude the pref from the prefs.js file (acts as browser default).

variant is a subset of values to be used in place of the default values. The default variant is used unless a variant is specified.

There are a few mechanisms in place to help keep the file in order:

  • All prefs must have a default variant
  • All variants must be defined in the variant list
  • All variants in the variant list must be used
  • All variants must be a list and contain values
# example.yml
variant:              # list of extra variants, default is implied
- alt                 # name of variant
pref:
  pref.name:          # unquoted name of the pref used in prefs.js
    review_on_close:  # optional
    - 123456
    variants:
      default:        # variant definition, default is required
      - 0             # potential value
      alt:            # extra optional variant
      - 1             # if multiple values are defined one is chosen randomly
      - null          # null is a special case meaning exclude the pref

Updating Templates and Adding Prefs

Prefs are found in the .yml files in the template directory. Only prefs that are ready to be tested should be added. When adding a pref to a template it is encouraged to add a comment that provides justification and points to a bug in Bugzilla for additional context. If a pref does not already exist and is only used with non-default variants a null entry must be added to the default variant.

Quick Setup

Use pip to install prefpicker.

pip install prefpicker

Examples

Use a built-in template to generate an up-to-date prefs.js file.

prefpicker browser-fuzzing.yml prefs.js

Or generate a prefs.js file from a custom template using the webrender variant:

user@machine:~/prefpicker$ prefpicker custom/template.yml ~/Desktop/prefs.js --variant webrender
Loading 'template.yml'...
Loaded 255 prefs and 5 variants
Generating 'prefs.js' using variant 'webrender'...
Done.

The resulting prefs.js file is ready to be used with Firefox. It will look something like this:

// Generated with PrefPicker @ 2020-02-08 00:50:29 UTC
// Variant 'webrender'
/// ... snip
user_pref("fuzzing.enabled", true);
/// ... snip
// 'gfx.webrender.all' defined by variant 'webrender'
user_pref("gfx.webrender.all", true);
/// ... snip

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prefpicker-2.23.0.tar.gz (27.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prefpicker-2.23.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file prefpicker-2.23.0.tar.gz.

File metadata

  • Download URL: prefpicker-2.23.0.tar.gz
  • Upload date:
  • Size: 27.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for prefpicker-2.23.0.tar.gz
Algorithm Hash digest
SHA256 d464a9c284dff85cb815fd4c8f450c7e438691fa87b59c3213e9a58a70f6f79f
MD5 d66e1d8902d964e7c64139e2c50287c8
BLAKE2b-256 6027f02129eea456b21cf7f369312d370939e3a7de1d87ba29531bdffee18c42

See more details on using hashes here.

File details

Details for the file prefpicker-2.23.0-py3-none-any.whl.

File metadata

  • Download URL: prefpicker-2.23.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for prefpicker-2.23.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c06deb8dad64ae12a10e881968650a926413c011e76fcb3a903f5c6592eaf672
MD5 b23761cc9e9cd391555da8c8be0d7f0f
BLAKE2b-256 3ecb40499dd1b226e649f06c9798d611b727b7e7dd6061b3e992144443f78793

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page