Bug 1172708: Don't show the compatibility UI for add-ons that are already compatible.
authorDave Townsend <dtownsend@oxymoronical.com>
Mon, 08 Jun 2015 17:11:48 -0700
changeset 248085 77a1a1eaad91560b18856ebe7da3ca5ae1dba134
parent 248084 d011301ad8be28c2f55720c4a4e3f5465fd9e19c
child 248086 25f2050820ffe5ccd19828451a11f7d011ef584d
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1172708
milestone41.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 1172708: Don't show the compatibility UI for add-ons that are already compatible.
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/test_signed_migrate.js
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -2521,17 +2521,18 @@ this.XPIProvider = {
     logger.debug("shouldForceUpdateCheck startupChanges: " + startupChanges.toSource());
     AddonManagerPrivate.recordSimpleMeasure("XPIDB_startup_disabled", startupChanges.length);
 
     let forceUpdate = [];
     if (startupChanges.length > 0) {
     let addons = XPIDatabase.getAddons();
       for (let addon of addons) {
         if ((startupChanges.indexOf(addon.id) != -1) &&
-            (addon.permissions() & AddonManager.PERM_CAN_UPGRADE)) {
+            (addon.permissions() & AddonManager.PERM_CAN_UPGRADE) &&
+            !addon.isCompatible) {
           logger.debug("shouldForceUpdateCheck: can upgrade disabled add-on " + addon.id);
           forceUpdate.push(addon.id);
         }
       }
     }
 
     if (AddonRepository.isMetadataStale()) {
       logger.debug("shouldForceUpdateCheck: metadata is stale");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_signed_migrate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_signed_migrate.js
@@ -1,12 +1,14 @@
 // Enable signature checks for these tests
 Services.prefs.setBoolPref(PREF_XPI_SIGNATURES_REQUIRED, true);
 // Disable update security
 Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
+// Allow attempting to show the compatibility UI which should not happen
+Services.prefs.setBoolPref("extensions.showMismatchUI", true);
 
 const DATA = "data/signing_checks/";
 const ADDONS = {
   bootstrap: {
     unsigned: "unsigned_bootstrap_2.xpi",
     badid: "signed_bootstrap_badid_2.xpi",
     signed: "signed_bootstrap_2.xpi",
   },
@@ -16,16 +18,36 @@ const ADDONS = {
     signed: "signed_nonbootstrap_2.xpi",
   }
 };
 const ID = "test@tests.mozilla.org";
 
 const profileDir = gProfD.clone();
 profileDir.append("extensions");
 
+// Override the window watcher
+var WindowWatcher = {
+  sawAddon: false,
+
+  openWindow: function(parent, url, name, features, arguments) {
+    let ids = arguments.QueryInterface(AM_Ci.nsIVariant);
+    this.sawAddon = ids.indexOf(ID) >= 0;
+  },
+
+  QueryInterface: function(iid) {
+    if (iid.equals(AM_Ci.nsIWindowWatcher)
+        || iid.equals(AM_Ci.nsISupports))
+      return this;
+
+    throw Components.results.NS_ERROR_NO_INTERFACE;
+  }
+}
+
+MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", WindowWatcher);
+
 function resetPrefs() {
   Services.prefs.setIntPref("bootstraptest.active_version", -1);
   Services.prefs.setIntPref("bootstraptest.installed_version", -1);
   Services.prefs.setIntPref("bootstraptest.startup_reason", -1);
   Services.prefs.setIntPref("bootstraptest.shutdown_reason", -1);
   Services.prefs.setIntPref("bootstraptest.install_reason", -1);
   Services.prefs.setIntPref("bootstraptest.uninstall_reason", -1);
   Services.prefs.setIntPref("bootstraptest.startup_oldversion", -1);
@@ -96,16 +118,20 @@ function* test_breaking_migrate(addons, 
   else
     do_check_false(isExtensionInAddonsList(profileDir, ID));
 
   // Should have flagged the change during startup
   let changes = AddonManager.getStartupChanges(AddonManager.STARTUP_CHANGE_DISABLED);
   do_check_eq(changes.length, 1);
   do_check_eq(changes[0], ID);
 
+  // Shouldn't have checked for updates for the add-on
+  do_check_false(WindowWatcher.sawAddon);
+  WindowWatcher.sawAddon = false;
+
   addon.uninstall();
   // Restart to let non-restartless add-ons uninstall fully
   yield promiseRestartManager();
   yield shutdownManager();
   resetPrefs();
 }
 
 function* test_working_migrate(addons, test, expectedSignedState) {
@@ -136,16 +162,20 @@ function* test_working_migrate(addons, t
   do_check_true(addon.isActive);
   do_check_eq(addon.signedState, expectedSignedState);
 
   if (addons == ADDONS.bootstrap)
     do_check_eq(getActiveVersion(), 2);
   else
     do_check_true(isExtensionInAddonsList(profileDir, ID));
 
+  // Shouldn't have checked for updates for the add-on
+  do_check_false(WindowWatcher.sawAddon);
+  WindowWatcher.sawAddon = false;
+
   addon.uninstall();
   // Restart to let non-restartless add-ons uninstall fully
   yield promiseRestartManager();
   yield shutdownManager();
   resetPrefs();
 }
 
 add_task(function*() {