Bug 1236578: Don't display hidden add-ons in the select your add-ons UI. r=rhelmer a=sylvestre
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 25 Feb 2016 13:50:34 -0800
changeset 311404 3eaf4e1122e7c75fc2215034d8229c082b76cf19
parent 311403 86b07e82b7411e80e2b8e51f5a2ef613f727950e
child 311405 8d245decf6b1eb804145a60a2a6f05cb8a095c22
child 311407 debf24e554e2d6789b3b913cefa6b267c8722164
push id5684
push userdtownsend@mozilla.com
push dateThu, 25 Feb 2016 21:53:00 +0000
treeherdermozilla-beta@3eaf4e1122e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhelmer, sylvestre
bugs1236578
milestone45.0
Bug 1236578: Don't display hidden add-ons in the select your add-ons UI. r=rhelmer a=sylvestre MozReview-Commit-ID: AvNCfl34ocy
toolkit/mozapps/extensions/content/selectAddons.js
toolkit/mozapps/extensions/test/browser/browser_select_confirm.js
--- a/toolkit/mozapps/extensions/content/selectAddons.js
+++ b/toolkit/mozapps/extensions/content/selectAddons.js
@@ -62,22 +62,21 @@ var gChecking = {
   _addonCount: 0,
   _completeCount: 0,
 
   show: function() {
     showButtons(true, false, false, false);
     this._progress = document.getElementById("checking-progress");
 
     AddonManager.getAllAddons(aAddons => {
-      if (aAddons.length == 0) {
-        window.close();
-        return;
-      }
+      aAddons = aAddons.filter(function(aAddon) {
+        if (aAddon.hidden) {
+          return false;
+        }
 
-      aAddons = aAddons.filter(function(aAddon) {
         if (aAddon.id == AddonManager.hotfixID) {
           return false;
         }
         if (aAddon.type == "plugin" || aAddon.type == "service")
           return false;
 
         if (aAddon.type == "theme") {
           // Don't show application shipped themes
@@ -86,16 +85,21 @@ var gChecking = {
           // Don't show already disabled themes
           if (aAddon.userDisabled)
             return false;
         }
 
         return true;
       });
 
+      if (aAddons.length == 0) {
+        window.close();
+        return;
+      }
+
       this._addonCount = aAddons.length;
       this._progress.value = 0;
       this._progress.max = aAddons.length;
       this._progress.mode = "determined";
 
       AddonRepository.repopulateCache().then(() => {
         for (let addonItem of aAddons) {
           // Ignore disabled themes
--- a/toolkit/mozapps/extensions/test/browser/browser_select_confirm.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_select_confirm.js
@@ -34,23 +34,24 @@ function waitForView(aView, aCallback) {
  *         True if the test add-ons should claim to have an update available
  */
 function setupUI(aAppDisabled, aUpdateAvailable, aCallback) {
   if (gProvider)
     gProvider.unregister();
 
   gProvider = new MockProvider();
 
-  for (var i = 1; i < 5; i++) {
+  for (var i = 1; i < 6; i++) {
     var addon = new MockAddon("test" + i + "@tests.mozilla.org",
                               "Test Add-on " + i, "extension");
     addon.version = "1.0";
     addon.userDisabled = (i > 2);
     addon.appDisabled = aAppDisabled;
     addon.isActive = !addon.userDisabled && !addon.appDisabled;
+    addon.hidden = i == 5;
 
     addon.findUpdates = function(aListener, aReason, aAppVersion, aPlatformVersion) {
       if (aUpdateAvailable) {
         var newAddon = new MockAddon(this.id, this.name, "extension");
         newAddon.version = "2.0";
         var install = new MockInstall(this.name, this.type, newAddon);
         install.existingAddon = this;
         aListener.onUpdateAvailable(this, install);