Bug 1440069 - Don't try to resolve empty headerURLs. r=aswan
MozReview-Commit-ID: ILMx3aNOJxV
--- a/toolkit/components/extensions/schemas/theme.json
+++ b/toolkit/components/extensions/schemas/theme.json
@@ -37,34 +37,46 @@
"maxItems": 4,
"items": {
"type": "number"
}
}
]
},
{
+ "id": "ThemeImage",
+ "choices": [
+ {
+ "type": "string",
+ "enum": [""]
+ },
+ {
+ "$ref": "ImageDataOrExtensionURL"
+ }
+ ]
+ },
+ {
"id": "ThemeType",
"type": "object",
"properties": {
"images": {
"type": "object",
"optional": true,
"properties": {
"additional_backgrounds": {
"type": "array",
- "items": { "$ref": "ImageDataOrExtensionURL" },
+ "items": { "$ref": "ThemeImage" },
"optional": true
},
"headerURL": {
- "$ref": "ImageDataOrExtensionURL",
+ "$ref": "ThemeImage",
"optional": true
},
"theme_frame": {
- "$ref": "ImageDataOrExtensionURL",
+ "$ref": "ThemeImage",
"optional": true
}
},
"additionalProperties": { "$ref": "UnrecognizedProperty" }
},
"colors": {
"type": "object",
"optional": true,
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_lwtsupport.js
+++ b/toolkit/components/extensions/test/browser/browser_ext_themes_lwtsupport.js
@@ -63,16 +63,66 @@ add_task(async function test_LWT_image_a
let docEl = window.document.documentElement;
Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
Assert.ok(!docEl.hasAttribute("lwtheme-image"), "LWT image attribute should not be set");
await extension.unload();
Assert.ok(!docEl.hasAttribute("lwtheme"), "LWT attribute should not be set");
Assert.ok(!docEl.hasAttribute("lwtheme-image"), "LWT image attribute should not be set");
});
+add_task(async function test_LWT_image_attribute_with_empty_headerURL() {
+ let extension = ExtensionTestUtils.loadExtension({
+ manifest: {
+ "theme": {
+ "images": {
+ "headerURL": ""
+ },
+ "colors": {
+ "accentcolor": ACCENT_COLOR,
+ "textcolor": TEXT_COLOR,
+ },
+ },
+ },
+ });
+
+ await extension.startup();
+
+ let docEl = window.document.documentElement;
+ Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
+ Assert.ok(!docEl.hasAttribute("lwtheme-image"), "LWT image attribute should not be set");
+ await extension.unload();
+ Assert.ok(!docEl.hasAttribute("lwtheme"), "LWT attribute should not be set");
+ Assert.ok(!docEl.hasAttribute("lwtheme-image"), "LWT image attribute should not be set");
+});
+
+add_task(async function test_LWT_image_attribute_with_empty_theme_frame() {
+ let extension = ExtensionTestUtils.loadExtension({
+ manifest: {
+ "theme": {
+ "images": {
+ "theme_frame": ""
+ },
+ "colors": {
+ "accentcolor": ACCENT_COLOR,
+ "textcolor": TEXT_COLOR,
+ },
+ },
+ },
+ });
+
+ await extension.startup();
+
+ let docEl = window.document.documentElement;
+ Assert.ok(docEl.hasAttribute("lwtheme"), "LWT attribute should be set");
+ Assert.ok(!docEl.hasAttribute("lwtheme-image"), "LWT image attribute should not be set");
+ await extension.unload();
+ Assert.ok(!docEl.hasAttribute("lwtheme"), "LWT attribute should not be set");
+ Assert.ok(!docEl.hasAttribute("lwtheme-image"), "LWT image attribute should not be set");
+});
+
add_task(async function test_LWT_requires_accentcolor_defined_textcolor_only() {
let extension = ExtensionTestUtils.loadExtension({
manifest: {
"theme": {
"colors": {
"textcolor": TEXT_COLOR,
},
},