--- a/browser/extensions/formautofill/FormAutofillDoorhanger.jsm
+++ b/browser/extensions/formautofill/FormAutofillDoorhanger.jsm
@@ -70,16 +70,17 @@ const CONTENT = {
},
},
updateAddress: {
notificationId: "autofill-address",
message: GetStringFromName("updateAddressMessage"),
descriptionLabel: GetStringFromName("updateAddressDescriptionLabel"),
descriptionIcon: false,
linkMessage: GetStringFromName(autofillOptsKey),
+ spotlightURL: "about:preferences#privacy-address-autofill",
anchor: {
id: "autofill-address-notification-icon",
URL: "chrome://formautofill/content/formfill-anchor.svg",
tooltiptext: GetStringFromName("openAutofillMessagePanel"),
},
mainAction: {
label: GetStringFromName("updateAddressLabel"),
accessKey: GetStringFromName("updateAddressAccessKey"),
@@ -97,16 +98,17 @@ const CONTENT = {
},
},
addCreditCard: {
notificationId: "autofill-credit-card",
message: formatStringFromName("saveCreditCardMessage", [brandShortName], 1),
descriptionLabel: GetStringFromName("saveCreditCardDescriptionLabel"),
descriptionIcon: true,
linkMessage: GetStringFromName(autofillSecurityOptionsKey),
+ spotlightURL: "about:preferences#privacy-credit-card-autofill",
anchor: {
id: "autofill-credit-card-notification-icon",
URL: "chrome://formautofill/content/formfill-anchor.svg",
tooltiptext: GetStringFromName("openAutofillMessagePanel"),
},
mainAction: {
label: GetStringFromName("saveCreditCardLabel"),
accessKey: GetStringFromName("saveCreditCardAccessKey"),
@@ -152,16 +154,17 @@ const CONTENT = {
},
},
updateCreditCard: {
notificationId: "autofill-credit-card",
message: GetStringFromName("updateCreditCardMessage"),
descriptionLabel: GetStringFromName("updateCreditCardDescriptionLabel"),
descriptionIcon: true,
linkMessage: GetStringFromName(autofillOptsKey),
+ spotlightURL: "about:preferences#privacy-credit-card-autofill",
anchor: {
id: "autofill-credit-card-notification-icon",
URL: "chrome://formautofill/content/formfill-anchor.svg",
tooltiptext: GetStringFromName("openAutofillMessagePanel"),
},
mainAction: {
label: GetStringFromName("updateCreditCardLabel"),
accessKey: GetStringFromName("updateCreditCardAccessKey"),
@@ -225,23 +228,25 @@ let FormAutofillDoorhanger = {
return chromeDoc.getElementById(notificationId);
},
/**
* Append the link label element to the popupnotificationcontent.
* @param {XULElement} content
* popupnotificationcontent
* @param {string} message
* The localized string for link title.
+ * @param {string} link
+ * Makes it possible to open and highlight a section in preferences
*/
- _appendPrivacyPanelLink(content, message) {
+ _appendPrivacyPanelLink(content, message, link) {
let chromeDoc = content.ownerDocument;
let privacyLinkElement = chromeDoc.createElement("label");
privacyLinkElement.className = "text-link";
privacyLinkElement.setAttribute("useoriginprincipal", true);
- privacyLinkElement.setAttribute("href", "about:preferences#privacy");
+ privacyLinkElement.setAttribute("href", link || "about:preferences#privacy");
privacyLinkElement.setAttribute("value", message);
content.appendChild(privacyLinkElement);
},
/**
* Append the description section to the popupnotificationcontent.
* @param {XULElement} content
* popupnotificationcontent
@@ -342,16 +347,17 @@ let FormAutofillDoorhanger = {
log.debug("show doorhanger with type:", type);
return new Promise((resolve) => {
let {
notificationId,
message,
descriptionLabel,
descriptionIcon,
linkMessage,
+ spotlightURL,
anchor,
mainAction,
secondaryActions,
options,
} = CONTENT[type];
const {
ownerGlobal: chromeWin,
@@ -378,17 +384,17 @@ let FormAutofillDoorhanger = {
const notificationElementId = notificationId + "-notification";
const notification = chromeDoc.getElementById(notificationElementId);
const notificationContent = notification.querySelector("popupnotificationcontent") ||
chromeDoc.createElement("popupnotificationcontent");
if (!notification.contains(notificationContent)) {
notificationContent.setAttribute("orient", "vertical");
this._appendDescription(notificationContent, descriptionLabel, descriptionIcon);
- this._appendPrivacyPanelLink(notificationContent, linkMessage);
+ this._appendPrivacyPanelLink(notificationContent, linkMessage, spotlightURL);
notification.append(notificationContent);
}
this._updateDescription(notificationContent, description);
};
this._setAnchor(browser, anchor);
chromeWin.PopupNotifications.show(
browser,
notificationId,