Bug 1172708: Don't show the compatibility UI for add-ons that are already compatible.

--HG--
extra : commitid : 2CEYshL981Y
extra : rebase_source : fe78ca0b8015626dbb72943d46a43a689c63042d
This commit is contained in:
Dave Townsend 2015-06-08 17:11:48 -07:00
Родитель 9756960806
Коммит b50a7602c6
2 изменённых файлов: 32 добавлений и 1 удалений

Просмотреть файл

@ -2526,7 +2526,8 @@ this.XPIProvider = {
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);
}

Просмотреть файл

@ -2,6 +2,8 @@
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 = {
@ -21,6 +23,26 @@ 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);
@ -101,6 +123,10 @@ function* test_breaking_migrate(addons, test, expectedSignedState) {
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();
@ -141,6 +167,10 @@ function* test_working_migrate(addons, test, expectedSignedState) {
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();