Verified Commit 7fbcdd29 authored by henry's avatar henry Committed by jwilde
Browse files

fixup! BB 41930: Remove the UI to customize accept_languages.

BB 44793: Use settings config for spoof english checkbox.
parent 187b678a
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -100,9 +100,10 @@
              languages-customize-add.label,
            " />
    -->
    <checkbox id="spoofEnglish"
              data-l10n-id="languages-customize-spoof-english"/>
  </hbox>
  <!-- TODO: Integrate into the "Languages" setting-group after bugzilla bug
     - 1972081. -->
  <html:setting-group groupid="websiteSpoofEnglish"></html:setting-group>

  <checkbox id="useSystemLocale" hidden="true"
            data-l10n-id="use-system-locale"
+22 −16
Original line number Diff line number Diff line
@@ -794,9 +794,22 @@ Preferences.addSetting({
  },
});

Preferences.addSetting({
  id: "websiteSpoofEnglish",
  pref: "privacy.spoof_english",
  get: val => {
    return val == 2;
  },
  set: val => {
    return val ? 2 : 1;
  },
});

Preferences.addSetting({
  id: "websiteLanguageWrapper",
  deps: ["acceptLanguages"],
  // Hide website language settings. tor-browser#41930.
  visible: () => false,
  onUserReorder(event, deps) {
    const { draggedIndex, targetIndex } = event.detail;

@@ -3028,6 +3041,14 @@ SettingGroupManager.registerGroups({
      },
    ],
  },
  websiteSpoofEnglish: {
    items: [
      {
        id: "websiteSpoofEnglish",
        l10nId: "languages-customize-spoof-english",
      },
    ],
  },
  applications: {
    id: "applicationsGroup",
    l10nId: "applications-setting",
@@ -5246,6 +5267,7 @@ var gMainPane = {
    initSettingGroup("drm");
    initSettingGroup("contrast");
    initSettingGroup("websiteLanguage");
    initSettingGroup("websiteSpoofEnglish");
    initSettingGroup("browsing");
    initSettingGroup("zoom");
    initSettingGroup("fonts");
@@ -5287,22 +5309,6 @@ var gMainPane = {
    }

    // setEventListener("chooseLanguage", "command", gMainPane.showLanguages);
    {
      const spoofEnglish = document.getElementById("spoofEnglish");
      const kPrefSpoofEnglish = "privacy.spoof_english";
      const preference = Preferences.add({
        id: kPrefSpoofEnglish,
        type: "int",
      });
      const spoofEnglishChanged = () => {
        spoofEnglish.checked = preference.value == 2;
      };
      spoofEnglishChanged();
      preference.on("change", spoofEnglishChanged);
      setEventListener("spoofEnglish", "command", () => {
        preference.value = spoofEnglish.checked ? 2 : 1;
      });
    }
    // TODO (Bug 1817084) Remove this code when we disable the extension
    setEventListener(
      "fxtranslateButton",