Bug 1767266 - Make ExtensionDoorhanger.schema.json more lenient r=Mardak

Differential Revision: https://phabricator.services.mozilla.com/D145241
This commit is contained in:
Barret Rennie 2022-05-03 16:37:19 +00:00
parent 7b78f5e339
commit 217dd347c1
2 changed files with 38 additions and 1 deletions

View File

@ -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"]
}

View File

@ -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"
);
});