tor-browser

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

commit b9e0f209c655474b6d0373f7a52f925c49bbd53e
parent 60f355aeb3c78a585ef269d80469a35a2fd9bad1
Author: Micah Killoran <mtigley@mozilla.com>
Date:   Wed,  7 Jan 2026 16:49:08 +0000

Bug 2007608 - Redirect autofill autocomplete item to specific settings section in about:preferences. r=dimi,hjones

Differential Revision: https://phabricator.services.mozilla.com/D277937

Diffstat:
Mbrowser/components/preferences/privacy.inc.xhtml | 4++--
Mbrowser/components/preferences/tests/browser_spotlight.js | 5++---
Mtoolkit/components/formautofill/FormAutofillParent.sys.mjs | 14+++++++-------
Mtoolkit/components/formautofill/FormAutofillPreferences.sys.mjs | 10++++++++++
Mtoolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs | 10+++++++++-
Mtoolkit/components/formautofill/default/FormAutofillPrompter.sys.mjs | 2+-
6 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/browser/components/preferences/privacy.inc.xhtml b/browser/components/preferences/privacy.inc.xhtml @@ -564,14 +564,14 @@ <groupbox id="paymentsGroupBox" data-category="panePrivacy" - data-subcategory="form-autofill" hidden="true"> + data-subcategory="payment-methods-autofill" hidden="true"> <label><html:h2 data-l10n-id="autofill-payment-methods-title" class="subsection-heading"/></label> <html:setting-group data-subcategory="credit-card-autofill" groupid="payments"/> </groupbox> <groupbox id="addressesGroupBox" data-category="panePrivacy" - data-subcategory="form-autofill" hidden="true"> + data-subcategory="addresses-autofill" hidden="true"> <label><html:h2 data-l10n-id="autofill-addresses-title" class="subsection-heading"/></label> <html:setting-group data-subcategory="address-autofill" groupid="addresses"/> </groupbox> diff --git a/browser/components/preferences/tests/browser_spotlight.js b/browser/components/preferences/tests/browser_spotlight.js @@ -3,12 +3,11 @@ add_task(async function test_openPreferences_spotlight() { ["privacy-reports", "panePrivacy", "#privacy", "reports"], ["privacy-address-autofill", "panePrivacy", "#privacy", "address-autofill"], [ - "privacy-credit-card-autofill", + "privacy-payment-methods-autofill", "panePrivacy", "#privacy", - "credit-card-autofill", + "payment-methods-autofill", ], - ["privacy-form-autofill", "panePrivacy", "#privacy", "form-autofill"], ["privacy-logins", "panePrivacy", "#privacy", "logins"], [ "privacy-trackingprotection", diff --git a/toolkit/components/formautofill/FormAutofillParent.sys.mjs b/toolkit/components/formautofill/FormAutofillParent.sys.mjs @@ -35,8 +35,6 @@ const lazy = {}; ChromeUtils.defineESModuleGetters(lazy, { AddressComponent: "resource://gre/modules/shared/AddressComponent.sys.mjs", - // eslint-disable-next-line mozilla/no-browser-refs-in-toolkit - BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs", FormAutofillAddressSection: "resource://gre/modules/shared/FormAutofillSection.sys.mjs", FormAutofillCreditCardSection: @@ -1029,11 +1027,13 @@ export class FormAutofillParent extends JSWindowActorParent { */ async onAutoCompleteEntrySelected(message, data) { switch (message) { - case "FormAutofill:OpenPreferences": { - const win = lazy.BrowserWindowTracker.getTopWindow({ - allowFromInactiveWorkspace: true, - }); - win.openPreferences("privacy-form-autofill"); + case "FormAutofill:OpenPaymentPreferences": { + lazy.FormAutofillPreferences.openPaymentPreference(); + break; + } + + case "FormAutofill:OpenAddressPreferences": { + lazy.FormAutofillPreferences.openAddressPreference(); break; } diff --git a/toolkit/components/formautofill/FormAutofillPreferences.sys.mjs b/toolkit/components/formautofill/FormAutofillPreferences.sys.mjs @@ -570,4 +570,14 @@ export class FormAutofillPreferences { l10nStrings: lazy.ManageAddresses.getAddressL10nStrings(), }); } + + static openPaymentPreference() { + const win = Services.wm.getMostRecentBrowserWindow(); + win.openPreferences("privacy-payment-methods-autofill"); + } + + static openAddressPreference() { + const win = Services.wm.getMostRecentBrowserWindow(); + win.openPreferences("privacy-address-autofill"); + } } diff --git a/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs b/toolkit/components/formautofill/ProfileAutoCompleteResult.sys.mjs @@ -166,7 +166,7 @@ class ProfileAutoCompleteResult { data.fillMessageName = "FormAutofill:ClearForm"; break; case "manage": - data.fillMessageName = "FormAutofill:OpenPreferences"; + data.fillMessageName = this.openPreferenceMessage; break; case "insecure": data.noLearnMore = true; @@ -268,6 +268,10 @@ class ProfileAutoCompleteResult { } export class AddressResult extends ProfileAutoCompleteResult { + get openPreferenceMessage() { + return `FormAutofill:OpenAddressPreferences`; + } + _getSecondaryLabel(focusedFieldName, allFieldNames, profile) { // We group similar fields into the same field name so we won't pick another // field in the same group as the secondary label. @@ -458,6 +462,10 @@ export class AddressResult extends ProfileAutoCompleteResult { } export class CreditCardResult extends ProfileAutoCompleteResult { + get openPreferenceMessage() { + return `FormAutofill:OpenPaymentPreferences`; + } + _getSecondaryLabel(focusedFieldName, allFieldNames, profile) { const GROUP_FIELDS = { "cc-name": [ diff --git a/toolkit/components/formautofill/default/FormAutofillPrompter.sys.mjs b/toolkit/components/formautofill/default/FormAutofillPrompter.sys.mjs @@ -974,7 +974,7 @@ export class CreditCardSaveDoorhanger extends AutofillDoorhanger { privacyLinkElement.setAttribute( "href", CreditCardSaveDoorhanger.spotlightURL || - "about:preferences#privacy-form-autofill" + "about:preferences#privacy-payment-methods-autofill" ); const linkId = `autofill-options-link${