From ed0ee3dce7b2a5726313d2b5b9c95630d71ab8ca Mon Sep 17 00:00:00 2001 From: Neil Rashbrook Date: Fri, 28 May 2010 10:07:21 +0100 Subject: [PATCH] Bug 563241 Support dynamic skin switching preference r=Mossop --- toolkit/mozapps/extensions/XPIProvider.jsm | 24 +++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/toolkit/mozapps/extensions/XPIProvider.jsm b/toolkit/mozapps/extensions/XPIProvider.jsm index d426329bcbd3..1ef5491e511c 100644 --- a/toolkit/mozapps/extensions/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/XPIProvider.jsm @@ -1956,7 +1956,8 @@ var XPIProvider = { // If the theme we're enabling is the skin currently selected then it doesn't // require a restart to enable it. if (aAddon.type == "theme") - return aAddon.internalName != this.currentSkin; + return aAddon.internalName != this.currentSkin && + !Prefs.getBoolPref(PREF_EM_DSS_ENABLED); return !aAddon.bootstrap; }, @@ -1974,7 +1975,8 @@ var XPIProvider = { // a restart if enabling the other theme does too. If the selected skin doesn't // match the current skin then a restart is necessary. if (aAddon.type == "theme") - return this.selectedSkin != this.currentSkin; + return this.selectedSkin != this.currentSkin && + !Prefs.getBoolPref(PREF_EM_DSS_ENABLED); return !aAddon.bootstrap; }, @@ -1989,7 +1991,8 @@ var XPIProvider = { installRequiresRestart: function XPI_installRequiresRestart(aAddon) { // Themes not currently in use can be installed immediately if (aAddon.type == "theme") - return aAddon.internalName == this.currentSkin; + return aAddon.internalName == this.currentSkin || + Prefs.getBoolPref(PREF_EM_DSS_ENABLED); return !aAddon.bootstrap; }, @@ -2004,7 +2007,8 @@ var XPIProvider = { uninstallRequiresRestart: function XPI_uninstallRequiresRestart(aAddon) { // Themes not currently in use can be uninstalled immediately if (aAddon.type == "theme") - return aAddon.internalName == this.currentSkin; + return aAddon.internalName == this.currentSkin || + Prefs.getBoolPref(PREF_EM_DSS_ENABLED); return !aAddon.bootstrap; }, @@ -2466,6 +2470,7 @@ var XPIDatabase = { "type<>'theme' AND bootstrap=0", getActiveTheme: "SELECT " + FIELDS_ADDON + " FROM addon WHERE " + "internalName=:internalName AND type='theme'", + getThemes: "SELECT " + FIELDS_ADDON + " FROM addon WHERE type='theme'", getAddonInLocation: "SELECT " + FIELDS_ADDON + " FROM addon WHERE id=:id " + "AND location=:location", @@ -3445,7 +3450,7 @@ var XPIDatabase = { updateAddonActive: function XPIDB_updateAddonActive(aAddon) { LOG("Updating add-on state"); - stmt = this.getStatement("updateAddonActive"); + let stmt = this.getStatement("updateAddonActive"); stmt.params.internal_id = aAddon._internal_id; stmt.params.active = aAddon.active ? 1 : 0; executeStatement(stmt); @@ -3490,8 +3495,13 @@ var XPIDatabase = { // The selected skin may come from an inactive theme (the default theme // when a lightweight theme is applied for example) text += "\r\n[ThemeDirs]\r\n"; - stmt = this.getStatement("getActiveTheme"); - stmt.params.internalName = XPIProvider.selectedSkin; + if (Prefs.getBoolPref(PREF_EM_DSS_ENABLED)) { + stmt = this.getStatement("getThemes"); + } + else { + stmt = this.getStatement("getActiveTheme"); + stmt.params.internalName = XPIProvider.selectedSkin; + } count = 0; for (let row in resultRows(stmt)) { // Don't include add-ons that are waiting to be updated