Ignore static theme updates if dynamic theme had been applied
Categories
(WebExtensions :: Themes, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: robwu, Unassigned)
References
Details
In bug 1928082, the default theme was re-installed at every startup due to a bug. Because static themes are applied when they are started, the user-perceived bug was the loss of dynamic themes (from theme.update()
, e.g. from the Firefox Color extension). The impact of the other bug was reduced by avoiding re-installation of themes at every startup, but the root cause for the observed issue is still present: dynamic themes are lost when a static theme is updated, even if that static theme was supposed to be overridden by the dynamic theme.
We should prevent static theme updates from overriding theme.update()
calls. If theme.update()
has been called, we should only permit modification of the theme if:
theme.update()
is called again by the same or another extension. (already happening)- A static theme is installed. (already happening)
The global theme should not be applied in the following situations:
- A static theme was updated. (this is new behavior)
To implement this, we could restrict the theme loading in onManifestEntry
, to only proceed if any of the following is true:
defaultTheme === emptyTheme
(this should cover every usual situation)defaultTheme.extension?.id === extension.id
(in caseonShutdown
is not run (e.g. due to bug 1782620)defaultTheme.extension?.type == "theme"
(the Add-on Manager ensures that eventually only one theme is active, but in theory more than one could be active at that time)
Concretely, not applying the theme means to not initialize the Theme
instance (returning early from onManifestEntry
). This fixes the issue because the Theme
constructor calls load()
, which is responsible for the activation of the theme.
Updated•4 months ago
|
Description
•