tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug_1969949_convert_startup_config_controls.py (1127B)


      1 # Any copyright is dedicated to the Public Domain.
      2 # http://creativecommons.org/publicdomain/zero/1.0/
      3 
      4 import re
      5 import fluent.syntax.ast as FTL
      6 from fluent.migrate import COPY_PATTERN
      7 from fluent.migrate.transforms import TransformPattern
      8 
      9 
     10 def migrate(ctx):
     11    """Bug 1969949 - Migrate startup controls to config-based, part {index}."""
     12    path = "browser/browser/preferences/preferences.ftl"
     13    ctx.add_transforms(
     14        path,
     15        path,
     16        [
     17            FTL.Message(
     18                id=FTL.Identifier("is-default-browser"),
     19                attributes=[
     20                    FTL.Attribute(
     21                        id=FTL.Identifier("message"),
     22                        value=COPY_PATTERN(path, "is-default"),
     23                    ),
     24                ],
     25            ),
     26            FTL.Message(
     27                id=FTL.Identifier("is-not-default-browser"),
     28                attributes=[
     29                    FTL.Attribute(
     30                        id=FTL.Identifier("message"),
     31                        value=COPY_PATTERN(path, "is-not-default"),
     32                    ),
     33                ],
     34            ),
     35        ],
     36    )