From def92d1b8e9d373e2f6f27c366d578d97d8960c6 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 15 May 2024 05:34:50 +0200 Subject: Merging upstream version 126.0. Signed-off-by: Daniel Baumann --- .../BackgroundTaskMessagingExperiment.schema.json | 69 +++- .../schemas/MessagingExperiment.schema.json | 415 ++++++++++++--------- .../asrouter/content-src/schemas/make-schemas.py | 3 - 3 files changed, 300 insertions(+), 187 deletions(-) (limited to 'browser/components/asrouter/content-src/schemas') diff --git a/browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json b/browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json index 9de01052f7..5fe86f9617 100644 --- a/browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json +++ b/browser/components/asrouter/content-src/schemas/BackgroundTaskMessagingExperiment.schema.json @@ -10,7 +10,9 @@ "const": "multi" } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/MultiMessage" @@ -68,7 +70,9 @@ "type": "object" } }, - "required": ["type"], + "required": [ + "type" + ], "additionalProperties": true }, "requireInteraction": { @@ -116,24 +120,37 @@ "type": "object" } }, - "required": ["type"], + "required": [ + "type" + ], "additionalProperties": true } }, - "required": ["action", "title"], + "required": [ + "action", + "title" + ], "additionalProperties": true } } }, "additionalProperties": true, - "required": ["title", "body"] + "required": [ + "title", + "body" + ] }, "template": { "type": "string", "const": "toast_notification" } }, - "required": ["content", "targeting", "template", "trigger"], + "required": [ + "content", + "targeting", + "template", + "trigger" + ], "additionalProperties": true }, "Message": { @@ -154,7 +171,9 @@ "template": { "type": "string", "description": "Which messaging template this message is using.", - "enum": ["toast_notification"] + "enum": [ + "toast_notification" + ] }, "frequency": { "type": "object", @@ -184,7 +203,10 @@ "maximum": 100 } }, - "required": ["period", "cap"] + "required": [ + "period", + "cap" + ] } } } @@ -224,7 +246,9 @@ } } }, - "required": ["id"] + "required": [ + "id" + ] }, "provider": { "description": "An identifier for the provider of this message, such as \"cfr\" or \"preview\".", @@ -233,8 +257,14 @@ }, "additionalProperties": true, "dependentRequired": { - "content": ["id", "template"], - "template": ["id", "content"] + "content": [ + "id", + "template" + ], + "template": [ + "id", + "content" + ] } }, "localizedText": { @@ -245,7 +275,9 @@ "type": "string" } }, - "required": ["string_id"] + "required": [ + "string_id" + ] }, "localizableText": { "description": "Either a raw string or an object containing the string_id of the localized text", @@ -272,10 +304,14 @@ "properties": { "template": { "type": "string", - "enum": ["toast_notification"] + "enum": [ + "toast_notification" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/BackgroundTaskMessagingExperiment.schema.json#/$defs/ToastNotification" @@ -299,7 +335,10 @@ } } }, - "required": ["template", "messages"] + "required": [ + "template", + "messages" + ] } } } diff --git a/browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json b/browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json index fbabb109f8..dd4ce4776d 100644 --- a/browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json +++ b/browser/components/asrouter/content-src/schemas/MessagingExperiment.schema.json @@ -10,7 +10,9 @@ "const": "multi" } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/MultiMessage" @@ -41,7 +43,9 @@ "layout": { "type": "string", "description": "Describes how content should be displayed.", - "enum": ["chiclet_open_url"] + "enum": [ + "chiclet_open_url" + ] }, "bucket_id": { "type": "string", @@ -66,11 +70,17 @@ "where": { "description": "Should it open in a new tab or the current tab", "type": "string", - "enum": ["current", "tabshifted"] + "enum": [ + "current", + "tabshifted" + ] } }, "additionalProperties": true, - "required": ["url", "where"] + "required": [ + "url", + "where" + ] } }, "additionalProperties": true, @@ -87,7 +97,10 @@ "const": "cfr_urlbar_chiclet" } }, - "required": ["targeting", "trigger"] + "required": [ + "targeting", + "trigger" + ] }, "ExtensionDoorhanger": { "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -162,10 +175,14 @@ "description": "Text for button tooltip used to provide information about the doorhanger." } }, - "required": ["tooltiptext"] + "required": [ + "tooltiptext" + ] } }, - "required": ["attributes"] + "required": [ + "attributes" + ] }, { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizedText" @@ -185,7 +202,10 @@ "learn_more": { "type": "string", "description": "Last part of the path in the SUMO URL to the support page with the information about the doorhanger.", - "examples": ["extensionpromotions", "extensionrecommendations"] + "examples": [ + "extensionpromotions", + "extensionrecommendations" + ] }, "heading_text": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", @@ -236,7 +256,12 @@ "description": "Link that offers more information related to the addon." } }, - "required": ["title", "author", "icon", "amo_url"] + "required": [ + "title", + "author", + "icon", + "amo_url" + ] }, "text": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", @@ -255,7 +280,9 @@ } } }, - "required": ["steps"] + "required": [ + "steps" + ] }, "buttons": { "description": "The label and functionality for the buttons in the pop-over.", @@ -281,11 +308,16 @@ "description": "A single character to be used as a shortcut key for the secondary button. This should be one of the characters that appears in the button label." } }, - "required": ["accesskey"], + "required": [ + "accesskey" + ], "description": "Button attributes." } }, - "required": ["value", "attributes"] + "required": [ + "value", + "attributes" + ] }, { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizedText" @@ -341,11 +373,16 @@ "description": "A single character to be used as a shortcut key for the secondary button. This should be one of the characters that appears in the button label." } }, - "required": ["accesskey"], + "required": [ + "accesskey" + ], "description": "Button attributes." } }, - "required": ["value", "attributes"] + "required": [ + "value", + "attributes" + ] }, { "properties": { @@ -360,7 +397,9 @@ ] } }, - "required": ["string_id"] + "required": [ + "string_id" + ] } ], "description": "Id of localized string or message override." @@ -417,16 +456,25 @@ } }, "then": { - "required": ["category", "notification_text"] + "required": [ + "category", + "notification_text" + ] } }, "template": { "type": "string", - "enum": ["cfr_doorhanger", "milestone_message"] + "enum": [ + "cfr_doorhanger", + "milestone_message" + ] } }, "additionalProperties": true, - "required": ["targeting", "trigger"], + "required": [ + "targeting", + "trigger" + ], "$defs": { "plainText": { "description": "Plain text (no HTML allowed)", @@ -457,7 +505,10 @@ "type": { "type": "string", "description": "Should the message be global (persisted across tabs) or local (disappear when switching to a different tab).", - "enum": ["global", "tab"] + "enum": [ + "global", + "tab" + ] }, "text": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", @@ -497,7 +548,9 @@ "type": "object" } }, - "required": ["type"], + "required": [ + "type" + ], "additionalProperties": true }, "supportPage": { @@ -505,13 +558,19 @@ "description": "A page title on SUMO to link to" } }, - "required": ["label", "action"], + "required": [ + "label", + "action" + ], "additionalProperties": true } } }, "additionalProperties": true, - "required": ["text", "buttons"] + "required": [ + "text", + "buttons" + ] }, "template": { "type": "string", @@ -519,7 +578,10 @@ } }, "additionalProperties": true, - "required": ["targeting", "trigger"], + "required": [ + "targeting", + "trigger" + ], "$defs": { "plainText": { "description": "Plain text (no HTML allowed)", @@ -587,12 +649,22 @@ "promoType": { "type": "string", "description": "Promo type used to determine if promo should show to a given user", - "enum": ["FOCUS", "VPN", "PIN", "COOKIE_BANNERS", "OTHER"] + "enum": [ + "FOCUS", + "VPN", + "PIN", + "COOKIE_BANNERS", + "OTHER" + ] }, "promoSectionStyle": { "type": "string", "description": "Sets the position of the promo section. Possible values are: top, below-search, bottom. Default bottom.", - "enum": ["top", "below-search", "bottom"] + "enum": [ + "top", + "below-search", + "bottom" + ] }, "promoTitle": { "type": "string", @@ -624,16 +696,23 @@ "type": "object" } }, - "required": ["type"], + "required": [ + "type" + ], "additionalProperties": true } }, - "required": ["action"] + "required": [ + "action" + ] }, "promoLinkType": { "type": "string", "description": "Type of promo link type. Possible values: link, button. Default is link.", - "enum": ["link", "button"] + "enum": [ + "link", + "button" + ] }, "promoImageLarge": { "type": "string", @@ -655,10 +734,14 @@ "const": true } }, - "required": ["promoEnabled"] + "required": [ + "promoEnabled" + ] }, "then": { - "required": ["promoButton"] + "required": [ + "promoButton" + ] } }, { @@ -668,20 +751,28 @@ "const": true } }, - "required": ["infoEnabled"] + "required": [ + "infoEnabled" + ] }, "then": { - "required": ["infoLinkText"], + "required": [ + "infoLinkText" + ], "if": { "properties": { "infoTitleEnabled": { "const": true } }, - "required": ["infoTitleEnabled"] + "required": [ + "infoTitleEnabled" + ] }, "then": { - "required": ["infoTitle"] + "required": [ + "infoTitle" + ] } } } @@ -693,7 +784,9 @@ } }, "additionalProperties": true, - "required": ["targeting"] + "required": [ + "targeting" + ] }, "Spotlight": { "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -763,11 +856,16 @@ "template": { "type": "string", "description": "Specify whether the surface is shown as a Spotlight modal or an in-surface Feature Callout dialog", - "enum": ["spotlight", "feature_callout"] + "enum": [ + "spotlight", + "feature_callout" + ] } }, "additionalProperties": true, - "required": ["targeting"] + "required": [ + "targeting" + ] }, "ToastNotification": { "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -818,7 +916,9 @@ "type": "object" } }, - "required": ["type"], + "required": [ + "type" + ], "additionalProperties": true }, "requireInteraction": { @@ -866,24 +966,37 @@ "type": "object" } }, - "required": ["type"], + "required": [ + "type" + ], "additionalProperties": true } }, - "required": ["action", "title"], + "required": [ + "action", + "title" + ], "additionalProperties": true } } }, "additionalProperties": true, - "required": ["title", "body"] + "required": [ + "title", + "body" + ] }, "template": { "type": "string", "const": "toast_notification" } }, - "required": ["content", "targeting", "template", "trigger"], + "required": [ + "content", + "targeting", + "template", + "trigger" + ], "additionalProperties": true }, "ToolbarBadgeMessage": { @@ -912,7 +1025,9 @@ } }, "additionalProperties": true, - "required": ["id"], + "required": [ + "id" + ], "description": "Optional action to take in addition to showing the notification" }, "delay": { @@ -925,7 +1040,9 @@ } }, "additionalProperties": true, - "required": ["target"] + "required": [ + "target" + ] }, "template": { "type": "string", @@ -933,7 +1050,9 @@ } }, "additionalProperties": true, - "required": ["targeting"] + "required": [ + "targeting" + ] }, "UpdateAction": { "$schema": "https://json-schema.org/draft/2019-09/schema", @@ -973,101 +1092,25 @@ }, "additionalProperties": true, "description": "Optional action to take in addition to showing the notification", - "required": ["id", "data"] - } - }, - "additionalProperties": true, - "required": ["action"] - }, - "template": { - "type": "string", - "const": "update_action" - } - }, - "required": ["targeting"] - }, - "WhatsNewMessage": { - "$schema": "https://json-schema.org/draft/2019-09/schema", - "$id": "file:///WhatsNewMessage.schema.json", - "title": "WhatsNewMessage", - "description": "A template for the messages that appear in the What's New panel.", - "allOf": [ - { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/Message" - } - ], - "type": "object", - "properties": { - "content": { - "type": "object", - "properties": { - "layout": { - "description": "Different message layouts", - "enum": ["tracking-protections"] - }, - "bucket_id": { - "type": "string", - "description": "A bucket identifier for the addon. This is used in order to anonymize telemetry for history-sensitive targeting." - }, - "published_date": { - "type": "integer", - "description": "The date/time (number of milliseconds elapsed since January 1, 1970 00:00:00 UTC) the message was published." - }, - "title": { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", - "description": "Id of localized string or message override of What's New message title" - }, - "subtitle": { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", - "description": "Id of localized string or message override of What's New message subtitle" - }, - "body": { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", - "description": "Id of localized string or message override of What's New message body" - }, - "link_text": { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", - "description": "(optional) Id of localized string or message override of What's New message link text" - }, - "cta_url": { - "description": "Target URL for the What's New message.", - "type": "string", - "format": "moz-url-format" - }, - "cta_type": { - "description": "Type of url open action", - "enum": ["OPEN_URL", "OPEN_ABOUT_PAGE", "OPEN_PROTECTION_REPORT"] - }, - "cta_where": { - "description": "How to open the cta: new window, tab, focused, unfocused.", - "enum": ["current", "tabshifted", "tab", "save", "window"] - }, - "icon_url": { - "description": "(optional) URL for the What's New message icon.", - "type": "string", - "format": "uri" - }, - "icon_alt": { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/localizableText", - "description": "Alt text for image." + "required": [ + "id", + "data" + ] } }, "additionalProperties": true, "required": [ - "published_date", - "title", - "body", - "cta_url", - "bucket_id" + "action" ] }, "template": { "type": "string", - "const": "whatsnew_panel_message" + "const": "update_action" } }, - "required": ["order"], - "additionalProperties": true + "required": [ + "targeting" + ] }, "Message": { "type": "object", @@ -1097,8 +1140,7 @@ "feature_callout", "toast_notification", "toolbar_badge", - "update_action", - "whatsnew_panel_message" + "update_action" ] }, "frequency": { @@ -1129,7 +1171,10 @@ "maximum": 100 } }, - "required": ["period", "cap"] + "required": [ + "period", + "cap" + ] } } } @@ -1169,7 +1214,9 @@ } } }, - "required": ["id"] + "required": [ + "id" + ] }, "provider": { "description": "An identifier for the provider of this message, such as \"cfr\" or \"preview\".", @@ -1178,8 +1225,14 @@ }, "additionalProperties": true, "dependentRequired": { - "content": ["id", "template"], - "template": ["id", "content"] + "content": [ + "id", + "template" + ], + "template": [ + "id", + "content" + ] } }, "localizedText": { @@ -1190,7 +1243,9 @@ "type": "string" } }, - "required": ["string_id"] + "required": [ + "string_id" + ] }, "localizableText": { "description": "Either a raw string or an object containing the string_id of the localized text", @@ -1217,10 +1272,14 @@ "properties": { "template": { "type": "string", - "enum": ["cfr_urlbar_chiclet"] + "enum": [ + "cfr_urlbar_chiclet" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/CFRUrlbarChiclet" @@ -1232,10 +1291,15 @@ "properties": { "template": { "type": "string", - "enum": ["cfr_doorhanger", "milestone_message"] + "enum": [ + "cfr_doorhanger", + "milestone_message" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/ExtensionDoorhanger" @@ -1247,10 +1311,14 @@ "properties": { "template": { "type": "string", - "enum": ["infobar"] + "enum": [ + "infobar" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/InfoBar" @@ -1262,10 +1330,14 @@ "properties": { "template": { "type": "string", - "enum": ["pb_newtab"] + "enum": [ + "pb_newtab" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/NewtabPromoMessage" @@ -1277,10 +1349,15 @@ "properties": { "template": { "type": "string", - "enum": ["spotlight", "feature_callout"] + "enum": [ + "spotlight", + "feature_callout" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/Spotlight" @@ -1292,10 +1369,14 @@ "properties": { "template": { "type": "string", - "enum": ["toast_notification"] + "enum": [ + "toast_notification" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/ToastNotification" @@ -1307,10 +1388,14 @@ "properties": { "template": { "type": "string", - "enum": ["toolbar_badge"] + "enum": [ + "toolbar_badge" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/ToolbarBadgeMessage" @@ -1322,29 +1407,18 @@ "properties": { "template": { "type": "string", - "enum": ["update_action"] + "enum": [ + "update_action" + ] } }, - "required": ["template"] + "required": [ + "template" + ] }, "then": { "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/UpdateAction" } - }, - { - "if": { - "type": "object", - "properties": { - "template": { - "type": "string", - "enum": ["whatsnew_panel_message"] - } - }, - "required": ["template"] - }, - "then": { - "$ref": "chrome://browser/content/asrouter/schemas/MessagingExperiment.schema.json#/$defs/WhatsNewMessage" - } } ] }, @@ -1364,7 +1438,10 @@ } } }, - "required": ["template", "messages"] + "required": [ + "template", + "messages" + ] } } } diff --git a/browser/components/asrouter/content-src/schemas/make-schemas.py b/browser/components/asrouter/content-src/schemas/make-schemas.py index f66490f23a..1f677cab28 100755 --- a/browser/components/asrouter/content-src/schemas/make-schemas.py +++ b/browser/components/asrouter/content-src/schemas/make-schemas.py @@ -83,9 +83,6 @@ SCHEMAS = [ "UpdateAction": ( SCHEMA_DIR / "OnboardingMessage" / "UpdateAction.schema.json" ), - "WhatsNewMessage": ( - SCHEMA_DIR / "OnboardingMessage" / "WhatsNewMessage.schema.json" - ), }, bundle_common=True, test_corpus={ -- cgit v1.2.3