Bug 1359276 Part 2 Make legacy badge link to sumo draft
authorAndrew Swan <aswan@mozilla.com>
Wed, 03 May 2017 15:41:31 -0700
changeset 572386 63bc43672833b60d271d1046b3fb4405cc4be40e
parent 572268 bef8fd3090124b4eaaa041609e045fa2fbf7e5ec
child 627002 168325590bf6420c4aad39e1b552033627ab8f60
push id57052
push useraswan@mozilla.com
push dateThu, 04 May 2017 02:31:10 +0000
bugs1359276
milestone55.0a1
Bug 1359276 Part 2 Make legacy badge link to sumo MozReview-Commit-ID: E2u6dC4RELS
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/content/extensions.xml
toolkit/mozapps/extensions/content/extensions.xul
toolkit/mozapps/extensions/test/browser/browser_legacy.js
toolkit/themes/shared/extensions/extensions.inc.css
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -3086,16 +3086,17 @@ var gDetailView = {
 
       // Exceptions that can slip through above: the default theme plus
       // test pilot addons until we get SIGNEDSTATE_PRIVILEGED deployed.
       if (legacy && legacyWarningExceptions.includes(aAddon.id)) {
         legacy = false;
       }
     }
     this.node.setAttribute("legacy", legacy);
+    document.getElementById("detail-legacy-warning").href = SUPPORT_URL + "webextensions";
 
     // If the search category isn't selected then make sure to select the
     // correct category
     if (gCategories.selected != "addons://search/")
       gCategories.select("addons://list/" + aAddon.type);
 
     document.getElementById("detail-name").textContent = aAddon.name;
     var icon = AddonManager.getPreferredIconURL(aAddon, 64, window);
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -860,17 +860,17 @@
         <xul:vbox class="icon-container">
           <xul:image anonid="icon" class="icon"/>
         </xul:vbox>
         <xul:vbox class="content-inner-container" flex="1">
           <xul:hbox class="basicinfo-container">
               <xul:hbox class="name-container">
                 <xul:label anonid="name" class="name" crop="end" flex="1"
                            tooltip="addonitem-tooltip" xbl:inherits="value=name"/>
-                <xul:label anonid="legacy" class="legacy-warning" value="&addon.legacy.label;"/>
+                <xul:label anonid="legacy" class="legacy-warning text-link" value="&addon.legacy.label;"/>
                 <xul:label class="disabled-postfix" value="&addon.disabled.postfix;"/>
                 <xul:label class="update-postfix" value="&addon.update.postfix;"/>
                 <xul:spacer flex="5000"/> <!-- Necessary to make the name crop -->
               </xul:hbox>
             <xul:label anonid="date-updated" class="date-updated"
                        unknown="&addon.unknownDate;"/>
           </xul:hbox>
           <xul:hbox class="experiment-container">
@@ -1183,16 +1183,17 @@
             this._icon.src = "";
 
           if (this.mAddon.description)
             this._description.value = this.mAddon.description;
           else
             this._description.hidden = true;
 
           this.setAttribute("legacy", this.isLegacy);
+          document.getAnonymousElementByAttribute(this, "anonid", "legacy").href = SUPPORT_URL + "webextensions";
 
           if (!("applyBackgroundUpdates" in this.mAddon) ||
               (this.mAddon.applyBackgroundUpdates == AddonManager.AUTOUPDATE_DISABLE ||
                (this.mAddon.applyBackgroundUpdates == AddonManager.AUTOUPDATE_DEFAULT &&
                 !AddonManager.autoUpdateDefault))) {
             AddonManager.getAllInstalls(aInstallsList => {
               // This can return after the binding has been destroyed,
               // so try to detect that and return early
--- a/toolkit/mozapps/extensions/content/extensions.xul
+++ b/toolkit/mozapps/extensions/content/extensions.xul
@@ -562,17 +562,17 @@
                       <image id="detail-icon" class="icon"/>
                     </vbox>
                     <vbox flex="1">
                       <vbox id="detail-summary">
                         <hbox id="detail-name-container" class="name-container"
                               align="start">
                           <label id="detail-name" flex="1"/>
                           <label id="detail-version"/>
-                          <label class="legacy-warning" value="&addon.legacy.label;"/>
+                          <label id="detail-legacy-warning" class="legacy-warning text-link" value="&addon.legacy.label;"/>
                           <label class="disabled-postfix" value="&addon.disabled.postfix;"/>
                           <label class="update-postfix" value="&addon.update.postfix;"/>
                           <spacer flex="5000"/> <!-- Necessary to allow the name to wrap -->
                         </hbox>
                         <label id="detail-creator" class="creator"/>
                       </vbox>
                       <hbox id="detail-experiment-container">
                         <svg width="8" height="8" viewBox="0 0 8 8" version="1.1"
--- a/toolkit/mozapps/extensions/test/browser/browser_legacy.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_legacy.js
@@ -1,10 +1,12 @@
 
 add_task(async function() {
+  const INFO_URL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "webextensions";
+
   const NAMES = {
     fullTheme: "Full Theme",
     newTheme: "New LWT",
     legacy: "Legacy Extension",
     webextension: "WebExtension",
     dictionary: "Dictionary",
     langpack: "Language Pack",
   };
@@ -53,36 +55,38 @@ add_task(async function() {
     // First find the  entry in the list.
     let item = Array.from(document.getElementById("addon-list").childNodes)
                     .find(i => i.getAttribute("name") == name);
 
     ok(item, `Found ${name} in list`);
     item.parentNode.ensureElementIsVisible(item);
 
     // Check the badge
-    let badge = document.getAnonymousElementByAttribute(item, "class", "legacy-warning");
+    let badge = document.getAnonymousElementByAttribute(item, "anonid", "legacy");
 
     if (isLegacy) {
       is_element_visible(badge, `Legacy badge is visible for ${name}`);
+      is(badge.href, INFO_URL, "Legacy badge link is correct");
     } else {
       is_element_hidden(badge, `Legacy badge is hidden for ${name}`);
     }
 
     // Click down to the details page.
     let detailsButton = document.getAnonymousElementByAttribute(item, "anonid", "details-btn");
     EventUtils.synthesizeMouseAtCenter(detailsButton, {}, mgrWin);
     await new Promise(resolve => wait_for_view_load(mgrWin, resolve));
 
     // And check the badge
     let elements = document.getElementsByClassName("legacy-warning");
     is(elements.length, 1, "Found the legacy-warning element");
     badge = elements[0];
 
     if (isLegacy) {
       is_element_visible(badge, `Legacy badge is visible for ${name}`);
+      is(badge.href, INFO_URL, "Legacy badge link is correct");
     } else {
       is_element_hidden(badge, `Legacy badge is hidden for ${name}`);
     }
   }
 
   await check("theme", NAMES.fullTheme, true);
   await check("theme", NAMES.newTheme, false);
   await check("extension", NAMES.legacy, true);
--- a/toolkit/themes/shared/extensions/extensions.inc.css
+++ b/toolkit/themes/shared/extensions/extensions.inc.css
@@ -458,16 +458,23 @@ button.warning {
 }
 
 .legacy-warning {
   background-color: #FFE900;
   color: #3E2800;
   padding: 4px 5px 3px;
   font-size: 0.9rem;
   font-weight: 600;
+  -moz-user-focus: ignore;
+}
+
+.legacy-warning:hover {
+  background-color: #D7B600;
+  color: #3E2800;
+  text-decoration: none;
 }
 
 #detail-view .legacy-warning {
   margin-top: 0.78rem;
 }
 
 .creator {
   font-weight: bold;