Bug 1435191 - Enforce limit in additional_backgrounds field
This patch adds a check to make sure themes do not load more than 15 images, when making use of via additional_backgrounds property. If there are more than 15 images, theme will not be loaded.
MozReview-Commit-ID: 9ogj4asv9cq
--- a/toolkit/components/extensions/parent/ext-theme.js
+++ b/toolkit/components/extensions/parent/ext-theme.js
@@ -80,17 +80,20 @@ class Theme {
this.loadIcons(details.icons);
}
if (details.properties) {
this.loadProperties(details.properties);
}
// Lightweight themes require accentcolor and textcolor to be defined.
- if (this.lwtStyles.accentcolor &&
+ // If lightweight themes have additionalBackgrounds, it should have no more than 15 images
+ if (this.lwtStyles.additionalBackgrounds && this.lwtStyles.additionalBackgrounds.length > 15) {
+ this.logger.warn("Your theme includes more than 15 images in images: 'additional_backgrounds'");
+ } else if (this.lwtStyles.accentcolor &&
this.lwtStyles.textcolor) {
if (this.windowId) {
windowOverrides.set(this.windowId, this);
} else {
windowOverrides.clear();
defaultTheme = this;
}
onUpdatedEmitter.emit("theme-updated", this.details, this.windowId);