From 9e0ef2b077c8e7a63fd9220b7c3f2d26921f3dff Mon Sep 17 00:00:00 2001 From: Mike de Boer Date: Wed, 5 Apr 2017 16:27:25 +0200 Subject: [PATCH] Bug 1347226 - prevent an error thrown by LightWeightThemeManager when a temporary WebExtension theme addon is installed and make sure it's enabled correctly in the Addon Manager. r=mossop This is done by adding a check to LWTManager that ensures only valid LWTs are enabled/ disabled there. The temporary addon install flow never had to deal with addons that would be disabled by default before. Since WebExtension themes are, we need to explicitly set `userDisabled = true`. MozReview-Commit-ID: IkdNAq97cxI --HG-- extra : rebase_source : 7e78db34cbf20a8ff6e6f1574581ff15fba3a37e --- toolkit/mozapps/extensions/LightweightThemeManager.jsm | 3 +++ toolkit/mozapps/extensions/internal/XPIProvider.jsm | 2 ++ 2 files changed, 5 insertions(+) diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index bb1a5628ce73..e62d4554967f 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -402,6 +402,9 @@ this.LightweightThemeManager = { if (id) { let theme = this.getUsedTheme(id); + // WebExtension themes have an ID, but no LWT wrapper, so bail out here. + if (!theme) + return; _themeIDBeingEnabled = id; let wrapper = new AddonWrapper(theme); if (aPendingRestart) { diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm index 22fb510d76d4..ba36e7661a6e 100644 --- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm +++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm @@ -4124,6 +4124,8 @@ this.XPIProvider = { addon.visible = true; addon.enabled = true; addon.active = true; + // WebExtension themes are installed as disabled, fix that here. + addon.userDisabled = false; addon = XPIDatabase.addAddonMetadata(addon, file.persistentDescriptor);