Bug 1434480 - added highlighting support via spotlightURL additions to updateAddress and updateCreditCard r=MattN
authormbkupfer <mbkupfer@gmail.com>
Thu, 26 Apr 2018 15:06:20 -0700
changeset 472047 e0e2924527569253b22bccfb4a4e328a34366cb5
parent 472046 c7604ce41bc5861a5848fb3e04c645fb1d8556c7
child 472048 e502da324b700c5ded74fa95a762751f709c97a9
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1434480
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1434480 - added highlighting support via spotlightURL additions to updateAddress and updateCreditCard r=MattN MozReview-Commit-ID: DcQ3DXgKjJ0
browser/extensions/formautofill/FormAutofillDoorhanger.jsm
--- 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,