mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-11 14:28:42 +00:00
Bug 629237: If a user has turned off updates for individual add-ons then they should not be included in the metadata ping. r=Unfocused, a=blocks-final
This commit is contained in:
parent
c6d7905e27
commit
f2fd9b56c8
@ -348,12 +348,6 @@ var AddonManagerInternal = {
|
||||
scope.LightweightThemeManager.updateCurrentTheme();
|
||||
|
||||
this.getAllAddons(function getAddonsCallback(aAddons) {
|
||||
if ("getCachedAddonByID" in scope.AddonRepository) {
|
||||
pendingUpdates++;
|
||||
var ids = [a.id for each (a in aAddons)];
|
||||
scope.AddonRepository.repopulateCache(ids, notifyComplete);
|
||||
}
|
||||
|
||||
pendingUpdates += aAddons.length;
|
||||
var autoUpdateDefault = AddonManager.autoUpdateDefault;
|
||||
|
||||
@ -367,7 +361,12 @@ var AddonManagerInternal = {
|
||||
return autoUpdateDefault;
|
||||
}
|
||||
|
||||
var ids = [];
|
||||
|
||||
aAddons.forEach(function BUC_forEachCallback(aAddon) {
|
||||
if (shouldAutoUpdate(aAddon))
|
||||
ids.push(aAddon.id);
|
||||
|
||||
// Check all add-ons for updates so that any compatibility updates will
|
||||
// be applied
|
||||
aAddon.findUpdates({
|
||||
@ -384,6 +383,11 @@ var AddonManagerInternal = {
|
||||
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
|
||||
});
|
||||
|
||||
if (ids.length > 0) {
|
||||
pendingUpdates++;
|
||||
scope.AddonRepository.repopulateCache(ids, notifyComplete);
|
||||
}
|
||||
|
||||
notifyComplete();
|
||||
});
|
||||
},
|
||||
|
@ -14,6 +14,7 @@ const BASE_URL = "http://localhost:" + PORT;
|
||||
|
||||
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
|
||||
const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
|
||||
const PREF_EM_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
|
||||
const GETADDONS_RESULTS = BASE_URL + "/data/test_AddonRepository_cache.xml";
|
||||
const GETADDONS_EMPTY = BASE_URL + "/data/test_AddonRepository_empty.xml";
|
||||
const GETADDONS_FAILED = BASE_URL + "/data/test_AddonRepository_failed.xml";
|
||||
@ -596,7 +597,49 @@ function run_test_14() {
|
||||
|
||||
AddonManager.getAddonsByIDs(ADDON_IDS, function(aAddons) {
|
||||
check_results(aAddons, WITHOUT_CACHE);
|
||||
run_test_15();
|
||||
run_test_14_1();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Tests that the XPI add-ons have the correct properties if caching is
|
||||
// enabled but updates are disabled by default
|
||||
function run_test_14_1() {
|
||||
Services.prefs.setBoolPref(PREF_EM_AUTOUPDATE_DEFAULT, false);
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_RESULTS);
|
||||
|
||||
trigger_background_update(function() {
|
||||
check_database_exists(true);
|
||||
|
||||
AddonManager.getAddonsByIDs(ADDON_IDS, function(aAddons) {
|
||||
check_results(aAddons, WITHOUT_CACHE);
|
||||
run_test_14_2();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Tests that the XPI add-ons have the correct properties if caching is
|
||||
// enabled but updates are disabled by individually
|
||||
function run_test_14_2() {
|
||||
Services.prefs.setBoolPref(PREF_EM_AUTOUPDATE_DEFAULT, true);
|
||||
|
||||
AddonManager.getAddonsByIDs(ADDON_IDS, function(aAddons) {
|
||||
aAddons.forEach(function(aAddon) {
|
||||
aAddon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DISABLE;
|
||||
});
|
||||
|
||||
trigger_background_update(function() {
|
||||
check_database_exists(true);
|
||||
|
||||
AddonManager.getAddonsByIDs(ADDON_IDS, function(aAddons) {
|
||||
check_results(aAddons, WITHOUT_CACHE);
|
||||
|
||||
aAddons.forEach(function(aAddon) {
|
||||
aAddon.applyBackgroundUpdates = AddonManager.AUTOUPDATE_DEFAULT;
|
||||
});
|
||||
|
||||
run_test_15();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -604,8 +647,6 @@ function run_test_14() {
|
||||
// Tests that the XPI add-ons correctly use the repository properties when
|
||||
// caching is enabled and the repository information is available
|
||||
function run_test_15() {
|
||||
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, GETADDONS_RESULTS);
|
||||
|
||||
trigger_background_update(function() {
|
||||
AddonManager.getAddonsByIDs(ADDON_IDS, function(aAddons) {
|
||||
check_results(aAddons, WITH_CACHE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user