Bug 1365509: Special case handling of enabled state for XUL themes. r?rhelmer draft
authorKris Maglione <maglione.k@gmail.com>
Wed, 17 May 2017 13:48:47 -0700
changeset 579852 f0ce0e47812e64a8bef91115dcfe99c62ba46923
parent 579851 eb62e04d0570b8edda3149f5564ef42286e8617d
child 579853 d9fe525f493d234d2684f09802fe7cda698b9b59
push id59381
push usermaglione.k@gmail.com
push dateWed, 17 May 2017 20:53:16 +0000
reviewersrhelmer
bugs1365509
milestone55.0a1
Bug 1365509: Special case handling of enabled state for XUL themes. r?rhelmer Legacy XUL themes are treated specially for chrome registration when a lightweight theme is enabled. In those cases, all XUL themes are marked as disabled for the purposes of UI, but chrome for the default theme still needs to be loaded. So we need to treate the `selectedTheme` as enabled for chrome registration purposes regardless of its database disabled state. MozReview-Commit-ID: EZLckFhftqt
toolkit/mozapps/extensions/internal/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -2394,17 +2394,25 @@ class XPIState {
   syncWithDB(aDBAddon, aUpdated = false) {
     logger.debug("Updating XPIState for " + JSON.stringify(aDBAddon));
     // If the add-on changes from disabled to enabled, we should re-check the modified time.
     // If this is a newly found add-on, it won't have an 'enabled' field but we
     // did a full recursive scan in that case, so we don't need to do it again.
     // We don't use aDBAddon.active here because it's not updated until after restart.
     let mustGetMod = (aDBAddon.visible && !aDBAddon.disabled && !this.enabled);
 
-    this.enabled = aDBAddon.visible && !aDBAddon.disabled;
+    // We need to treat XUL themes specially here, since lightweight
+    // themes require the default theme's chrome to be registered even
+    // though we report it as disabled for UI purposes.
+    if (aDBAddon.type == "theme") {
+      this.enabled = aDBAddon.internalName == XPIProvider.selectedSkin;
+    } else {
+      this.enabled = aDBAddon.visible && !aDBAddon.disabled;
+    }
+
     this.version = aDBAddon.version;
     this.type = aDBAddon.type;
     this.enableShims = this.type == "extension" && !aDBAddon.multiprocessCompatible;
 
     this.bootstrapped = !!aDBAddon.bootstrap;
     if (this.bootstrapped) {
       this.hasEmbeddedWebExtension = aDBAddon.hasEmbeddedWebExtension;
       this.dependencies = aDBAddon.dependencies;