Bug 1359276 Part 2 Make legacy badge link to sumo r=mossop
authorAndrew Swan <aswan@mozilla.com>
Wed, 03 May 2017 15:41:31 -0700
changeset 356777 952c5438a347b382be5f6ac516365c9a299818bd
parent 356776 92ec85d184950fe93974716b8cac3c9273e4e3aa
child 356778 70db5f9c852d04d2d73e879f80385c2c484c2f17
push id42142
push useraswan@mozilla.com
push dateFri, 05 May 2017 18:16:07 +0000
treeherderautoland@952c5438a347 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs1359276
milestone55.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 1359276 Part 2 Make legacy badge link to sumo r=mossop 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;