Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebExtension Manifest Version 3 #4357

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
162 changes: 108 additions & 54 deletions src/schemas/json/webextension.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,65 @@
"required": ["manifest_version", "name", "version"],
"type": "object",
"additionalProperties": true,
"if": {
"properties": {
"manifest_version": {
"const": 2
}
}
},
"then": {
"properties": {
"browser_action": {
"$ref": "#/definitions/action",
"description": "A browser action is a button that your extension adds to the browser's toolbar. The button has an icon, and may optionally have a popup whose content is specified using HTML, CSS, and JavaScript.\n\nThis key is replaced by action in Manifest V3 extensions.\n\nIf you supply a popup, then the popup is opened when the user clicks the button, and your JavaScript running in the popup can handle the user's interaction with it. If you don't supply a popup, then a click event is dispatched to your extension's background scripts when the user clicks the button.\n\nYou can also create and manipulate browser actions programmatically using the browserAction API.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action"
},
"options_ui": {
"properties": {
"browser_style": {
"description": "Use this to include a stylesheet in your page that will make it look consistent with the browser's UI and with other add-ons that use the browser_style property.",
"type": "boolean",
"default": true
}
}
}
},
"definitions": {
"common_action": {
"properties": {
"browser_style": {
"description": "Your extension can include user interface elements - browser and page action popups, sidebars, and options pages - that are specified by:\n1. creating an HTML file defining the structure of the UI element.\n2. adding a manifest.json key (action, browser_action, page_action, sidebar_action, or options_ui) pointing to that HTML file.\n\nYou can style these elements to match the browser's style. The manifest.json keys include an optional property to help with this: browser_style. If this is included and set to true, your document gets one or more extra stylesheets that help make it look consistent with the browser's UI and with other extensions that use the browser_style property.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles",
"type": "boolean",
"default": false
}
}
},
"sidebar_action": {
"properties": {
"browser_style": {
"description": "In Firefox, the stylesheet can be seen at chrome://browser/content/extension.css or chrome://browser/content/extension-mac.css on macOS.",
"type": "boolean",
"default": true
}
}
}
}
},
"else": {
"properties": {
"action": {
"$ref": "#/definitions/action",
"description": "An action is a button that your extension adds to the browser's toolbar. The button has an icon, and may optionally have a popup whose content is specified using HTML, CSS, and JavaScript.\n\nThis key replaces browser_action in Manifest V3 extensions.\n\nYou must specify this key to include a browser toolbar button in your extension. When specified, you can manipulate the button programmatically using the action API.\n\nIf you supply a popup, then the popup is opened when the user clicks the button, and your JavaScript running in the popup can handle the user's interaction with it. If you don't supply a popup, then a click event is dispatched to your extension's background scripts when the user clicks the button."
},
"background": {
"properties": {
"persistent": {
"const": false
}
}
}
}
},
"properties": {
"author": {
"description": "The extension's author, intended for display in the browser's user interface. If the developer key is supplied and it contains the \"name`\" property, it will override the author key. There's no way to specify multiple authors.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/author",
Expand Down Expand Up @@ -43,46 +102,6 @@
}
}
},
"browser_action": {
"$ref": "#/definitions/common_action",
"title": "extension button",
"description": "A browser action is a button that your extension adds to the browser's toolbar. The button has an icon, and may optionally have a popup whose content is specified using HTML, CSS, and JavaScript.\n\nThis key is replaced by action in Manifest V3 extensions.\n\nIf you supply a popup, then the popup is opened when the user clicks the button, and your JavaScript running in the popup can handle the user's interaction with it. If you don't supply a popup, then a click event is dispatched to your extension's background scripts when the user clicks the button.\n\nYou can also create and manipulate browser actions programmatically using the browserAction API.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_action",
"type": "object",
"properties": {
"default_area": {
"description": "Defines the part of the browser in which the button is initially placed.\n\nThis property is only supported in Firefox.",
"enum": ["navbar", "menupanel", "tabstrip", "personaltoolbar"],
"default": "menupanel"
},
"theme_icons": {
"description": "This property enables you to specify different icons for themes depending on whether Firefox detects that the theme uses dark or light text.",
"type": "array",
"items": {
"title": "theme icon",
"type": "object",
"additionalProperties": false,
"required": ["dark", "light", "size"],
"properties": {
"dark": {
"description": "A URL pointing to an icon. This icon displays when a theme using dark text is active (such as the Firefox Light theme, and the Default theme if no default_icon is specified).\n\nIcons are specified as URLs relative to the manifest.json file.",
"type": "string",
"format": "uri-reference"
},
"light": {
"description": "A URL pointing to an icon. This icon displays when a theme using light text is active (such as the Firefox Dark theme).\n\nIcons are specified as URLs relative to the manifest.json file.",
"type": "string",
"format": "uri-reference"
},
"size": {
"description": "The size of the two icons in pixels.",
"type": "integer",
"enum": [16, 32]
}
}
}
}
}
},
"browser_specific_settings": {
"title": "browser specific settings",
"description": "The browser_specific_settings key contains keys that are specific to a particular host application.",
Expand Down Expand Up @@ -468,7 +487,7 @@
"manifest_version": {
"description": "This key specifies the version of manifest.json used by this extension.<br><br>https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/manifest_version",
"type": "integer",
"enum": [2]
"enum": [2, 3]
},
"name": {
"description": "Name of the extension. This is used to identify the extension in the browser's user interface and on sites like addons.mozilla.org.<br>It's good practice to keep the name short enough to display in the UI. Also, the length of the name of a published extension may be limited.<br>These restrictions do not apply to self-hosted extensions or extensions distributed outside the stores.<br>This is a localizable property.<br><br>https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/name",
Expand Down Expand Up @@ -560,9 +579,7 @@
"format": "uri-reference"
},
"browser_style": {
"default": true,
"type": "boolean",
"description": "Use this to include a stylesheet in your page that will make it look consistent with the browser's UI and with other add-ons that use the browser_style property."
"$ref": "#/definitions/browser_style"
},
"open_in_tab": {
"default": false,
Expand Down Expand Up @@ -738,11 +755,6 @@
"additionalProperties": false,
"required": ["default_panel"],
"properties": {
"browser_style": {
"description": "In Firefox, the stylesheet can be seen at chrome://browser/content/extension.css or chrome://browser/content/extension-mac.css on macOS.",
"type": "boolean",
"default": true
},
"default_icon": {
"$ref": "#/definitions/icon"
},
Expand Down Expand Up @@ -1059,6 +1071,50 @@
}
},
"definitions": {
"action": {
"$ref": "#/definitions/common_action",
"title": "extension button",
"type": "object",
"properties": {
"default_area": {
"description": "Defines the part of the browser in which the button is initially placed.\n\nThis property is only supported in Firefox.",
"enum": ["navbar", "menupanel", "tabstrip", "personaltoolbar"],
"default": "menupanel"
},
"theme_icons": {
"description": "This property enables you to specify different icons for themes depending on whether Firefox detects that the theme uses dark or light text.",
"type": "array",
"items": {
"title": "theme icon",
"type": "object",
"additionalProperties": false,
"required": ["dark", "light", "size"],
"properties": {
"dark": {
"description": "A URL pointing to an icon. This icon displays when a theme using dark text is active (such as the Firefox Light theme, and the Default theme if no default_icon is specified).\n\nIcons are specified as URLs relative to the manifest.json file.",
"type": "string",
"format": "uri-reference"
},
"light": {
"description": "A URL pointing to an icon. This icon displays when a theme using light text is active (such as the Firefox Dark theme).\n\nIcons are specified as URLs relative to the manifest.json file.",
"type": "string",
"format": "uri-reference"
},
"size": {
"description": "The size of the two icons in pixels.",
"type": "integer",
"enum": [16, 32]
}
}
}
}
}
},
"browser_style": {
"deprecated": true,
"description": "Do not set browser_style to true: its not support in Manifest V3 from Firefox 118. See Manifest V3 migration for browser_style.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles#manifest_v3_migration",
"const": false
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now included browser_style, even in v3. The docs do claim the whole property is unsupported in v3, however they also say you may set it to false, so I've added their deprecation message, marked the property deprecated (even tho that's not part of the current spec) and set it to "const": "false".

"color": {
"oneOf": [
{
Expand Down Expand Up @@ -1125,11 +1181,6 @@
},
"common_action": {
"properties": {
"browser_style": {
"description": "Your extension can include user interface elements - browser and page action popups, sidebars, and options pages - that are specified by:\n1. creating an HTML file defining the structure of the UI element.\n2. adding a manifest.json key (action, browser_action, page_action, sidebar_action, or options_ui) pointing to that HTML file.\n\nYou can style these elements to match the browser's style. The manifest.json keys include an optional property to help with this: browser_style. If this is included and set to true, your document gets one or more extra stylesheets that help make it look consistent with the browser's UI and with other extensions that use the browser_style property.\n\nhttps://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Browser_styles",
"type": "boolean",
"default": false
},
"default_icon": {
"$ref": "#/definitions/icon",
"description": " Use this to specify one or more icons for the browser action. The icon is shown in the browser toolbar by default.\n\nIcons are specified as URLs relative to the manifest.json file itself.\n\nYou can specify a single icon file by supplying a string here\n\nTo specify multiple icons in different sizes, specify an object here. The name of each property is the icon's height in pixels, and must be convertible to an integer. The value is the URL."
Expand All @@ -1142,6 +1193,9 @@
"default_title": {
"description": "Tooltip for the button, displayed when the user moves their mouse over it. If the button is added to the browser's menu panel, this is also shown under the app icon.\n\nThis is a localizable property.",
"type": "string"
},
"browser_style": {
"$ref": "#/definitions/browser_style"
}
}
},
Expand Down
Loading