Bug 1499203 - Warn the user about legacy extension incompatibility. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Tue, 16 Oct 2018 11:47:35 +1300
changeset 33392 2be6397d3b059904c0a8ccf7dae963bf0b93798a
parent 33391 3b5ab06975e32995a89e1eded53e74e8b2d1ac97
child 33393 379f94cf13ee6dcf5c4b5c4575b3729baee7f702
push id387
push userclokep@gmail.com
push dateMon, 10 Dec 2018 21:30:47 +0000
reviewersjorgk
bugs1499203
Bug 1499203 - Warn the user about legacy extension incompatibility. r=jorgk
mail/base/content/aboutAddonsExtra.js
mail/base/content/specialTabs.js
mail/locales/en-US/chrome/messenger/extensionsOverlay.properties
mail/locales/en-US/chrome/messenger/messenger.properties
--- a/mail/base/content/aboutAddonsExtra.js
+++ b/mail/base/content/aboutAddonsExtra.js
@@ -42,16 +42,41 @@ gStrings.mailExt =
   document.getElementById("category-box")
           .insertBefore(hbox, document.getElementById("categories"));
 
   // Fix the "Search on addons.mozilla.org" placeholder text in the searchbox.
   let textbox = document.getElementById("header-search");
   let placeholder = textbox.getAttribute("placeholder");
   placeholder = placeholder.replace("addons.mozilla.org", "addons.thunderbird.net");
   textbox.setAttribute("placeholder", placeholder);
+
+  // Tell the world about legacy extensions.
+  let alertContainer = document.createElement("vbox");
+  alertContainer.id = "tb-legacy-extensions-notice";
+  alertContainer.className = "alert-container";
+
+  let alert = document.createElement("vbox");
+  alert.className = "alert";
+
+  let description = document.createElement("description");
+  let messageString = gStrings.mailExt.GetStringFromName("legacyInfo") + " ";
+  messageString = messageString.replace("#1", gStrings.brandShortName);
+  messageString = messageString.replace("#2", Services.appinfo.version);
+  description.textContent = messageString;
+
+  let label = document.createElement("label");
+  label.className = "text-link plain";
+  label.href = "https://www.example.com/";
+  label.value = gStrings.mailExt.GetStringFromName("legacyLearnMore");
+
+  description.appendChild(label);
+  alert.appendChild(description);
+  alertContainer.appendChild(alert);
+
+  gListView.node.insertBefore(alertContainer, document.getElementById("legacy-extensions-notice"));
 })();
 
 window._oldSortElements = window.sortElements;
 window.sortElements = function(aElements, aSortBy, aAscending) {
   if (aSortBy.length != 2 || aSortBy[0] != "uiState" || aSortBy[1] != "name") {
     window._oldSortElements(aElements, aSortBy, aAscending);
   }
 
--- a/mail/base/content/specialTabs.js
+++ b/mail/base/content/specialTabs.js
@@ -1483,17 +1483,21 @@ var specialTabs = {
           let host = (installInfo.originatingURI instanceof Ci.nsIStandardURL) &&
                       installInfo.originatingURI.host;
           if (!host)
             host = (install.sourceURI instanceof Ci.nsIStandardURL) &&
                     install.sourceURI.host;
 
           let error = (host || install.error == 0) ?
                        "addonError" : "addonLocalError";
-          if (install.error != 0)
+
+          // Temporarily replace the usual warning message with this more-likely one.
+          if (install.error == AddonManager.ERROR_CORRUPT_FILE)
+            error += "Legacy";
+          else if (install.error != 0)
             error += install.error;
           else if (install.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
             error += "Blocklisted";
           else
             error += "Incompatible";
 
           messageString = messengerBundle.getString(error);
           messageString = messageString.replace("#1", install.name);
--- a/mail/locales/en-US/chrome/messenger/extensionsOverlay.properties
+++ b/mail/locales/en-US/chrome/messenger/extensionsOverlay.properties
@@ -1,13 +1,18 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 cmdBackTooltip=Go back one page
 cmdForwardTooltip=Go forward one page
 
+# LOCALIZATION NOTE (legacyInfo):
+# #1 is the application name, #2 is the application version
+legacyInfo=Legacy extensions must be updated to be compatible with #1 #2.
+legacyLearnMore=Learn more.
+
 #LOCALIZATION NOTE (notification.disable) %1$S is the add-on name, %2$S is brand name
 warnLegacyDisable=%1$S will be disabled after you restart %2$S.
 #LOCALIZATION NOTE (notification.uninstall) %1$S is the add-on name, %2$S is brand name
 warnLegacyUninstall=%1$S will be uninstalled after you restart %2$S.
 warnLegacyRestartButton=Restart
 warnLegacyUndoButton=Undo
--- a/mail/locales/en-US/chrome/messenger/messenger.properties
+++ b/mail/locales/en-US/chrome/messenger/messenger.properties
@@ -702,16 +702,21 @@ addonError-4=#1 could not be installed b
 # #1 is the add-on name, #3 is the application name, #4 is the application version
 addonLocalError-1=This add-on could not be installed because of a filesystem error.
 addonLocalError-2=This add-on could not be installed because it does not match the add-on #3 expected.
 addonLocalError-3=This add-on could not be installed because it appears to be corrupt.
 addonLocalError-4=#1 could not be installed because #3 cannot modify the needed file.
 addonErrorIncompatible=#1 could not be installed because it is not compatible with #3 #4.
 addonErrorBlocklisted=#1 could not be installed because it has a high risk of causing stability or security problems.
 
+# LOCALIZATION NOTE (addonErrorLegacy, addonLocalErrorLegacy):
+# #3 is the application name, #4 is the application version
+addonErrorLegacy=The add-on could not be installed because it is not compatible with #3 #4.
+addonLocalErrorLegacy=This add-on could not be installed because it is not compatible with #3 #4.
+
 confirmMsgDelete.title=Confirm Deletion
 confirmMsgDelete.collapsed.desc=This will delete messages in collapsed threads. Are you sure you want to continue?
 confirmMsgDelete.deleteNoTrash.desc=This will delete messages immediately, without saving a copy to Trash. Are you sure you want to continue?
 confirmMsgDelete.deleteFromTrash.desc=This will permanently delete messages from Trash. Are you sure you want to continue?
 confirmMsgDelete.dontAsk.label=Don't ask me again.
 confirmMsgDelete.delete.label=Delete
 
 mailServerLoginFailedTitle=Login Failed