summaryrefslogtreecommitdiffstats
path: root/toolkit/components/cookiebanners/schema
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/components/cookiebanners/schema
parentInitial commit. (diff)
downloadfirefox-upstream.tar.xz
firefox-upstream.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json178
-rw-r--r--toolkit/components/cookiebanners/schema/CookieBannerRuleUI.schema.json31
-rw-r--r--toolkit/components/cookiebanners/schema/README3
3 files changed, 212 insertions, 0 deletions
diff --git a/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json b/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json
new file mode 100644
index 0000000000..b5d963a9f1
--- /dev/null
+++ b/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json
@@ -0,0 +1,178 @@
+{
+ "type": "object",
+ "definitions": {
+ "cookie": {
+ "type": "object",
+ "required": [
+ "name",
+ "value"
+ ],
+ "description": "JSON representation of a cookie to inject.",
+ "properties": {
+ "name": {
+ "title": "Name / Key",
+ "type": "string",
+ "description": "The name of the cookie."
+ },
+ "value": {
+ "title": "Value",
+ "type": "string",
+ "description": "The cookie value."
+ },
+ "host": {
+ "title": "Host",
+ "type": "string",
+ "description": "Host to set cookie for. Defaults to .<domain> if unset."
+ },
+ "path": {
+ "title": "Path",
+ "type": "string",
+ "description": "The path pertaining to the cookie."
+ },
+ "expiryRelative": {
+ "title": "Relative Expiry Time",
+ "type": "number",
+ "description": "Expiry time of the cookie in seconds relative to the injection time. Defaults to pref value for cookiebanners.cookieInjector.defaultExpiryRelative."
+ },
+ "unsetValue": {
+ "title": "Unset Value",
+ "type": "string",
+ "description": "If an existing cookie of the same name sets this value it may be overwritten by this rule."
+ },
+ "isSecure": {
+ "title": "Secure Cookie",
+ "type": "boolean",
+ "description": "true if the cookie was transmitted over ssl, false otherwise."
+ },
+ "sameSite": {
+ "title": "SameSite",
+ "type": "number",
+ "enum": [
+ 0,
+ 1,
+ 2
+ ],
+ "description": "The SameSite attribute. See nsICookie.idl."
+ },
+ "isSession": {
+ "title": "Session Cookie",
+ "type": "boolean",
+ "description": "true if the cookie is a session cookie."
+ },
+ "schemeMap": {
+ "title": "Scheme Map",
+ "type": "number",
+ "description": "Bitmap of schemes."
+ },
+ "isHTTPOnly": {
+ "title": "HTTP-Only",
+ "type": "boolean",
+ "description": "true if the cookie is an http only cookie."
+ }
+ }
+ }
+ },
+ "title": "Cookie Banner Rule",
+ "required": [
+ "id",
+ "domains"
+ ],
+ "additionalProperties": false,
+ "properties": {
+ "id": {
+ "title": "ID",
+ "type": "string",
+ "description": "Unique identifier of the rule."
+ },
+ "domains": {
+ "title": "Domains",
+ "type": ["array"],
+ "items": {
+ "type": "string"
+ },
+ "uniqueItems": true,
+ "description": "List of domains of the sites the rule describes. Leave empty for global rules which should apply to every site."
+ },
+ "cookies": {
+ "title": "Cookies",
+ "description": "Cookie banner related cookies to be injected when the side loads.",
+ "type": "object",
+ "properties": {
+ "optIn": {
+ "title": "Opt-in cookies",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/cookie"
+ },
+ "description": "Cookies to be set to signal opt-in state."
+ },
+ "optOut": {
+ "title": "Opt-out cookies",
+ "type": "array",
+ "items": {
+ "$ref": "#/definitions/cookie"
+ },
+ "description": "Cookies to be set to signal opt-out state."
+ }
+ }
+ },
+ "click": {
+ "title": "Click",
+ "description": "Rules for detection of the cookie banner and simulated clicks.",
+ "type": "object",
+ "properties": {
+ "presence": {
+ "title": "Presence Selector",
+ "type": "string",
+ "description": "Query selector to detect cookie banner element."
+ },
+ "skipPresenceVisibilityCheck": {
+ "title": "Skip Presence Visibility Check",
+ "type": "boolean",
+ "description": "Whether to skip checking if the banner is visible before clicking it."
+ },
+ "runContext": {
+ "title": "Run Context",
+ "type": "string",
+ "enum": [
+ "top",
+ "child",
+ "all"
+ ],
+ "description": "Where the click rule should be executed. Defaults to only top window. top: Only in the top window; child: Only in child frames; all: Both top window and child frames."
+ },
+ "hide": {
+ "title": "Hide Selector",
+ "type": "string",
+ "description": "Query selector for element to hide while handling cookie banner. Defaults to 'presence' selector."
+ },
+ "optOut": {
+ "title": "Opt-out Selector",
+ "type": "string",
+ "description": "Query selector for opt-out / reject all button"
+ },
+ "optIn": {
+ "title": "Opt-in Selector",
+ "type": "string",
+ "description": "Query selector for opt-in / accept all button"
+ }
+ },
+ "dependencies": {
+ "hide": [
+ "presence"
+ ],
+ "optOut": [
+ "presence"
+ ],
+ "optIn": [
+ "presence"
+ ]
+ }
+ },
+ "filter_expression": {
+ "type": "string",
+ "description": "This is NOT used by the cookie banner handling feature, but has special functionality in Remote Settings. See https://remote-settings.readthedocs.io/en/latest/target-filters.html#how"
+ }
+ },
+ "description": "Rule containing instructions on how to handle a cookie banner on a specific site."
+}
diff --git a/toolkit/components/cookiebanners/schema/CookieBannerRuleUI.schema.json b/toolkit/components/cookiebanners/schema/CookieBannerRuleUI.schema.json
new file mode 100644
index 0000000000..f66f190626
--- /dev/null
+++ b/toolkit/components/cookiebanners/schema/CookieBannerRuleUI.schema.json
@@ -0,0 +1,31 @@
+{
+ "click": {
+ "ui:order": [
+ "presence",
+ "skipPresenceVisibilityCheck",
+ "hide",
+ "optOut",
+ "optIn",
+ "runContext"
+ ]
+ },
+ "domains": {
+ "ui:title": "Domains"
+ },
+ "cookies": {
+ "ui:order": [
+ "optOut",
+ "optIn"
+ ]
+ },
+ "filter_expression": {
+ "ui:title": "RemoteSettings Filter Expression"
+ },
+ "ui:order": [
+ "id",
+ "domains",
+ "cookies",
+ "click",
+ "filter_expression"
+ ]
+}
diff --git a/toolkit/components/cookiebanners/schema/README b/toolkit/components/cookiebanners/schema/README
new file mode 100644
index 0000000000..74bae19265
--- /dev/null
+++ b/toolkit/components/cookiebanners/schema/README
@@ -0,0 +1,3 @@
+This directory contains the JSON schemas used for the Remote Settings collection
+which stores cookie banner rules. It is used locally to validate test rules
+imported via pref.