Skip to content

Commit

Permalink
Bug 704987: Ignore the hotfix add-on when warning users about incompa…
Browse files Browse the repository at this point in the history
…tible add-ons. r=robstrong, a=akeybl
  • Loading branch information
Mossop committed Jan 10, 2012
1 parent e78c29f commit 3691c0d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
12 changes: 10 additions & 2 deletions browser/base/content/aboutDialog.js
Expand Up @@ -40,6 +40,8 @@
// Services = object with smart getters for common XPCOM services
Components.utils.import("resource://gre/modules/Services.jsm");

const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";

function init(aEvent)
{
if (aEvent.target != document)
Expand Down Expand Up @@ -378,6 +380,11 @@ appUpdater.prototype =
* Checks the compatibility of add-ons for the application update.
*/
checkAddonCompatibility: function() {
try {
var hotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
}
catch (e) { }

var self = this;
AddonManager.getAllAddons(function(aAddons) {
self.addons = [];
Expand All @@ -402,9 +409,10 @@ appUpdater.prototype =
// incompatible. If an addon's type equals plugin it is skipped since
// checking plugins compatibility information isn't supported and
// getting the scope property of a plugin breaks in some environments
// (see bug 566787).
// (see bug 566787). The hotfix add-on is also ignored as it shouldn't
// block the user from upgrading.
try {
if (aAddon.type != "plugin" &&
if (aAddon.type != "plugin" && aAddon.id != hotfixID &&
!aAddon.appDisabled && !aAddon.userDisabled &&
aAddon.scope != AddonManager.SCOPE_APPLICATION &&
aAddon.isCompatible &&
Expand Down
8 changes: 7 additions & 1 deletion toolkit/mozapps/extensions/content/update.js
Expand Up @@ -42,6 +42,7 @@

const PREF_UPDATE_EXTENSIONS_ENABLED = "extensions.update.enabled";
const PREF_XPINSTALL_ENABLED = "xpinstall.enabled";
const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";

Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
Expand Down Expand Up @@ -159,10 +160,15 @@ var gVersionInfoPage = {
"nextButtonText", true,
"cancelButtonText", false);

try {
var hotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
}
catch (e) { }

// Retrieve all add-ons in order to sync their app compatibility information
AddonManager.getAllAddons(function(aAddons) {
gUpdateWizard.addons = aAddons.filter(function(a) {
return a.type != "plugin";
return a.type != "plugin" && a.id != hotfixID;
});

gVersionInfoPage._totalCount = gUpdateWizard.addons.length;
Expand Down
12 changes: 10 additions & 2 deletions toolkit/mozapps/update/content/updates.js
Expand Up @@ -60,6 +60,8 @@ const PREF_APP_UPDATE_NEVER_BRANCH = "app.update.never.";
const PREF_APP_UPDATE_TEST_LOOP = "app.update.test.loop";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";

const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";

const UPDATE_TEST_LOOP_INTERVAL = 2000;

const URI_UPDATES_PROPERTIES = "chrome://mozapps/locale/update/updates.properties";
Expand Down Expand Up @@ -521,6 +523,11 @@ var gUpdates = {
return;
}

try {
var hotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
}
catch (e) { }

var self = this;
AddonManager.getAllAddons(function(addons) {
self.addons = [];
Expand All @@ -544,9 +551,10 @@ var gUpdates = {
// incompatible. If an addon's type equals plugin it is skipped since
// checking plugins compatibility information isn't supported and
// getting the scope property of a plugin breaks in some environments
// (see bug 566787).
// (see bug 566787). The hotfix add-on is also ignored as it shouldn't
// block the user from upgrading.
try {
if (addon.type != "plugin" &&
if (addon.type != "plugin" && addon.id != hotfixID &&
!addon.appDisabled && !addon.userDisabled &&
addon.scope != AddonManager.SCOPE_APPLICATION &&
addon.isCompatible &&
Expand Down
12 changes: 10 additions & 2 deletions toolkit/mozapps/update/nsUpdateService.js
Expand Up @@ -86,6 +86,8 @@ const PREF_PARTNER_BRANCH = "app.partner.";
const PREF_APP_DISTRIBUTION = "distribution.id";
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";

const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";

const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul";
const URI_UPDATE_HISTORY_DIALOG = "chrome://mozapps/content/update/history.xul";
const URI_BRAND_PROPERTIES = "chrome://branding/locale/brand.properties";
Expand Down Expand Up @@ -1657,6 +1659,11 @@ UpdateService.prototype = {
},

_checkAddonCompatibility: function AUS__checkAddonCompatibility() {
try {
var hotfixID = Services.prefs.getCharPref(PREF_EM_HOTFIX_ID);
}
catch (e) { }

// Get all the installed add-ons
var self = this;
AddonManager.getAllAddons(function(addons) {
Expand All @@ -1681,9 +1688,10 @@ UpdateService.prototype = {
// incompatible. If an addon's type equals plugin it is skipped since
// checking plugins compatibility information isn't supported and
// getting the scope property of a plugin breaks in some environments
// (see bug 566787).
// (see bug 566787). The hotfix add-on is also ignored as it shouldn't
// block the user from upgrading.
try {
if (addon.type != "plugin" &&
if (addon.type != "plugin" && addon.id != hotfixID &&
!addon.appDisabled && !addon.userDisabled &&
addon.scope != AddonManager.SCOPE_APPLICATION &&
addon.isCompatible &&
Expand Down
8 changes: 7 additions & 1 deletion toolkit/mozapps/update/test/chrome/utils.js
Expand Up @@ -146,12 +146,13 @@ const ADDON_PREP_DIR = "appupdateprep";
// Preference for storing add-ons that are disabled by the tests to prevent them
// from interefering with the tests.
const PREF_DISABLEDADDONS = "app.update.test.disabledAddons";
const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";
const TEST_ADDONS = [ "appdisabled_1", "appdisabled_2",
"compatible_1", "compatible_2",
"noupdate_1", "noupdate_2",
"updatecompatibility_1", "updatecompatibility_2",
"updateversion_1", "updateversion_2",
"userdisabled_1", "userdisabled_2" ];
"userdisabled_1", "userdisabled_2", "hotfix" ];


const TEST_TIMEOUT = 25000; // 25 seconds
Expand Down Expand Up @@ -817,6 +818,7 @@ function setupPrefs() {
Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0);
Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 0);
Services.prefs.setBoolPref(PREF_EXTENSIONS_STRICT_COMPAT, true);
Services.prefs.setCharPref(PREF_EM_HOTFIX_ID, "hotfix" + ADDON_ID_SUFFIX);
}

/**
Expand Down Expand Up @@ -918,6 +920,10 @@ function resetPrefs() {
if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_STRICT_COMPAT)) {
Services.prefs.clearUserPref(PREF_EXTENSIONS_STRICT_COMPAT);
}

if (Services.prefs.prefHasUserValue(PREF_EM_HOTFIX_ID)) {
Services.prefs.clearUserPref(PREF_EM_HOTFIX_ID);
}
}

/**
Expand Down

0 comments on commit 3691c0d

Please sign in to comment.