Commit 9cb4a923 authored by Henry Wilkes's avatar Henry Wilkes Committed by Pier Angelo Vendrame
Browse files

BB 44711: Hide unwanted setting controls in Base Browser.

parent d3aa45d4
Loading
Loading
Loading
Loading
+11 −0
Changes for browser/components/preferences/config/accessibility.mjs: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -86,6 +86,11 @@ Preferences.addSetting(
Preferences.addSetting({
  id: "alwaysUnderlineLinks",
  pref: "layout.css.always_underline_links",
  // Hide "always underline links" because it can be used for fingerprinting. At
  // the time of implementation, this is the case with or without RFP, so we
  // hide this unconditionally.
  // tor-browser#43117.
  visible: () => false,
});

Preferences.addSetting({
@@ -105,6 +110,12 @@ Preferences.addSetting({
Preferences.addSetting({
  id: "useSmoothScrolling",
  pref: "general.smoothScroll",
  deps: ["resistFingerprinting"],
  visible: ({ resistFingerprinting }) => {
    // Hide "smooth scrolling" when using resist fingerprinting (RFP) because
    // the preference should be ignored. tor-browser#42070.
    return !resistFingerprinting.value;
  },
});
Preferences.addSetting({
  id: "useOverlayScrollbars",
+2 −1
Changes for browser/components/preferences/config/account-sync.mjs: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -819,7 +819,8 @@ SettingGroupManager.registerGroups({
  }),
  accountDisabled: {
    inProgress: true,
    hidden: accountsEnabled,
    // Hide the "disabled" banner unconditionally. tor-browser#45209.
    hidden: true,
    items: [
      {
        id: "fxaAccountDisabled",
+15 −1
Changes for browser/components/preferences/config/appearance.mjs: 15 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -18,11 +18,17 @@ Preferences.addAll([

Preferences.addSetting({
  id: "web-appearance-override-warning",
  deps: ["resistFingerprinting"],
  setup: emitChange => {
    FORCED_COLORS_QUERY.addEventListener("change", emitChange);
    return () => FORCED_COLORS_QUERY.removeEventListener("change", emitChange);
  },
  visible: () => {
  visible: ({ resistFingerprinting }) => {
    // Hide web appearance settings when using resist fingerprinting (RFP).
    // tor-browser#41739.
    if (resistFingerprinting.value) {
      return false;
    }
    return FORCED_COLORS_QUERY.matches;
  },
});
@@ -32,6 +38,12 @@ Preferences.addSetting(
    id: "web-appearance-chooser",
    themeNames: ["dark", "light", "auto"],
    pref: "layout.css.prefers-color-scheme.content-override",
    deps: ["resistFingerprinting"],
    visible: ({ resistFingerprinting }) => {
      // Hide web appearance settings when using resist fingerprinting (RFP).
      // tor-browser#41739.
      return !resistFingerprinting.value;
    },
    setup(emitChange) {
      Services.obs.addObserver(emitChange, "look-and-feel-changed");
      return () =>
@@ -83,6 +95,8 @@ Preferences.addSetting({

Preferences.addSetting({
  id: "related-settings-home-link",
  // Hide the "Customize Firefox Home" link. tor-browser#45156.
  visible: () => false,
  onUserClick: e => {
    e.preventDefault();
    window.gotoPref("paneHome");
+65 −7
Changes for browser/components/preferences/config/passwords-autofill.mjs: 65 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -19,10 +19,6 @@ const FormAutofillUtils = ChromeUtils.importESModule(
  "resource://gre/modules/shared/FormAutofillUtils.sys.mjs"
).FormAutofillUtils;

const { AppConstants } = ChromeUtils.importESModule(
  "resource://gre/modules/AppConstants.sys.mjs"
);

const lazy = XPCOMUtils.declareLazy({
  AppConstants: "resource://gre/modules/AppConstants.sys.mjs",
  OSKeyStore: "resource://gre/modules/OSKeyStore.sys.mjs",
@@ -261,6 +257,7 @@ Preferences.addAll([
  { id: "signon.autofillForms", type: "bool" },
  { id: "signon.management.page.breach-alerts.enabled", type: "bool" },
  { id: "signon.firefoxRelay.feature", type: "string" },
  { id: "security.nocertdb", type: "bool" },
]);

Preferences.addSetting({
@@ -526,15 +523,50 @@ Preferences.addSetting(
  }
);

Preferences.addSetting({
  id: "canSavePasswords",
  pref: "security.nocertdb",
  get: pref => {
    return !pref;
  },
});

Preferences.addSetting({
  id: "savePasswords",
  pref: "signon.rememberSignons",
  deps: ["canSavePasswords"],
  visible: ({ canSavePasswords }, savePasswords) => {
    // Only show this option if the user has explicitly disabled "nocertdb", or
    // they have somehow switched this option on. tor-browser#45197.
    return canSavePasswords.value || savePasswords.value;
  },
  controllingExtensionInfo: {
    storeId: "services.passwordSavingEnabled",
    l10nId: "extension-controlling-password-saving",
  },
});

Preferences.addSetting({
  id: "showPasswordControls",
  deps: ["canSavePasswords", "savePasswords"],
  get: (_pref, { canSavePasswords, savePasswords }) => {
    // Only show other password controls if the user has explicitly disabled
    // "nocertdb", or they have somehow switched on save passwords.
    // tor-browser#45197.
    return canSavePasswords.value || savePasswords.value;
  },
});

Preferences.addSetting({
  id: "passwordsUnsupportedBanner",
  deps: ["canSavePasswords"],
  visible: ({ canSavePasswords }) => {
    // NOTE: We show the banner even if disabling the password controls are
    // visible because "savePasswords" is true.
    return !canSavePasswords.value;
  },
});

Preferences.addSetting({
  id: "managePasswordExceptions",
  disabled: () =>
@@ -559,7 +591,10 @@ Preferences.addSetting({

Preferences.addSetting({
  id: "requireOSAuthForPasswords",
  visible: () => lazy.OSKeyStore.canReauth(),
  deps: ["showPasswordControls"],
  visible: ({ showPasswordControls }) => {
    return showPasswordControls.value && lazy.OSKeyStore.canReauth();
  },
  get: () => lazy.LoginHelper.getOSAuthEnabled(),
  async set(checked) {
    const [messageText, captionText] = await Promise.all([
@@ -587,15 +622,20 @@ Preferences.addSetting({
Preferences.addSetting({
  id: "allowWindowSSO",
  pref: "network.http.windows-sso.enabled",
  visible: () => AppConstants.platform === "win",
  // Hide Windows SSO (single sign on). tor-browser#40717.
  visible: () => false,
});

Preferences.addSetting({
  id: "manageSavedPasswords",
  deps: ["showPasswordControls"],
  onUserClick: () => {
    PasswordSettingHelpers.showPasswords();
  },
  visible: () => {
  visible: ({ showPasswordControls }) => {
    if (!showPasswordControls.value) {
      return false;
    }
    let policy = Services.policies.getActivePolicies();
    return (
      policy?.PasswordManagerEnabled !== false &&
@@ -606,6 +646,10 @@ Preferences.addSetting({

Preferences.addSetting({
  id: "additionalProtectionsGroup",
  deps: ["showPasswordControls"],
  visible: ({ showPasswordControls }) => {
    return showPasswordControls.value;
  },
});

Preferences.addSetting({
@@ -678,6 +722,10 @@ Preferences.addSetting({
Preferences.addSetting({
  id: "breachAlerts",
  pref: "signon.management.page.breach-alerts.enabled",
  // Even for users who force passwords to be enabled, we hide this because
  // login breach requires "fxmonitor-breaches" remote settings, which has no
  // local JSON dumps in Base Browser. tor-browser#45197.
  visible: () => false,
});

SettingGroupManager.registerGroups({
@@ -688,6 +736,16 @@ SettingGroupManager.registerGroups({
    l10nId: "forms-passwords-header",
    headingLevel: 2,
    items: [
      // Add a banner to explain that passwords are unsupported.
      // tor-browser#45197.
      {
        id: "passwordsUnsupportedBanner",
        l10nId: "passwords-settings-unsupported-banner",
        control: "moz-message-bar",
        controlAttr: {
          role: "status",
        },
      },
      {
        id: "savePasswords",
        l10nId: "forms-ask-to-save-passwords",
+27 −13
Changes for browser/components/preferences/config/privacy.mjs: 27 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -335,7 +335,6 @@ Preferences.addAll([
  { id: "privacy.fingerprintingProtection.pbmode", type: "bool" },

  // Resist Fingerprinting
  { id: "privacy.resistFingerprinting", type: "bool" },
  { id: "privacy.resistFingerprinting.pbmode", type: "bool" },

  // Social tracking
@@ -1993,6 +1992,8 @@ if (SECURITY_PRIVACY_STATUS_CARD_ENABLED) {
      "etpCustomEnabled",
      ...SECURITY_WARNINGS.map(warning => warning.id),
    ],
    // Hide the privacy card. tor-browser#44829.
    visible: () => false,
  });

  Preferences.addSetting({
@@ -2000,6 +2001,10 @@ if (SECURITY_PRIVACY_STATUS_CARD_ENABLED) {
    deps: SECURITY_WARNINGS.map(warning => warning.id),
    _telemetrySent: false,
    visible(deps) {
      // Hide the privacy card's warnings. tor-browser#44829.
      if (lazy.AppConstants.BASE_BROWSER_VERSION) {
        return false;
      }
      const count = Object.values(deps).filter(
        depSetting => depSetting.visible
      ).length;
@@ -2275,6 +2280,10 @@ Preferences.addSetting({
  pref: "privacy.globalprivacycontrol.enabled",
  deps: ["gpcFunctionalityEnabled"],
  visible: ({ gpcFunctionalityEnabled }) => {
    // Hide GPC. tor-browser#42777.
    if (lazy.AppConstants.BASE_BROWSER_VERSION) {
      return false;
    }
    return gpcFunctionalityEnabled.value;
  },
});
@@ -2286,6 +2295,13 @@ Preferences.addSetting({
  id: "relayIntegration",
  deps: ["savePasswords", "relayFeature"],
  visible: () => {
    // Hide Firefox Relay. tor-browser#43109 and tor-browser#42814.
    // NOTE: Whilst `FirefoxRelay.isDisabled` is `true` due to preferences we
    // set for Base Browser, `FirefoxRelay.isAvailable` is also `true` in this
    // case, hence why we still need to hide this unconditionally.
    if (lazy.AppConstants.BASE_BROWSER_VERSION) {
      return false;
    }
    return lazy.FirefoxRelay.isAvailable;
  },
  disabled: ({ savePasswords, relayFeature }) => {
@@ -2408,6 +2424,8 @@ Preferences.addSetting({
Preferences.addSetting({
  id: "enableSafeBrowsing",
  deps: ["enableSafeBrowsingPhishing", "enableSafeBrowsingMalware"],
  // Does not work in Tor Browser. tor-browser#44802.
  visible: () => false,
  get: (_value, deps) => {
    return (
      deps.enableSafeBrowsingPhishing.value &&
@@ -2437,12 +2455,8 @@ Preferences.addSetting(
      uncommonDownloads:
        "browser.safebrowsing.downloads.remote.block_potentially_unwanted",
    },
    ({ malware, phishing, downloads, unwantedDownloads, uncommonDownloads }) =>
      (!malware.value && !malware.locked) ||
      (!phishing.value && !phishing.locked) ||
      (!downloads.value && !downloads.locked) ||
      (!unwantedDownloads.value && !unwantedDownloads.locked) ||
      (!uncommonDownloads.value && !uncommonDownloads.locked),
    // Does not work in Tor Browser. tor-browser#44802.
    () => false,
    true
  )
);
@@ -3121,7 +3135,8 @@ Preferences.addSetting({
      (lazy.AppConstants.platform == "win" ||
        lazy.AppConstants.platform == "macosx") &&
      typeof Services.policies.getActivePolicies()?.Certificates
        ?.ImportEnterpriseRoots == "undefined"
        ?.ImportEnterpriseRoots == "undefined" &&
      !lazy.AppConstants.BASE_BROWSER_VERSION
    );
  },
});
@@ -3576,6 +3591,8 @@ Preferences.addSetting({

Preferences.addSetting({
  id: "etpStatusBoxGroup",
  // Hide enhanced tracking protection (ETP). tor-browser#26345.
  visible: () => false,
});

Preferences.addSetting({
@@ -3608,6 +3625,8 @@ Preferences.addSetting({

Preferences.addSetting({
  id: "protectionsDashboardLink",
  // Hide enhanced tracking protection (ETP). tor-browser#26345.
  visible: () => false,
});

Preferences.addSetting({
@@ -3664,11 +3683,6 @@ Preferences.addSetting({
  },
});

Preferences.addSetting({
  id: "resistFingerprinting",
  pref: "privacy.resistFingerprinting",
});

Preferences.addSetting({
  id: "resistFingerprintingPBM",
  pref: "privacy.resistFingerprinting.pbmode",
Loading