From 10bd96c7df2b0d2ccf4d06009efb5e22d641794c Mon Sep 17 00:00:00 2001 From: Michael Heller <21163552+mdheller@users.noreply.github.com> Date: Sun, 21 Jun 2026 21:09:43 -0400 Subject: [PATCH] tor-mode: register bearbrowser group in libpref moz.build pref_groups The 140-ESR tor-mode build failed: gfxUserFontSet.cpp can't find the generated mozilla/StaticPrefs_bearbrowser.h. Root cause: per-group StaticPrefs_.h files are generated ONLY for groups in modules/libpref/moz.build's hardcoded pref_groups list. The bearbrowser.* prefs are in StaticPrefList.yaml (so StaticPrefsAll.h #includes the group) but 'bearbrowser' isn't in pref_groups on 140, so the per-group header is never emitted. (On 150 LibreWolf's source carries a librewolf group that branding renames; 140's source differs.) Fix: bearbrowser-patches.py now inserts 'bearbrowser' into pref_groups if absent (idempotent; the list is sorted() afterward). Verified: the regex inserts cleanly into the real esr140 moz.build. --- scripts/bearbrowser-patches.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/bearbrowser-patches.py b/scripts/bearbrowser-patches.py index 6c6b34b..0bf7c72 100755 --- a/scripts/bearbrowser-patches.py +++ b/scripts/bearbrowser-patches.py @@ -291,6 +291,29 @@ def _strip_l10n_base(_path): pref_yaml.write_text(_yaml) print(f"Fixed StaticPrefList.yaml: canonical bearbrowser.* block placed before bidi.*") + # Register the "bearbrowser" group in modules/libpref/moz.build pref_groups. + # The per-group header StaticPrefs_bearbrowser.h is ONLY generated for groups + # listed there; StaticPrefsAll.h references the group (from the YAML) but the + # header won't exist unless the group is in pref_groups. On 150 LibreWolf's + # source carries a librewolf group that branding renames; on 140 ESR it does + # NOT, so gfxUserFontSet.cpp's #include of StaticPrefs_bearbrowser.h fails. + # Insert "bearbrowser" into the initial pref_groups list if absent (idempotent). + _libpref_mb = Path("modules/libpref/moz.build") + if _libpref_mb.exists(): + _mb = _libpref_mb.read_text() + if '"bearbrowser"' not in _mb and "'bearbrowser'" not in _mb: + import re as _re2 + # Insert as the first entry of the `pref_groups = [` list. + _mb2, _n = _re2.subn(r'(pref_groups\s*=\s*\[\s*\n)', + r'\1 "bearbrowser",\n', _mb, count=1) + if _n: + _libpref_mb.write_text(_mb2) + print("Registered 'bearbrowser' in modules/libpref/moz.build pref_groups") + else: + print("WARNING: could not find 'pref_groups = [' in libpref/moz.build — StaticPrefs_bearbrowser.h may not generate") + else: + print("note: 'bearbrowser' already in libpref/moz.build pref_groups") + # ── Accept-Language / Intl locale normalization ─────────────────────────── # Patch StaticPrefList.yaml: set en-US defaults for intl prefs that control # both the HTTP Accept-Language header (sent before JS runs) and Intl API