diff --git a/browser/components/newtab/content-src/asrouter/templates/CFR/templates/ExtensionDoorhanger.schema.json b/browser/components/newtab/content-src/asrouter/templates/CFR/templates/ExtensionDoorhanger.schema.json index 5f08da04f5b9..84e2803b6fb7 100644 --- a/browser/components/newtab/content-src/asrouter/templates/CFR/templates/ExtensionDoorhanger.schema.json +++ b/browser/components/newtab/content-src/asrouter/templates/CFR/templates/ExtensionDoorhanger.schema.json @@ -387,7 +387,7 @@ } } }, - "additionalProperties": false, + "additionalProperties": true, "required": [ "layout", "category", @@ -427,5 +427,6 @@ "required": ["id"] } }, + "additionalProperties": true, "required": ["id", "groups", "content", "targeting", "template", "trigger"] } diff --git a/browser/components/newtab/test/xpcshell/test_PanelTestProvider.js b/browser/components/newtab/test/xpcshell/test_PanelTestProvider.js index 05bb896d1438..d6f1ccc734fe 100644 --- a/browser/components/newtab/test/xpcshell/test_PanelTestProvider.js +++ b/browser/components/newtab/test/xpcshell/test_PanelTestProvider.js @@ -10,6 +10,7 @@ const { JsonSchema } = ChromeUtils.import( Cu.importGlobalProperties(["fetch"]); +let CFR_SCHEMA; let UPDATE_ACTION_SCHEMA; let WHATS_NEW_SCHEMA; let SPOTLIGHT_SCHEMA; @@ -20,6 +21,9 @@ add_setup(async function setup() { return fetch(uri, { credentials: "omit" }).then(rsp => rsp.json()); } + CFR_SCHEMA = await fetchSchema( + "resource://activity-stream/schemas/CFR/ExtensionDoorhanger.schema.json" + ); UPDATE_ACTION_SCHEMA = await fetchSchema( "resource://activity-stream/schemas/OnboardingMessage/UpdateAction.schema.json" ); @@ -103,3 +107,35 @@ add_task(async function test_PanelTestProvider() { "There is one pb_newtab message" ); }); + +add_task(async function test_SpotlightAsCFR() { + let message = await PanelTestProvider.getMessages().then(msgs => + msgs.find(msg => msg.id === "TCP_SPOTLIGHT_MESSAGE_95") + ); + + message = { + ...message, + content: { + ...message.content, + category: "", + layout: "icon_and_message", + bucket_id: "", + notification_text: "", + heading_text: "", + text: "", + buttons: {}, + }, + }; + + assertSchema( + message, + CFR_SCHEMA, + "Munged spotlight message validates with CFR ExtensionDoorhanger schema" + ); + + assertSchema( + message, + SPOTLIGHT_SCHEMA, + "Munged Spotlight message validates with Spotlight schema" + ); +});