Bug 1350064 - test that updated system add-ons are reset on app update r=aswan

MozReview-Commit-ID: BbUtIMfCDXZ

--HG--
extra : rebase_source : f8204c72b482f50d93c0f3e8878cc4fe83ec29a6
This commit is contained in:
Robert Helmer 2017-03-23 18:49:58 -07:00
Родитель d140502cb4
Коммит f7d614dd1b
2 изменённых файлов: 18 добавлений и 7 удалений

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

@ -8660,15 +8660,21 @@ Object.assign(SystemAddonInstallLocation.prototype, {
* Resets the add-on set so on the next startup the default set will be used.
*/
resetAddonSet() {
logger.info("Removing all system add-on upgrades.");
// remove everything from the pref first, if uninstall
// fails then at least they will not be re-activated on
// next restart.
this._saveAddonSet({ schema: 1, addons: {} });
// If this is running at app startup, the pref being cleared
// will cause later stages of startup to notice that the
// old updates are now gone.
//
// Updates will only be explicitly uninstalled if they are
// removed restartlessly, for instance if they are no longer
// part of the latest update set.
if (this._addonSet) {
logger.info("Removing all system add-on upgrades.");
// remove everything from the pref first, if uninstall
// fails then at least they will not be re-activated on
// next restart.
this._saveAddonSet({ schema: 1, addons: {} });
for (let id of Object.keys(this._addonSet.addons)) {
AddonManager.getAddonByID(id, addon => {
if (addon) {

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

@ -359,6 +359,10 @@ add_task(function* test_bad_app_cert() {
distroDir.leafName = "app3";
startupManager();
// Since we updated the app version, the system addon set should be reset as well.
let addonSet = Services.prefs.getCharPref(PREF_SYSTEM_ADDON_SET);
do_check_eq(addonSet, `{"schema":1,"addons":{}}`);
// Add-on will still be present
let addon = yield promiseAddonByID("system1@tests.mozilla.org");
do_check_neq(addon, null);
@ -413,3 +417,4 @@ add_task(function* test_updated() {
yield promiseShutdownManager();
});