Bug 1964116 - Update infobar schema to reflect that 'text' can be an array r=jprickett,omc-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D247646
This commit is contained in:
committed by
mviar@mozilla.com
parent
b61f8c3281
commit
d42d78e05a
@@ -556,8 +556,62 @@
|
||||
]
|
||||
},
|
||||
"text": {
|
||||
"$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText",
|
||||
"description": "The text show in the notification box."
|
||||
"description": "Either a single localizableText, or an array of raw strings and/or localizableText objects. localizableText can contain an optional href property for the text to be rendered as a link.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/plainText"
|
||||
},
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText"
|
||||
},
|
||||
{
|
||||
"not": {
|
||||
"required": [
|
||||
"href"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/localizableTextWithHref"
|
||||
},
|
||||
{
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/rawTextWithHref"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/plainText"
|
||||
},
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText"
|
||||
},
|
||||
{
|
||||
"not": {
|
||||
"required": [
|
||||
"href"
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/localizableTextWithHref"
|
||||
},
|
||||
{
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/rawTextWithHref"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"priority": {
|
||||
"description": "Infobar priority level https://searchfox.org/mozilla-central/rev/3aef835f6cb12e607154d56d68726767172571e4/toolkit/content/widgets/notificationbox.js#387",
|
||||
@@ -640,6 +694,43 @@
|
||||
"description": "Target for links or buttons",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"localizableTextWithHref": {
|
||||
"description": "Everything a localizableText allows, plus a required href",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": {
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/linkUrl"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"href"
|
||||
],
|
||||
"additionalProperties": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"rawTextWithHref": {
|
||||
"description": "A literal text chunk that must include href",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"raw": {
|
||||
"type": "string"
|
||||
},
|
||||
"href": {
|
||||
"$ref": "file:///InfoBar.schema.json#/$defs/linkUrl"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"raw",
|
||||
"href"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -15,8 +15,38 @@
|
||||
"enum": ["global", "tab", "universal"]
|
||||
},
|
||||
"text": {
|
||||
"$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText",
|
||||
"description": "The text show in the notification box."
|
||||
"description": "Either a single localizableText, or an array of raw strings and/or localizableText objects. localizableText can contain an optional href property for the text to be rendered as a link.",
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/plainText" },
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText"
|
||||
},
|
||||
{ "not": { "required": ["href"] } }
|
||||
]
|
||||
},
|
||||
{ "$ref": "#/$defs/localizableTextWithHref" },
|
||||
{ "$ref": "#/$defs/rawTextWithHref" },
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"oneOf": [
|
||||
{ "$ref": "#/$defs/plainText" },
|
||||
{
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText"
|
||||
},
|
||||
{ "not": { "required": ["href"] } }
|
||||
]
|
||||
},
|
||||
{ "$ref": "#/$defs/localizableTextWithHref" },
|
||||
{ "$ref": "#/$defs/rawTextWithHref" }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"priority": {
|
||||
"description": "Infobar priority level https://searchfox.org/mozilla-central/rev/3aef835f6cb12e607154d56d68726767172571e4/toolkit/content/widgets/notificationbox.js#387",
|
||||
@@ -88,6 +118,30 @@
|
||||
"description": "Target for links or buttons",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"localizableTextWithHref": {
|
||||
"description": "Everything a localizableText allows, plus a required href",
|
||||
"allOf": [
|
||||
{ "$ref": "file:///FxMSCommon.schema.json#/$defs/localizableText" },
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"href": { "$ref": "#/$defs/linkUrl" }
|
||||
},
|
||||
"required": ["href"],
|
||||
"additionalProperties": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"rawTextWithHref": {
|
||||
"description": "A literal text chunk that must include href",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"raw": { "type": "string" },
|
||||
"href": { "$ref": "#/$defs/linkUrl" }
|
||||
},
|
||||
"required": ["raw", "href"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1570,6 +1570,48 @@ const MESSAGES = () => [
|
||||
},
|
||||
groups: [],
|
||||
},
|
||||
{
|
||||
id: "UNIVERSAL_INFOBAR_WITH_EMBEDDED_LINKS",
|
||||
content: {
|
||||
text: [
|
||||
"Read the release notes ",
|
||||
{
|
||||
raw: "here. ",
|
||||
href: "https://www.mozilla.org/en-US/firefox/releases/",
|
||||
},
|
||||
{
|
||||
string_id: "cookie-banner-blocker-onboarding-learn-more",
|
||||
href: "https://mozilla.org/privacy/firefox/?v=product",
|
||||
},
|
||||
"!",
|
||||
],
|
||||
type: "universal",
|
||||
dismissable: false,
|
||||
buttons: [
|
||||
{
|
||||
label: "Continue",
|
||||
action: {
|
||||
type: "SET_PREF",
|
||||
data: {
|
||||
pref: {
|
||||
name: "universal-infobar-test-pref",
|
||||
value: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
primary: true,
|
||||
accessKey: "C",
|
||||
},
|
||||
],
|
||||
},
|
||||
trigger: {
|
||||
id: "defaultBrowserCheck",
|
||||
},
|
||||
template: "infobar",
|
||||
frequency: {
|
||||
lifetime: 100,
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export const PanelTestProvider = {
|
||||
|
||||
@@ -29,6 +29,7 @@ add_task(async function test_PanelTestProvider() {
|
||||
bookmarks_bar_button: 1,
|
||||
menu_message: 1,
|
||||
newtab_message: 2,
|
||||
infobar: 1,
|
||||
};
|
||||
|
||||
const EXPECTED_TOTAL_MESSAGE_COUNT = Object.values(
|
||||
|
||||
Reference in New Issue
Block a user