diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /browser/components/extensions/schemas | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/extensions/schemas')
25 files changed, 6612 insertions, 0 deletions
diff --git a/browser/components/extensions/schemas/LICENSE-CHROMIUM b/browser/components/extensions/schemas/LICENSE-CHROMIUM new file mode 100644 index 0000000000..9314092fdc --- /dev/null +++ b/browser/components/extensions/schemas/LICENSE-CHROMIUM @@ -0,0 +1,27 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/browser/components/extensions/schemas/README.md b/browser/components/extensions/schemas/README.md new file mode 100644 index 0000000000..790fcd648e --- /dev/null +++ b/browser/components/extensions/schemas/README.md @@ -0,0 +1,13 @@ +This source code is available under the [Mozilla Public License 2.0](/LICENSE). + +Additionally, parts of the schema files originated from Chromium source code: + +> Copyright (c) 2012 The Chromium Authors. All rights reserved. +> Use of this source code is governed by a BSD-style license that can be +> found in the [LICENSE-CHROMIUM](LICENSE-CHROMIUM) file. + +You are not granted rights or licenses to the trademarks of the +Mozilla Foundation or any party, including without limitation the +Firefox name or logo. + +For more information, see: https://www.mozilla.org/foundation/licensing.html diff --git a/browser/components/extensions/schemas/bookmarks.json b/browser/components/extensions/schemas/bookmarks.json new file mode 100644 index 0000000000..2b4ead7baa --- /dev/null +++ b/browser/components/extensions/schemas/bookmarks.json @@ -0,0 +1,550 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["bookmarks"] + } + ] + } + ] + }, + { + "namespace": "bookmarks", + "description": "Use the <code>browser.bookmarks</code> API to create, organize, and otherwise manipulate bookmarks. Also see $(topic:override)[Override Pages], which you can use to create a custom Bookmark Manager page.", + "permissions": ["bookmarks"], + "types": [ + { + "id": "BookmarkTreeNodeUnmodifiable", + "type": "string", + "enum": ["managed"], + "description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)." + }, + { + "id": "BookmarkTreeNodeType", + "type": "string", + "enum": ["bookmark", "folder", "separator"], + "description": "Indicates the type of a BookmarkTreeNode, which can be one of bookmark, folder or separator." + }, + { + "id": "BookmarkTreeNode", + "type": "object", + "description": "A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the node. IDs are unique within the current profile, and they remain valid even after the browser is restarted." + }, + "parentId": { + "type": "string", + "optional": true, + "description": "The <code>id</code> of the parent folder. Omitted for the root node." + }, + "index": { + "type": "integer", + "optional": true, + "description": "The 0-based position of this node within its parent folder." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL navigated to when a user clicks the bookmark. Omitted for folders." + }, + "title": { + "type": "string", + "description": "The text displayed for the node." + }, + "dateAdded": { + "type": "number", + "optional": true, + "description": "When this node was created, in milliseconds since the epoch (<code>new Date(dateAdded)</code>)." + }, + "dateGroupModified": { + "type": "number", + "optional": true, + "description": "When the contents of this folder last changed, in milliseconds since the epoch." + }, + "unmodifiable": { + "$ref": "BookmarkTreeNodeUnmodifiable", + "optional": true, + "description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)." + }, + "type": { + "$ref": "BookmarkTreeNodeType", + "optional": true, + "description": "Indicates the type of the BookmarkTreeNode, which can be one of bookmark, folder or separator." + }, + "children": { + "type": "array", + "optional": true, + "items": { "$ref": "BookmarkTreeNode" }, + "description": "An ordered list of children of this node." + } + } + }, + { + "id": "CreateDetails", + "description": "Object passed to the create() function.", + "type": "object", + "properties": { + "parentId": { + "type": "string", + "optional": true, + "description": "Defaults to the Other Bookmarks folder." + }, + "index": { + "type": "integer", + "minimum": 0, + "optional": true + }, + "title": { + "type": "string", + "optional": true + }, + "url": { + "type": "string", + "optional": true + }, + "type": { + "$ref": "BookmarkTreeNodeType", + "optional": true, + "description": "Indicates the type of BookmarkTreeNode to create, which can be one of bookmark, folder or separator." + } + } + } + ], + "functions": [ + { + "name": "get", + "type": "function", + "description": "Retrieves the specified BookmarkTreeNode(s).", + "async": "callback", + "parameters": [ + { + "name": "idOrIdList", + "description": "A single string-valued id, or an array of string-valued ids", + "choices": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + }, + "minItems": 1 + } + ] + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getChildren", + "type": "function", + "description": "Retrieves the children of the specified BookmarkTreeNode id.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getRecent", + "type": "function", + "description": "Retrieves the recently added bookmarks.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "minimum": 1, + "name": "numberOfItems", + "description": "The maximum number of items to return." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getTree", + "type": "function", + "description": "Retrieves the entire Bookmarks hierarchy.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "getSubTree", + "type": "function", + "description": "Retrieves part of the Bookmarks hierarchy, starting at the specified node.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id", + "description": "The ID of the root of the subtree to retrieve." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "search", + "type": "function", + "description": "Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.", + "async": "callback", + "parameters": [ + { + "name": "query", + "description": "Either a string of words that are matched against bookmark URLs and titles, or an object. If an object, the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all specified properties will be produced.", + "choices": [ + { + "type": "string", + "description": "A string of words that are matched against bookmark URLs and titles." + }, + { + "type": "object", + "description": "An object specifying properties and values to match when searching. Produces bookmarks matching all properties.", + "properties": { + "query": { + "type": "string", + "optional": true, + "description": "A string of words that are matched against bookmark URLs and titles." + }, + "url": { + "type": "string", + "format": "url", + "optional": true, + "description": "The URL of the bookmark; matches verbatim. Note that folders have no URL." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the bookmark; matches verbatim." + } + } + } + ] + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "BookmarkTreeNode" } + } + ] + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.", + "async": "callback", + "parameters": [ + { + "$ref": "CreateDetails", + "name": "bookmark" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "BookmarkTreeNode" + } + ] + } + ] + }, + { + "name": "move", + "type": "function", + "description": "Moves the specified BookmarkTreeNode to the provided location.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "destination", + "properties": { + "parentId": { + "type": "string", + "optional": true + }, + "index": { + "type": "integer", + "minimum": 0, + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "BookmarkTreeNode" + } + ] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. <b>Note:</b> Currently, only 'title' and 'url' are supported.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "changes", + "properties": { + "title": { + "type": "string", + "optional": true + }, + "url": { + "type": "string", + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "BookmarkTreeNode" + } + ] + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes a bookmark or an empty bookmark folder.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeTree", + "type": "function", + "description": "Recursively removes a bookmark folder.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onCreated", + "type": "function", + "description": "Fired when a bookmark or folder is created.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "$ref": "BookmarkTreeNode", + "name": "bookmark" + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "removeInfo", + "properties": { + "parentId": { "type": "string" }, + "index": { "type": "integer" }, + "node": { "$ref": "BookmarkTreeNode" } + } + } + ] + }, + { + "name": "onChanged", + "type": "function", + "description": "Fired when a bookmark or folder changes. <b>Note:</b> Currently, only title and url changes trigger this.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "changeInfo", + "properties": { + "title": { "type": "string" }, + "url": { + "type": "string", + "optional": true + } + } + } + ] + }, + { + "name": "onMoved", + "type": "function", + "description": "Fired when a bookmark or folder is moved to a different parent folder.", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "moveInfo", + "properties": { + "parentId": { "type": "string" }, + "index": { "type": "integer" }, + "oldParentId": { "type": "string" }, + "oldIndex": { "type": "integer" } + } + } + ] + }, + { + "name": "onChildrenReordered", + "unsupported": true, + "type": "function", + "description": "Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move().", + "parameters": [ + { + "type": "string", + "name": "id" + }, + { + "type": "object", + "name": "reorderInfo", + "properties": { + "childIds": { + "type": "array", + "items": { "type": "string" } + } + } + } + ] + }, + { + "name": "onImportBegan", + "unsupported": true, + "type": "function", + "description": "Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately.", + "parameters": [] + }, + { + "name": "onImportEnded", + "unsupported": true, + "type": "function", + "description": "Fired when a bookmark import session is ended.", + "parameters": [] + } + ] + } +] diff --git a/browser/components/extensions/schemas/chrome_settings_overrides.json b/browser/components/extensions/schemas/chrome_settings_overrides.json new file mode 100644 index 0000000000..623c747105 --- /dev/null +++ b/browser/components/extensions/schemas/chrome_settings_overrides.json @@ -0,0 +1,207 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "chrome_settings_overrides": { + "type": "object", + "optional": true, + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "homepage": { + "type": "string", + "format": "homepageUrl", + "optional": true, + "preprocess": "localize" + }, + "search_provider": { + "type": "object", + "optional": true, + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "name": { + "type": "string", + "preprocess": "localize" + }, + "keyword": { + "optional": true, + "choices": [ + { + "type": "string", + "preprocess": "localize" + }, + { + "type": "array", + "items": { + "type": "string", + "preprocess": "localize" + }, + "minItems": 1 + } + ] + }, + "search_url": { + "type": "string", + "format": "url", + "pattern": "^(https://|http://(localhost|127\\.0\\.0\\.1|\\[::1\\])(:\\d*)?(/|$)).*$", + "preprocess": "localize" + }, + "favicon_url": { + "choices": [ + { + "type": "string", + "format": "relativeUrl", + "max_manifest_version": 2 + }, + { + "type": "string", + "format": "strictRelativeUrl" + } + ], + "optional": true, + "preprocess": "localize" + }, + "suggest_url": { + "type": "string", + "optional": true, + "pattern": "^$|^(https://|http://(localhost|127\\.0\\.0\\.1|\\[::1\\])(:\\d*)?(/|$)).*$", + "preprocess": "localize" + }, + "instant_url": { + "type": "string", + "optional": true, + "format": "url", + "preprocess": "localize", + "deprecated": "Unsupported on Firefox at this time." + }, + "image_url": { + "type": "string", + "optional": true, + "format": "url", + "preprocess": "localize", + "deprecated": "Unsupported on Firefox at this time." + }, + "search_url_get_params": { + "type": "string", + "optional": true, + "preprocess": "localize", + "description": "GET parameters to the search_url as a query string." + }, + "search_url_post_params": { + "type": "string", + "optional": true, + "preprocess": "localize", + "description": "POST parameters to the search_url as a query string." + }, + "suggest_url_get_params": { + "type": "string", + "optional": true, + "preprocess": "localize", + "description": "GET parameters to the suggest_url as a query string." + }, + "suggest_url_post_params": { + "type": "string", + "optional": true, + "preprocess": "localize", + "description": "POST parameters to the suggest_url as a query string." + }, + "instant_url_post_params": { + "type": "string", + "optional": true, + "preprocess": "localize", + "deprecated": "Unsupported on Firefox at this time." + }, + "image_url_post_params": { + "type": "string", + "optional": true, + "preprocess": "localize", + "deprecated": "Unsupported on Firefox at this time." + }, + "search_form": { + "type": "string", + "optional": true, + "format": "url", + "pattern": "^(https://|http://(localhost|127\\.0\\.0\\.1|\\[::1\\])(:\\d*)?(/|$)).*$", + "preprocess": "localize" + }, + "alternate_urls": { + "type": "array", + "items": { + "type": "string", + "format": "url", + "preprocess": "localize" + }, + "optional": true, + "deprecated": "Unsupported on Firefox at this time." + }, + "prepopulated_id": { + "type": "integer", + "optional": true, + "deprecated": "Unsupported on Firefox." + }, + "encoding": { + "type": "string", + "optional": true, + "description": "Encoding of the search term." + }, + "is_default": { + "type": "boolean", + "optional": true, + "description": "Sets the default engine to a built-in engine only." + }, + "params": { + "optional": true, + "max_manifest_version": 2, + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "A url parameter name" + }, + "condition": { + "type": "string", + "optional": true, + "enum": ["purpose", "pref"], + "description": "The type of param can be either \"purpose\" or \"pref\"." + }, + "pref": { + "type": "string", + "optional": true, + "description": "The preference to retrieve the value from.", + "preprocess": "localize" + }, + "purpose": { + "type": "string", + "optional": true, + "enum": [ + "contextmenu", + "searchbar", + "homepage", + "keyword", + "newtab" + ], + "description": "The context that initiates a search, required if condition is \"purpose\"." + }, + "value": { + "type": "string", + "optional": true, + "description": "A url parameter value.", + "preprocess": "localize" + } + } + }, + "description": "A list of optional search url parameters. This allows the additon of search url parameters based on how the search is performed in Firefox." + } + } + } + } + } + } + } + ] + } +] diff --git a/browser/components/extensions/schemas/commands.json b/browser/components/extensions/schemas/commands.json new file mode 100644 index 0000000000..19e8e122f9 --- /dev/null +++ b/browser/components/extensions/schemas/commands.json @@ -0,0 +1,204 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "id": "KeyName", + "type": "string", + "format": "manifestShortcutKey" + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "commands": { + "type": "object", + "optional": true, + "additionalProperties": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "suggested_key": { + "type": "object", + "optional": true, + "properties": { + "default": { + "$ref": "KeyName", + "optional": true + }, + "mac": { + "$ref": "KeyName", + "optional": true + }, + "linux": { + "$ref": "KeyName", + "optional": true + }, + "windows": { + "$ref": "KeyName", + "optional": true + }, + "chromeos": { + "type": "string", + "optional": true + }, + "android": { + "type": "string", + "optional": true + }, + "ios": { + "type": "string", + "optional": true + }, + "additionalProperties": { + "type": "string", + "deprecated": "Unknown platform name", + "optional": true + } + } + }, + "description": { + "type": "string", + "preprocess": "localize", + "optional": true + } + } + } + } + } + } + ] + }, + { + "namespace": "commands", + "description": "Use the commands API to add keyboard shortcuts that trigger actions in your extension, for example, an action to open the browser action or send a command to the xtension.", + "permissions": ["manifest:commands"], + "types": [ + { + "id": "Command", + "type": "object", + "properties": { + "name": { + "type": "string", + "optional": true, + "description": "The name of the Extension Command" + }, + "description": { + "type": "string", + "optional": true, + "description": "The Extension Command description" + }, + "shortcut": { + "type": "string", + "optional": true, + "description": "The shortcut active for this command, or blank if not active." + } + } + } + ], + "events": [ + { + "name": "onCommand", + "description": "Fired when a registered command is activated using a keyboard shortcut.", + "type": "function", + "parameters": [ + { + "name": "command", + "type": "string" + } + ] + }, + { + "name": "onChanged", + "description": "Fired when a registered command's shortcut is changed.", + "type": "function", + "parameters": [ + { + "type": "object", + "name": "changeInfo", + "properties": { + "name": { + "type": "string", + "description": "The name of the shortcut." + }, + "newShortcut": { + "type": "string", + "description": "The new shortcut active for this command, or blank if not active." + }, + "oldShortcut": { + "type": "string", + "description": "The old shortcut which is no longer active for this command, or blank if the shortcut was previously inactive." + } + } + } + ] + } + ], + "functions": [ + { + "name": "update", + "type": "function", + "async": true, + "description": "Update the details of an already defined command.", + "parameters": [ + { + "type": "object", + "name": "detail", + "description": "The new description for the command.", + "properties": { + "name": { + "type": "string", + "description": "The name of the command." + }, + "description": { + "type": "string", + "optional": true, + "description": "The new description for the command." + }, + "shortcut": { + "type": "string", + "format": "manifestShortcutKeyOrEmpty", + "optional": true + } + } + } + ] + }, + { + "name": "reset", + "type": "function", + "async": true, + "description": "Reset a command's details to what is specified in the manifest.", + "parameters": [ + { + "type": "string", + "name": "name", + "description": "The name of the command." + } + ] + }, + { + "name": "getAll", + "type": "function", + "async": "callback", + "description": "Returns all the registered extension commands for this extension and their shortcut (if active).", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "commands", + "type": "array", + "items": { + "$ref": "Command" + } + } + ], + "description": "Called to return the registered commands." + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/devtools.json b/browser/components/extensions/schemas/devtools.json new file mode 100644 index 0000000000..3568a6c101 --- /dev/null +++ b/browser/components/extensions/schemas/devtools.json @@ -0,0 +1,31 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "devtools_page": { + "$ref": "ExtensionURL", + "optional": true + } + } + }, + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["devtools"] + } + ] + } + ] + }, + { + "namespace": "devtools", + "permissions": ["manifest:devtools_page"], + "allowedContexts": ["devtools", "devtools_only"], + "defaultContexts": ["devtools", "devtools_only"] + } +] diff --git a/browser/components/extensions/schemas/devtools_inspected_window.json b/browser/components/extensions/schemas/devtools_inspected_window.json new file mode 100644 index 0000000000..7573427066 --- /dev/null +++ b/browser/components/extensions/schemas/devtools_inspected_window.json @@ -0,0 +1,266 @@ +[ + { + "namespace": "devtools.inspectedWindow", + "allowedContexts": ["devtools", "devtools_only"], + "defaultContexts": ["devtools", "devtools_only"], + "description": "Use the <code>chrome.devtools.inspectedWindow</code> API to interact with the inspected window: obtain the tab ID for the inspected page, evaluate the code in the context of the inspected window, reload the page, or obtain the list of resources within the page.", + "nocompile": true, + "types": [ + { + "id": "Resource", + "type": "object", + "description": "A resource within the inspected page, such as a document, a script, or an image.", + "properties": { + "url": { + "type": "string", + "description": "The URL of the resource." + } + }, + "functions": [ + { + "name": "getContent", + "unsupported": true, + "type": "function", + "async": "callback", + "description": "Gets the content of the resource.", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "A function that receives resource content when the request completes.", + "parameters": [ + { + "name": "content", + "type": "string", + "description": "Content of the resource (potentially encoded)." + }, + { + "name": "encoding", + "type": "string", + "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported." + } + ] + } + ] + }, + { + "name": "setContent", + "unsupported": true, + "type": "function", + "async": "callback", + "description": "Sets the content of the resource.", + "parameters": [ + { + "name": "content", + "type": "string", + "description": "New content of the resource. Only resources with the text type are currently supported." + }, + { + "name": "commit", + "type": "boolean", + "description": "True if the user has finished editing the resource, and the new content of the resource should be persisted; false if this is a minor change sent in progress of the user editing the resource." + }, + { + "name": "callback", + "type": "function", + "description": "A function called upon request completion.", + "optional": true, + "parameters": [ + { + "name": "error", + "type": "object", + "additionalProperties": { "type": "any" }, + "optional": true, + "description": "Set to undefined if the resource content was set successfully; describes error otherwise." + } + ] + } + ] + } + ] + } + ], + "properties": { + "tabId": { + "description": "The ID of the tab being inspected. This ID may be used with chrome.tabs.* API.", + "type": "integer" + } + }, + "functions": [ + { + "name": "eval", + "type": "function", + "description": "Evaluates a JavaScript expression in the context of the main frame of the inspected page. The expression must evaluate to a JSON-compliant object, otherwise an exception is thrown. The eval function can report either a DevTools-side error or a JavaScript exception that occurs during evaluation. In either case, the <code>result</code> parameter of the callback is <code>undefined</code>. In the case of a DevTools-side error, the <code>isException</code> parameter is non-null and has <code>isError</code> set to true and <code>code</code> set to an error code. In the case of a JavaScript error, <code>isException</code> is set to true and <code>value</code> is set to the string value of thrown object.", + "async": "callback", + "parameters": [ + { + "name": "expression", + "type": "string", + "description": "An expression to evaluate." + }, + { + "name": "options", + "type": "object", + "optional": true, + "description": "The options parameter can contain one or more options.", + "properties": { + "frameURL": { + "type": "string", + "unsupported": true, + "optional": true, + "description": "If specified, the expression is evaluated on the iframe whose URL matches the one specified. By default, the expression is evaluated in the top frame of the inspected page." + }, + "useContentScriptContext": { + "type": "boolean", + "unsupported": true, + "optional": true, + "description": "Evaluate the expression in the context of the content script of the calling extension, provided that the content script is already injected into the inspected page. If not, the expression is not evaluated and the callback is invoked with the exception parameter set to an object that has the <code>isError</code> field set to true and the <code>code</code> field set to <code>E_NOTFOUND</code>." + }, + "contextSecurityOrigin": { + "type": "string", + "unsupported": true, + "optional": true, + "description": "Evaluate the expression in the context of a content script of an extension that matches the specified origin. If given, contextSecurityOrigin overrides the 'true' setting on userContentScriptContext." + } + } + }, + { + "name": "callback", + "type": "function", + "description": "A function called when evaluation completes.", + "optional": true, + "parameters": [ + { + "name": "result", + "type": "any", + "description": "The result of evaluation." + }, + { + "name": "exceptionInfo", + "type": "object", + "optional": true, + "description": "An object providing details if an exception occurred while evaluating the expression.", + "properties": { + "isError": { + "type": "boolean", + "description": "Set if the error occurred on the DevTools side before the expression is evaluated." + }, + "code": { + "type": "string", + "description": "Set if the error occurred on the DevTools side before the expression is evaluated." + }, + "description": { + "type": "string", + "description": "Set if the error occurred on the DevTools side before the expression is evaluated." + }, + "details": { + "type": "array", + "items": { "type": "any" }, + "description": "Set if the error occurred on the DevTools side before the expression is evaluated, contains the array of the values that may be substituted into the description string to provide more information about the cause of the error." + }, + "isException": { + "type": "boolean", + "description": "Set if the evaluated code produces an unhandled exception." + }, + "value": { + "type": "string", + "description": "Set if the evaluated code produces an unhandled exception." + } + } + } + ] + } + ] + }, + { + "name": "reload", + "type": "function", + "description": "Reloads the inspected page.", + "parameters": [ + { + "type": "object", + "name": "reloadOptions", + "optional": true, + "properties": { + "ignoreCache": { + "type": "boolean", + "optional": true, + "description": "When true, the loader will bypass the cache for all inspected page resources loaded before the <code>load</code> event is fired. The effect is similar to pressing Ctrl+Shift+R in the inspected window or within the Developer Tools window." + }, + "userAgent": { + "type": "string", + "optional": true, + "description": "If specified, the string will override the value of the <code>User-Agent</code> HTTP header that's sent while loading the resources of the inspected page. The string will also override the value of the <code>navigator.userAgent</code> property that's returned to any scripts that are running within the inspected page." + }, + "injectedScript": { + "type": "string", + "optional": true, + "description": "If specified, the script will be injected into every frame of the inspected page immediately upon load, before any of the frame's scripts. The script will not be injected after subsequent reloads—for example, if the user presses Ctrl+R." + }, + "preprocessorScript": { + "unsupported": true, + "type": "string", + "deprecated": "Please avoid using this parameter, it will be removed soon.", + "optional": true, + "description": "If specified, this script evaluates into a function that accepts three string arguments: the source to preprocess, the URL of the source, and a function name if the source is an DOM event handler. The preprocessorerScript function should return a string to be compiled by Chrome in place of the input source. In the case that the source is a DOM event handler, the returned source must compile to a single JS function." + } + } + } + ] + }, + { + "name": "getResources", + "unsupported": true, + "type": "function", + "description": "Retrieves the list of resources from the inspected page.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "A function that receives the list of resources when the request completes.", + "parameters": [ + { + "name": "resources", + "type": "array", + "items": { "$ref": "Resource" }, + "description": "The resources within the page." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onResourceAdded", + "unsupported": true, + "type": "function", + "description": "Fired when a new resource is added to the inspected page.", + "parameters": [ + { + "name": "resource", + "$ref": "Resource" + } + ] + }, + { + "name": "onResourceContentCommitted", + "unsupported": true, + "type": "function", + "description": "Fired when a new revision of the resource is committed (e.g. user saves an edited version of the resource in the Developer Tools).", + "parameters": [ + { + "name": "resource", + "$ref": "Resource" + }, + { + "name": "content", + "type": "string", + "description": "New content of the resource." + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/devtools_network.json b/browser/components/extensions/schemas/devtools_network.json new file mode 100644 index 0000000000..0e93126e4f --- /dev/null +++ b/browser/components/extensions/schemas/devtools_network.json @@ -0,0 +1,91 @@ +[ + { + "namespace": "devtools.network", + "allowedContexts": ["devtools", "devtools_only"], + "defaultContexts": ["devtools", "devtools_only"], + "description": "Use the <code>chrome.devtools.network</code> API to retrieve the information about network requests displayed by the Developer Tools in the Network panel.", + "types": [ + { + "id": "Request", + "type": "object", + "description": "Represents a network request for a document resource (script, image and so on). See HAR Specification for reference.", + "functions": [ + { + "name": "getContent", + "type": "function", + "description": "Returns content of the response body.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "A function that receives the response body when the request completes.", + "parameters": [ + { + "name": "content", + "type": "string", + "description": "Content of the response body (potentially encoded)." + }, + { + "name": "encoding", + "type": "string", + "description": "Empty if content is not encoded, encoding name otherwise. Currently, only base64 is supported." + } + ] + } + ] + } + ] + } + ], + "functions": [ + { + "name": "getHAR", + "type": "function", + "description": "Returns HAR log that contains all known network requests.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "A function that receives the HAR log when the request completes.", + "parameters": [ + { + "name": "harLog", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "A HAR log. See HAR specification for details." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onRequestFinished", + "type": "function", + "description": "Fired when a network request is finished and all request data are available.", + "parameters": [ + { + "name": "request", + "$ref": "Request", + "description": "Description of a network request in the form of a HAR entry. See HAR specification for details." + } + ] + }, + { + "name": "onNavigated", + "type": "function", + "description": "Fired when the inspected window navigates to a new page.", + "parameters": [ + { + "name": "url", + "type": "string", + "description": "URL of the new page." + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/devtools_panels.json b/browser/components/extensions/schemas/devtools_panels.json new file mode 100644 index 0000000000..2562de7935 --- /dev/null +++ b/browser/components/extensions/schemas/devtools_panels.json @@ -0,0 +1,422 @@ +[ + { + "namespace": "devtools.panels", + "allowedContexts": ["devtools", "devtools_only"], + "defaultContexts": ["devtools", "devtools_only"], + "description": "Use the <code>chrome.devtools.panels</code> API to integrate your extension into Developer Tools window UI: create your own panels, access existing panels, and add sidebars.", + "nocompile": true, + "types": [ + { + "id": "ElementsPanel", + "type": "object", + "description": "Represents the Elements panel.", + "events": [ + { + "name": "onSelectionChanged", + "type": "function", + "description": "Fired when an object is selected in the panel." + } + ], + "functions": [ + { + "name": "createSidebarPane", + "async": "callback", + "type": "function", + "description": "Creates a pane within panel's sidebar.", + "parameters": [ + { + "name": "title", + "type": "string", + "description": "Text that is displayed in sidebar caption." + }, + { + "name": "callback", + "type": "function", + "description": "A callback invoked when the sidebar is created.", + "optional": true, + "parameters": [ + { + "name": "result", + "description": "An ExtensionSidebarPane object for created sidebar pane.", + "$ref": "ExtensionSidebarPane" + } + ] + } + ] + } + ] + }, + { + "id": "SourcesPanel", + "type": "object", + "description": "Represents the Sources panel.", + "events": [ + { + "name": "onSelectionChanged", + "unsupported": true, + "description": "Fired when an object is selected in the panel." + } + ], + "functions": [ + { + "name": "createSidebarPane", + "unsupported": true, + "type": "function", + "description": "Creates a pane within panel's sidebar.", + "parameters": [ + { + "name": "title", + "type": "string", + "description": "Text that is displayed in sidebar caption." + }, + { + "name": "callback", + "type": "function", + "description": "A callback invoked when the sidebar is created.", + "optional": true, + "parameters": [ + { + "name": "result", + "description": "An ExtensionSidebarPane object for created sidebar pane.", + "$ref": "ExtensionSidebarPane" + } + ] + } + ] + } + ] + }, + { + "id": "ExtensionPanel", + "type": "object", + "description": "Represents a panel created by extension.", + "functions": [ + { + "name": "createStatusBarButton", + "unsupported": true, + "description": "Appends a button to the status bar of the panel.", + "type": "function", + "parameters": [ + { + "name": "iconPath", + "type": "string", + "description": "Path to the icon of the button. The file should contain a 64x24-pixel image composed of two 32x24 icons. The left icon is used when the button is inactive; the right icon is displayed when the button is pressed." + }, + { + "name": "tooltipText", + "type": "string", + "description": "Text shown as a tooltip when user hovers the mouse over the button." + }, + { + "name": "disabled", + "type": "boolean", + "description": "Whether the button is disabled." + } + ], + "returns": { "$ref": "Button" } + } + ], + "events": [ + { + "name": "onSearch", + "unsupported": true, + "description": "Fired upon a search action (start of a new search, search result navigation, or search being canceled).", + "parameters": [ + { + "name": "action", + "type": "string", + "description": "Type of search action being performed." + }, + { + "name": "queryString", + "type": "string", + "optional": true, + "description": "Query string (only for 'performSearch')." + } + ] + }, + { + "name": "onShown", + "type": "function", + "description": "Fired when the user switches to the panel.", + "parameters": [ + { + "name": "window", + "type": "object", + "isInstanceOf": "global", + "additionalProperties": { "type": "any" }, + "description": "The JavaScript <code>window</code> object of panel's page." + } + ] + }, + { + "name": "onHidden", + "type": "function", + "description": "Fired when the user switches away from the panel." + } + ] + }, + { + "id": "ExtensionSidebarPane", + "type": "object", + "description": "A sidebar created by the extension.", + "functions": [ + { + "name": "setHeight", + "unsupported": true, + "type": "function", + "description": "Sets the height of the sidebar.", + "parameters": [ + { + "name": "height", + "type": "string", + "description": "A CSS-like size specification, such as <code>'100px'</code> or <code>'12ex'</code>." + } + ] + }, + { + "name": "setExpression", + "async": "callback", + "type": "function", + "description": "Sets an expression that is evaluated within the inspected page. The result is displayed in the sidebar pane.", + "parameters": [ + { + "name": "expression", + "type": "string", + "description": "An expression to be evaluated in context of the inspected page. JavaScript objects and DOM nodes are displayed in an expandable tree similar to the console/watch." + }, + { + "name": "rootTitle", + "type": "string", + "optional": true, + "description": "An optional title for the root of the expression tree." + }, + { + "name": "callback", + "type": "function", + "optional": true, + "description": "A callback invoked after the sidebar pane is updated with the expression evaluation results." + } + ] + }, + { + "name": "setObject", + "async": "callback", + "type": "function", + "description": "Sets a JSON-compliant object to be displayed in the sidebar pane.", + "parameters": [ + { + "name": "jsonObject", + "type": "string", + "description": "An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client)." + }, + { + "name": "rootTitle", + "type": "string", + "optional": true, + "description": "An optional title for the root of the expression tree." + }, + { + "name": "callback", + "type": "function", + "optional": true, + "description": "A callback invoked after the sidebar is updated with the object." + } + ] + }, + { + "name": "setPage", + "type": "function", + "async": true, + "description": "Sets an HTML page to be displayed in the sidebar pane.", + "parameters": [ + { + "name": "path", + "$ref": "manifest.ExtensionURL", + "description": "Relative path of an extension page to display within the sidebar." + } + ] + } + ], + "events": [ + { + "name": "onShown", + "type": "function", + "description": "Fired when the sidebar pane becomes visible as a result of user switching to the panel that hosts it.", + "parameters": [ + { + "name": "window", + "type": "object", + "isInstanceOf": "global", + "additionalProperties": { "type": "any" }, + "description": "The JavaScript <code>window</code> object of the sidebar page, if one was set with the <code>setPage()</code> method." + } + ] + }, + { + "name": "onHidden", + "type": "function", + "description": "Fired when the sidebar pane becomes hidden as a result of the user switching away from the panel that hosts the sidebar pane." + } + ] + }, + { + "id": "Button", + "type": "object", + "description": "A button created by the extension.", + "functions": [ + { + "name": "update", + "unsupported": true, + "type": "function", + "description": "Updates the attributes of the button. If some of the arguments are omitted or <code>null</code>, the corresponding attributes are not updated.", + "parameters": [ + { + "name": "iconPath", + "type": "string", + "optional": true, + "description": "Path to the new icon of the button." + }, + { + "name": "tooltipText", + "type": "string", + "optional": true, + "description": "Text shown as a tooltip when user hovers the mouse over the button." + }, + { + "name": "disabled", + "type": "boolean", + "optional": true, + "description": "Whether the button is disabled." + } + ] + } + ], + "events": [ + { + "name": "onClicked", + "unsupported": true, + "type": "function", + "description": "Fired when the button is clicked." + } + ] + } + ], + "properties": { + "elements": { + "$ref": "ElementsPanel", + "description": "Elements panel." + }, + "sources": { + "$ref": "SourcesPanel", + "description": "Sources panel." + }, + "themeName": { + "type": "string", + "description": "The name of the current devtools theme." + } + }, + "functions": [ + { + "name": "create", + "type": "function", + "description": "Creates an extension panel.", + "async": "callback", + "parameters": [ + { + "name": "title", + "type": "string", + "description": "Title that is displayed next to the extension icon in the Developer Tools toolbar." + }, + { + "name": "iconPath", + "description": "Path of the panel's icon relative to the extension directory, or an empty string to use the default extension icon as the panel icon.", + "choices": [ + { "type": "string", "enum": [""] }, + { "$ref": "manifest.ExtensionURL" } + ] + }, + { + "name": "pagePath", + "$ref": "manifest.ExtensionURL", + "description": "Path of the panel's HTML page relative to the extension directory." + }, + { + "name": "callback", + "type": "function", + "optional": true, + "description": "A function that is called when the panel is created.", + "parameters": [ + { + "name": "panel", + "description": "An ExtensionPanel object representing the created panel.", + "$ref": "ExtensionPanel" + } + ] + } + ] + }, + { + "name": "setOpenResourceHandler", + "unsupported": true, + "type": "function", + "description": "Specifies the function to be called when the user clicks a resource link in the Developer Tools window. To unset the handler, either call the method with no parameters or pass null as the parameter.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "optional": true, + "description": "A function that is called when the user clicks on a valid resource link in Developer Tools window. Note that if the user clicks an invalid URL or an XHR, this function is not called.", + "parameters": [ + { + "name": "resource", + "$ref": "devtools.inspectedWindow.Resource", + "description": "A $(ref:devtools.inspectedWindow.Resource) object for the resource that was clicked." + } + ] + } + ] + }, + { + "name": "openResource", + "unsupported": true, + "type": "function", + "description": "Requests DevTools to open a URL in a Developer Tools panel.", + "async": "callback", + "parameters": [ + { + "name": "url", + "type": "string", + "description": "The URL of the resource to open." + }, + { + "name": "lineNumber", + "type": "integer", + "description": "Specifies the line number to scroll to when the resource is loaded." + }, + { + "name": "callback", + "type": "function", + "optional": true, + "description": "A function that is called when the resource has been successfully loaded." + } + ] + } + ], + "events": [ + { + "name": "onThemeChanged", + "type": "function", + "description": "Fired when the devtools theme changes.", + "parameters": [ + { + "name": "themeName", + "type": "string", + "description": "The name of the current devtools theme." + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/find.json b/browser/components/extensions/schemas/find.json new file mode 100644 index 0000000000..39e455f191 --- /dev/null +++ b/browser/components/extensions/schemas/find.json @@ -0,0 +1,122 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["find"] + } + ] + } + ] + }, + { + "namespace": "find", + "description": "Use the <code>browser.find</code> API to interact with the browser's <code>Find</code> interface.", + "permissions": ["find"], + "functions": [ + { + "name": "find", + "type": "function", + "async": true, + "description": "Search for text in document and store found ranges in array, in document order.", + "parameters": [ + { + "name": "queryphrase", + "type": "string", + "description": "The string to search for." + }, + { + "name": "params", + "type": "object", + "description": "Search parameters.", + "optional": true, + "properties": { + "tabId": { + "type": "integer", + "description": "Tab to query. Defaults to the active tab.", + "optional": true, + "minimum": 0 + }, + "caseSensitive": { + "type": "boolean", + "description": "Find only ranges with case sensitive match.", + "optional": true + }, + "matchDiacritics": { + "type": "boolean", + "description": "Find only ranges with diacritic sensitive match.", + "optional": true + }, + "entireWord": { + "type": "boolean", + "description": "Find only ranges that match entire word.", + "optional": true + }, + "includeRectData": { + "description": "Return rectangle data which describes visual position of search results.", + "type": "boolean", + "optional": true + }, + "includeRangeData": { + "description": "Return range data which provides range data in a serializable form.", + "type": "boolean", + "optional": true + } + } + } + ] + }, + { + "name": "highlightResults", + "type": "function", + "async": true, + "description": "Highlight a range", + "parameters": [ + { + "name": "params", + "type": "object", + "description": "highlightResults parameters", + "optional": true, + "properties": { + "rangeIndex": { + "type": "integer", + "description": "Found range to be highlighted. Default highlights all ranges.", + "minimum": 0, + "optional": true + }, + "tabId": { + "type": "integer", + "description": "Tab to highlight. Defaults to the active tab.", + "minimum": 0, + "optional": true + }, + "noScroll": { + "type": "boolean", + "description": "Don't scroll to highlighted item.", + "optional": true + } + } + } + ] + }, + { + "name": "removeHighlighting", + "type": "function", + "async": true, + "description": "Remove all highlighting from previous searches.", + "parameters": [ + { + "name": "tabId", + "type": "integer", + "description": "Tab to highlight. Defaults to the active tab.", + "optional": true + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/history.json b/browser/components/extensions/schemas/history.json new file mode 100644 index 0000000000..9de276cc94 --- /dev/null +++ b/browser/components/extensions/schemas/history.json @@ -0,0 +1,345 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["history"] + } + ] + } + ] + }, + { + "namespace": "history", + "description": "Use the <code>browser.history</code> API to interact with the browser's record of visited pages. You can add, remove, and query for URLs in the browser's history. To override the history page with your own version, see $(topic:override)[Override Pages].", + "permissions": ["history"], + "types": [ + { + "id": "TransitionType", + "type": "string", + "enum": [ + "link", + "typed", + "auto_bookmark", + "auto_subframe", + "manual_subframe", + "generated", + "auto_toplevel", + "form_submit", + "reload", + "keyword", + "keyword_generated" + ], + "description": "The $(topic:transition-types)[transition type] for this visit from its referrer." + }, + { + "id": "HistoryItem", + "type": "object", + "description": "An object encapsulating one result of a history query.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the item." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL navigated to by a user." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the page when it was last loaded." + }, + "lastVisitTime": { + "type": "number", + "optional": true, + "description": "When this page was last loaded, represented in milliseconds since the epoch." + }, + "visitCount": { + "type": "integer", + "optional": true, + "description": "The number of times the user has navigated to this page." + }, + "typedCount": { + "type": "integer", + "optional": true, + "description": "The number of times the user has navigated to this page by typing in the address." + } + } + }, + { + "id": "VisitItem", + "type": "object", + "description": "An object encapsulating one visit to a URL.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the item." + }, + "visitId": { + "type": "string", + "description": "The unique identifier for this visit." + }, + "visitTime": { + "type": "number", + "optional": true, + "description": "When this visit occurred, represented in milliseconds since the epoch." + }, + "referringVisitId": { + "type": "string", + "description": "The visit ID of the referrer." + }, + "transition": { + "$ref": "TransitionType", + "description": "The $(topic:transition-types)[transition type] for this visit from its referrer." + } + } + } + ], + "functions": [ + { + "name": "search", + "type": "function", + "description": "Searches the history for the last visit time of each page matching the query.", + "async": "callback", + "parameters": [ + { + "name": "query", + "type": "object", + "properties": { + "text": { + "type": "string", + "description": "A free-text query to the history service. Leave empty to retrieve all pages." + }, + "startTime": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "Limit results to those visited after this date. If not specified, this defaults to 24 hours in the past." + }, + "endTime": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "Limit results to those visited before this date." + }, + "maxResults": { + "type": "integer", + "optional": true, + "minimum": 1, + "description": "The maximum number of results to retrieve. Defaults to 100." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "HistoryItem" + } + } + ] + } + ] + }, + { + "name": "getVisits", + "type": "function", + "description": "Retrieves information about visits to a URL.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL for which to retrieve visit information. It must be in the format as returned from a call to history.search." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "VisitItem" + } + } + ] + } + ] + }, + { + "name": "addUrl", + "type": "function", + "description": "Adds a URL to the history with a default visitTime of the current time and a default $(topic:transition-types)[transition type] of \"link\".", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL to add. Must be a valid URL that can be added to history." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the page." + }, + "transition": { + "$ref": "TransitionType", + "optional": true, + "description": "The $(topic:transition-types)[transition type] for this visit from its referrer." + }, + "visitTime": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "The date when this visit occurred." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "deleteUrl", + "type": "function", + "description": "Removes all occurrences of the given URL from the history.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL to remove." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "deleteRange", + "type": "function", + "description": "Removes all items within the specified date range from the history. Pages will not be removed from the history unless all visits fall within the range.", + "async": "callback", + "parameters": [ + { + "name": "range", + "type": "object", + "properties": { + "startTime": { + "$ref": "extensionTypes.Date", + "description": "Items added to history after this date." + }, + "endTime": { + "$ref": "extensionTypes.Date", + "description": "Items added to history before this date." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [] + } + ] + }, + { + "name": "deleteAll", + "type": "function", + "description": "Deletes all items from the history.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onVisited", + "type": "function", + "description": "Fired when a URL is visited, providing the HistoryItem data for that URL. This event fires before the page has loaded.", + "parameters": [ + { + "name": "result", + "$ref": "HistoryItem" + } + ] + }, + { + "name": "onVisitRemoved", + "type": "function", + "description": "Fired when one or more URLs are removed from the history service. When all visits have been removed the URL is purged from history.", + "parameters": [ + { + "name": "removed", + "type": "object", + "properties": { + "allHistory": { + "type": "boolean", + "description": "True if all history was removed. If true, then urls will be empty." + }, + "urls": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + ] + }, + { + "name": "onTitleChanged", + "type": "function", + "description": "Fired when the title of a URL is changed in the browser history.", + "parameters": [ + { + "name": "changed", + "type": "object", + "properties": { + "url": { + "type": "string", + "description": "The URL for which the title has changed" + }, + "title": { + "type": "string", + "description": "The new title for the URL." + } + } + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/jar.mn b/browser/components/extensions/schemas/jar.mn new file mode 100644 index 0000000000..0950cdf518 --- /dev/null +++ b/browser/components/extensions/schemas/jar.mn @@ -0,0 +1,26 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +browser.jar: + content/browser/schemas/bookmarks.json + content/browser/schemas/chrome_settings_overrides.json + content/browser/schemas/commands.json + content/browser/schemas/devtools.json + content/browser/schemas/devtools_inspected_window.json + content/browser/schemas/devtools_network.json + content/browser/schemas/devtools_panels.json + content/browser/schemas/find.json + content/browser/schemas/history.json + content/browser/schemas/menus.json + content/browser/schemas/menus_child.json + content/browser/schemas/normandyAddonStudy.json + content/browser/schemas/omnibox.json + content/browser/schemas/pkcs11.json + content/browser/schemas/search.json + content/browser/schemas/sessions.json + content/browser/schemas/sidebar_action.json + content/browser/schemas/tabs.json + content/browser/schemas/top_sites.json + content/browser/schemas/url_overrides.json + content/browser/schemas/windows.json diff --git a/browser/components/extensions/schemas/menus.json b/browser/components/extensions/schemas/menus.json new file mode 100644 index 0000000000..1c220c6cd9 --- /dev/null +++ b/browser/components/extensions/schemas/menus.json @@ -0,0 +1,605 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["menus", "contextMenus"] + } + ] + }, + { + "$extend": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["menus.overrideContext"] + } + ] + } + ] + }, + { + "namespace": "contextMenus", + "permissions": ["contextMenus"], + "description": "Use the browser.contextMenus API to add items to the browser's context menu. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.", + "$import": "menus" + }, + { + "namespace": "menus", + "permissions": ["menus"], + "description": "Use the browser.menus API to add items to the browser's menus. You can choose what types of objects your context menu additions apply to, such as images, hyperlinks, and pages.", + "properties": { + "ACTION_MENU_TOP_LEVEL_LIMIT": { + "value": 6, + "description": "The maximum number of top level extension items that can be added to an extension action context menu. Any items beyond this limit will be ignored." + } + }, + "types": [ + { + "id": "ContextType", + "description": "The different contexts a menu can appear in. Specifying 'all' is equivalent to the combination of all other contexts except for 'tab' and 'tools_menu'.", + "choices": [ + { + "type": "string", + "enum": [ + "all", + "page", + "frame", + "selection", + "link", + "editable", + "password", + "image", + "video", + "audio", + "launcher", + "bookmark", + "tab", + "tools_menu" + ] + }, + { + "type": "string", + "enum": ["browser_action", "page_action"], + "max_manifest_version": 2 + }, + { + "type": "string", + "enum": ["action"], + "min_manifest_version": 3 + } + ] + }, + { + "id": "ItemType", + "type": "string", + "enum": ["normal", "checkbox", "radio", "separator"], + "description": "The type of menu item." + }, + { + "id": "OnClickData", + "type": "object", + "description": "Information sent when a context menu item is clicked.", + "properties": { + "menuItemId": { + "choices": [{ "type": "integer" }, { "type": "string" }], + "description": "The ID of the menu item that was clicked." + }, + "parentMenuItemId": { + "choices": [{ "type": "integer" }, { "type": "string" }], + "optional": true, + "description": "The parent ID, if any, for the item clicked." + }, + "viewType": { + "$ref": "extension.ViewType", + "optional": true, + "description": "The type of view where the menu is clicked. May be unset if the menu is not associated with a view." + }, + "mediaType": { + "type": "string", + "optional": true, + "description": "One of 'image', 'video', or 'audio' if the context menu was activated on one of these types of elements." + }, + "linkText": { + "type": "string", + "optional": true, + "description": "If the element is a link, the text of that link." + }, + "linkUrl": { + "type": "string", + "optional": true, + "description": "If the element is a link, the URL it points to." + }, + "srcUrl": { + "type": "string", + "optional": true, + "description": "Will be present for elements with a 'src' URL." + }, + "pageUrl": { + "type": "string", + "optional": true, + "description": "The URL of the page where the menu item was clicked. This property is not set if the click occured in a context where there is no current page, such as in a launcher context menu." + }, + "frameId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "The id of the frame of the element where the context menu was clicked." + }, + "frameUrl": { + "type": "string", + "optional": true, + "description": " The URL of the frame of the element where the context menu was clicked, if it was in a frame." + }, + "selectionText": { + "type": "string", + "optional": true, + "description": "The text for the context selection, if any." + }, + "editable": { + "type": "boolean", + "description": "A flag indicating whether the element is editable (text input, textarea, etc.)." + }, + "wasChecked": { + "type": "boolean", + "optional": true, + "description": "A flag indicating the state of a checkbox or radio item before it was clicked." + }, + "checked": { + "type": "boolean", + "optional": true, + "description": "A flag indicating the state of a checkbox or radio item after it is clicked." + }, + "bookmarkId": { + "type": "string", + "optional": true, + "description": "The id of the bookmark where the context menu was clicked, if it was on a bookmark." + }, + "modifiers": { + "type": "array", + "items": { + "type": "string", + "enum": ["Shift", "Alt", "Command", "Ctrl", "MacCtrl"] + }, + "description": "An array of keyboard modifiers that were held while the menu item was clicked." + }, + "button": { + "type": "integer", + "optional": true, + "description": "An integer value of button by which menu item was clicked." + }, + "targetElementId": { + "type": "integer", + "optional": true, + "description": "An identifier of the clicked element, if any. Use menus.getTargetElement in the page to find the corresponding element." + } + } + } + ], + "functions": [ + { + "name": "create", + "type": "function", + "description": "Creates a new context menu item. Note that if an error occurs during creation, you may not find out until the creation callback fires (the details will be in $(ref:runtime.lastError)).", + "returns": { + "choices": [{ "type": "integer" }, { "type": "string" }], + "description": "The ID of the newly created item." + }, + "parameters": [ + { + "type": "object", + "name": "createProperties", + "properties": { + "type": { + "$ref": "ItemType", + "optional": true, + "description": "The type of menu item. Defaults to 'normal' if not specified." + }, + "id": { + "type": "string", + "optional": true, + "description": "The unique ID to assign to this item. Mandatory for event pages. Cannot be the same as another ID for this extension." + }, + "icons": { + "type": "object", + "optional": true, + "patternProperties": { + "^[1-9]\\d*$": { "type": "string" } + } + }, + "title": { + "type": "string", + "optional": true, + "description": "The text to be displayed in the item; this is <em>required</em> unless <code>type</code> is 'separator'. When the context is 'selection', you can use <code>%s</code> within the string to show the selected text. For example, if this parameter's value is \"Translate '%s' to Pig Latin\" and the user selects the word \"cool\", the context menu item for the selection is \"Translate 'cool' to Pig Latin\"." + }, + "checked": { + "type": "boolean", + "optional": true, + "description": "The initial state of a checkbox or radio item: true for selected and false for unselected. Only one radio item can be selected at a time in a given group of radio items." + }, + "contexts": { + "type": "array", + "items": { + "$ref": "ContextType" + }, + "minItems": 1, + "optional": true, + "description": "List of contexts this menu item will appear in. Defaults to ['page'] if not specified." + }, + "viewTypes": { + "type": "array", + "items": { + "$ref": "extension.ViewType" + }, + "minItems": 1, + "optional": true, + "description": "List of view types where the menu item will be shown. Defaults to any view, including those without a viewType." + }, + "visible": { + "type": "boolean", + "optional": true, + "description": "Whether the item is visible in the menu." + }, + "onclick": { + "type": "function", + "max_manifest_version": 2, + "optional": true, + "description": "A function that will be called back when the menu item is clicked. Event pages cannot use this; instead, they should register a listener for $(ref:contextMenus.onClicked).", + "parameters": [ + { + "name": "info", + "$ref": "OnClickData", + "description": "Information about the item clicked and the context where the click happened." + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the click took place. Note: this parameter only present for extensions." + } + ] + }, + "parentId": { + "choices": [{ "type": "integer" }, { "type": "string" }], + "optional": true, + "description": "The ID of a parent menu item; this makes the item a child of a previously added item." + }, + "documentUrlPatterns": { + "type": "array", + "items": { "type": "string" }, + "optional": true, + "description": "Lets you restrict the item to apply only to documents whose URL matches one of the given patterns. (This applies to frames as well.) For details on the format of a pattern, see $(topic:match_patterns)[Match Patterns]." + }, + "targetUrlPatterns": { + "type": "array", + "items": { "type": "string" }, + "optional": true, + "description": "Similar to documentUrlPatterns, but lets you filter based on the src attribute of img/audio/video tags and the href of anchor tags." + }, + "enabled": { + "type": "boolean", + "optional": true, + "description": "Whether this context menu item is enabled or disabled. Defaults to true." + }, + "command": { + "choices": [ + { "type": "string" }, + { + "type": "string", + "enum": [ + "_execute_browser_action", + "_execute_page_action", + "_execute_sidebar_action" + ], + "max_manifest_version": 2, + "description": "Manifest V2 supports internal commands _execute_page_action, _execute_browser_action and _execute_sidebar_action." + }, + { + "type": "string", + "enum": [ + "_execute_action", + "_execute_page_action", + "_execute_sidebar_action" + ], + "min_manifest_version": 3, + "description": "Manifest V3 supports internal commands _execute_page_action, _execute_action and _execute_sidebar_action." + } + ], + "optional": true, + "description": "Specifies a command to issue for the context click." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when the item has been created in the browser. If there were any problems creating the item, details will be available in $(ref:runtime.lastError).", + "parameters": [] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates a previously created context menu item.", + "async": "callback", + "parameters": [ + { + "choices": [{ "type": "integer" }, { "type": "string" }], + "name": "id", + "description": "The ID of the item to update." + }, + { + "type": "object", + "name": "updateProperties", + "description": "The properties to update. Accepts the same values as the create function.", + "properties": { + "type": { + "$ref": "ItemType", + "optional": true + }, + "icons": { + "type": "object", + "optional": "omit-key-if-missing", + "patternProperties": { + "^[1-9]\\d*$": { "type": "string" } + } + }, + "title": { + "type": "string", + "optional": true + }, + "checked": { + "type": "boolean", + "optional": true + }, + "contexts": { + "type": "array", + "items": { + "$ref": "ContextType" + }, + "minItems": 1, + "optional": true + }, + "viewTypes": { + "type": "array", + "items": { + "$ref": "extension.ViewType" + }, + "minItems": 1, + "optional": true + }, + "visible": { + "type": "boolean", + "optional": true, + "description": "Whether the item is visible in the menu." + }, + "onclick": { + "type": "function", + "max_manifest_version": 2, + "optional": "omit-key-if-missing", + "parameters": [ + { + "name": "info", + "$ref": "OnClickData" + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the click took place. Note: this parameter only present for extensions." + } + ] + }, + "parentId": { + "choices": [{ "type": "integer" }, { "type": "string" }], + "optional": true, + "description": "Note: You cannot change an item to be a child of one of its own descendants." + }, + "documentUrlPatterns": { + "type": "array", + "items": { "type": "string" }, + "optional": true + }, + "targetUrlPatterns": { + "type": "array", + "items": { "type": "string" }, + "optional": true + }, + "enabled": { + "type": "boolean", + "optional": true + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when the context menu has been updated." + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes a context menu item.", + "async": "callback", + "parameters": [ + { + "choices": [{ "type": "integer" }, { "type": "string" }], + "name": "menuItemId", + "description": "The ID of the context menu item to remove." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when the context menu has been removed." + } + ] + }, + { + "name": "removeAll", + "type": "function", + "description": "Removes all context menu items added by this extension.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [], + "description": "Called when removal is complete." + } + ] + }, + { + "name": "overrideContext", + "permissions": ["menus.overrideContext"], + "type": "function", + "description": "Show the matching menu items from this extension instead of the default menu. This should be called during a 'contextmenu' DOM event handler, and only applies to the menu that opens after this event.", + "parameters": [ + { + "name": "contextOptions", + "type": "object", + "properties": { + "showDefaults": { + "type": "boolean", + "optional": true, + "default": false, + "description": "Whether to also include default menu items in the menu." + }, + "context": { + "type": "string", + "enum": ["bookmark", "tab"], + "optional": true, + "description": "ContextType to override, to allow menu items from other extensions in the menu. Currently only 'bookmark' and 'tab' are supported. showDefaults cannot be used with this option." + }, + "bookmarkId": { + "type": "string", + "minLength": 1, + "optional": true, + "description": "Required when context is 'bookmark'. Requires 'bookmark' permission." + }, + "tabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "Required when context is 'tab'. Requires 'tabs' permission." + } + } + } + ] + }, + { + "name": "refresh", + "type": "function", + "description": "Updates the extension items in the shown menu, including changes that have been made since the menu was shown. Has no effect if the menu is hidden. Rebuilding a shown menu is an expensive operation, only invoke this method when necessary.", + "async": true, + "parameters": [] + } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "description": "Fired when a context menu item is clicked.", + "parameters": [ + { + "name": "info", + "$ref": "OnClickData", + "description": "Information about the item clicked and the context where the click happened." + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the click took place. If the click did not take place in a tab, this parameter will be missing.", + "optional": true + } + ] + }, + { + "name": "onShown", + "type": "function", + "description": "Fired when a menu is shown. The extension can add, modify or remove menu items and call menus.refresh() to update the menu.", + "parameters": [ + { + "name": "info", + "type": "object", + "description": "Information about the context of the menu action and the created menu items. For more information about each property, see OnClickData. The following properties are only set if the extension has host permissions for the given context: linkUrl, linkText, srcUrl, pageUrl, frameUrl, selectionText.", + "properties": { + "menuIds": { + "description": "A list of IDs of the menu items that were shown.", + "type": "array", + "items": { + "choices": [{ "type": "integer" }, { "type": "string" }] + } + }, + "contexts": { + "description": "A list of all contexts that apply to the menu.", + "type": "array", + "items": { "$ref": "ContextType" } + }, + "viewType": { + "$ref": "extension.ViewType", + "optional": true + }, + "editable": { + "type": "boolean" + }, + "mediaType": { + "type": "string", + "optional": true + }, + "linkUrl": { + "type": "string", + "optional": true + }, + "linkText": { + "type": "string", + "optional": true + }, + "srcUrl": { + "type": "string", + "optional": true + }, + "pageUrl": { + "type": "string", + "optional": true + }, + "frameUrl": { + "type": "string", + "optional": true + }, + "selectionText": { + "type": "string", + "optional": true + }, + "targetElementId": { + "type": "integer", + "optional": true + } + } + }, + { + "name": "tab", + "$ref": "tabs.Tab", + "description": "The details of the tab where the menu was opened." + } + ] + }, + { + "name": "onHidden", + "type": "function", + "description": "Fired when a menu is hidden. This event is only fired if onShown has fired before.", + "parameters": [] + } + ] + } +] diff --git a/browser/components/extensions/schemas/menus_child.json b/browser/components/extensions/schemas/menus_child.json new file mode 100644 index 0000000000..884c4708ec --- /dev/null +++ b/browser/components/extensions/schemas/menus_child.json @@ -0,0 +1,29 @@ +[ + { + "namespace": "menus", + "permissions": ["menus"], + "allowedContexts": ["content", "devtools"], + "description": "The part of the menus API that is available in all extension contexts, including content scripts.", + "functions": [ + { + "name": "getTargetElement", + "type": "function", + "allowedContexts": ["content", "devtools"], + "description": "Retrieve the element that was associated with a recent contextmenu event.", + "parameters": [ + { + "type": "integer", + "description": "The identifier of the clicked element, available as info.targetElementId in the menus.onShown, onClicked or onclick event.", + "name": "targetElementId" + } + ], + "returns": { + "type": "object", + "optional": true, + "isInstanceOf": "Element", + "additionalProperties": { "type": "any" } + } + } + ] + } +] diff --git a/browser/components/extensions/schemas/moz.build b/browser/components/extensions/schemas/moz.build new file mode 100644 index 0000000000..d988c0ff9b --- /dev/null +++ b/browser/components/extensions/schemas/moz.build @@ -0,0 +1,7 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +JAR_MANIFESTS += ["jar.mn"] diff --git a/browser/components/extensions/schemas/normandyAddonStudy.json b/browser/components/extensions/schemas/normandyAddonStudy.json new file mode 100644 index 0000000000..61075ab90e --- /dev/null +++ b/browser/components/extensions/schemas/normandyAddonStudy.json @@ -0,0 +1,130 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionPrivileged", + "choices": [ + { + "type": "string", + "enum": ["normandyAddonStudy"] + } + ] + } + ] + }, + { + "namespace": "normandyAddonStudy", + "description": "Normandy Study API", + "allowedContexts": ["content", "devtools"], + "defaultContexts": ["content", "devtools"], + "permissions": ["normandyAddonStudy"], + "types": [ + { + "id": "Study", + "type": "object", + "properties": { + "recipeId": { + "type": "integer", + "description": "The ID of the recipe for the study." + }, + "slug": { + "type": "string", + "description": "A slug to identify the study." + }, + "userFacingName": { + "type": "string", + "description": "The name presented on about:studies." + }, + "userFacingDescription": { + "type": "string", + "description": "The description presented on about:studies." + }, + "branch": { + "type": "string", + "description": "The study branch in which the user is enrolled." + }, + "active": { + "type": "boolean", + "description": "The state of the study." + }, + "addonId": { + "type": "string", + "description": "The ID of the extension installed by the study." + }, + "addonUrl": { + "type": "string", + "description": "The URL of the XPI that was downloaded and installed by the study." + }, + "addonVersion": { + "type": "string", + "description": "The version of the extension installed by the study." + }, + "studyStartDate": { + "$ref": "extensionTypes.Date", + "description": "The start date for the study." + }, + "studyEndDate": { + "$ref": "extensionTypes.Date", + "description": "The end date for the study." + }, + "extensionApiId": { + "type": "integer", + "description": "The record ID for the extension in Normandy server's database." + }, + "extensionHash": { + "type": "string", + "description": "A hash of the extension XPI file." + }, + "extensionHashAlgorithm": { + "type": "string", + "description": "The algorithm used to hash the extension XPI file." + } + } + } + ], + "functions": [ + { + "name": "getStudy", + "type": "function", + "description": "Returns a study object for the current study.", + "async": true, + "parameters": [] + }, + { + "name": "endStudy", + "type": "function", + "description": "Marks the study as ended and then uninstalls the addon.", + "async": true, + "parameters": [ + { + "type": "string", + "name": "reason", + "description": "The reason why the study is ending." + } + ] + }, + { + "name": "getClientMetadata", + "type": "function", + "description": "Returns an object with metadata about the client which may be required for constructing survey URLs.", + "async": true, + "parameters": [] + } + ], + "events": [ + { + "name": "onUnenroll", + "type": "function", + "description": "Fired when a user unenrolls from a study but before the addon is uninstalled.", + "parameters": [ + { + "type": "string", + "name": "reason", + "description": "The reason why the study is ending." + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/omnibox.json b/browser/components/extensions/schemas/omnibox.json new file mode 100644 index 0000000000..a05dfbce4b --- /dev/null +++ b/browser/components/extensions/schemas/omnibox.json @@ -0,0 +1,220 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "omnibox": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "keyword": { + "type": "string", + "pattern": "^[^?\\s:][^\\s:]*$" + } + }, + "optional": true + } + } + } + ] + }, + { + "namespace": "omnibox", + "description": "The omnibox API allows you to register a keyword with Firefox's address bar.", + "permissions": ["manifest:omnibox"], + "types": [ + { + "id": "DescriptionStyleType", + "type": "string", + "description": "The style type.", + "enum": ["url", "match", "dim"] + }, + { + "id": "OnInputEnteredDisposition", + "type": "string", + "enum": ["currentTab", "newForegroundTab", "newBackgroundTab"], + "description": "The window disposition for the omnibox query. This is the recommended context to display results. For example, if the omnibox command is to navigate to a certain URL, a disposition of 'newForegroundTab' means the navigation should take place in a new selected tab." + }, + { + "id": "SuggestResult", + "type": "object", + "description": "A suggest result.", + "properties": { + "content": { + "type": "string", + "minLength": 1, + "description": "The text that is put into the URL bar, and that is sent to the extension when the user chooses this entry." + }, + "description": { + "type": "string", + "minLength": 1, + "description": "The text that is displayed in the URL dropdown. Can contain XML-style markup for styling. The supported tags are 'url' (for a literal URL), 'match' (for highlighting text that matched what the user's query), and 'dim' (for dim helper text). The styles can be nested, eg. <dim><match>dimmed match</match></dim>. You must escape the five predefined entities to display them as text: stackoverflow.com/a/1091953/89484 " + }, + "deletable": { + "type": "boolean", + "optional": true, + "description": "Whether the suggest result can be deleted by the user." + }, + "descriptionStyles": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by the extension.", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by the extension.", + "properties": { + "offset": { "type": "integer" }, + "type": { + "description": "The style type", + "$ref": "DescriptionStyleType" + }, + "length": { "type": "integer", "optional": true } + } + } + }, + "descriptionStylesRaw": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by ToValue().", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by ToValue().", + "properties": { + "offset": { "type": "integer" }, + "type": { "type": "integer" } + } + } + } + } + }, + { + "id": "DefaultSuggestResult", + "type": "object", + "description": "A suggest result.", + "properties": { + "description": { + "type": "string", + "minLength": 1, + "description": "The text that is displayed in the URL dropdown." + }, + "descriptionStyles": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by the extension.", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by the extension.", + "properties": { + "offset": { "type": "integer" }, + "type": { + "description": "The style type", + "$ref": "DescriptionStyleType" + }, + "length": { "type": "integer", "optional": true } + } + } + }, + "descriptionStylesRaw": { + "optional": true, + "unsupported": true, + "type": "array", + "description": "An array of style ranges for the description, as provided by ToValue().", + "items": { + "type": "object", + "description": "The style ranges for the description, as provided by ToValue().", + "properties": { + "offset": { "type": "integer" }, + "type": { "type": "integer" } + } + } + } + } + } + ], + "functions": [ + { + "name": "setDefaultSuggestion", + "type": "function", + "description": "Sets the description and styling for the default suggestion. The default suggestion is the text that is displayed in the first suggestion row underneath the URL bar.", + "parameters": [ + { + "name": "suggestion", + "$ref": "DefaultSuggestResult", + "description": "A partial SuggestResult object, without the 'content' parameter." + } + ] + } + ], + "events": [ + { + "name": "onInputStarted", + "type": "function", + "description": "User has started a keyword input session by typing the extension's keyword. This is guaranteed to be sent exactly once per input session, and before any onInputChanged events.", + "parameters": [] + }, + { + "name": "onInputChanged", + "type": "function", + "description": "User has changed what is typed into the omnibox.", + "parameters": [ + { + "type": "string", + "name": "text" + }, + { + "name": "suggest", + "type": "function", + "description": "A callback passed to the onInputChanged event used for sending suggestions back to the browser.", + "parameters": [ + { + "name": "suggestResults", + "type": "array", + "description": "Array of suggest results", + "items": { + "$ref": "SuggestResult" + } + } + ] + } + ] + }, + { + "name": "onInputEntered", + "type": "function", + "description": "User has accepted what is typed into the omnibox.", + "parameters": [ + { + "type": "string", + "name": "text" + }, + { + "name": "disposition", + "$ref": "OnInputEnteredDisposition" + } + ] + }, + { + "name": "onInputCancelled", + "type": "function", + "description": "User has ended the keyword input session without accepting the input.", + "parameters": [] + }, + { + "name": "onDeleteSuggestion", + "type": "function", + "description": "User has deleted a suggested result.", + "parameters": [ + { + "type": "string", + "name": "text" + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/pkcs11.json b/browser/components/extensions/schemas/pkcs11.json new file mode 100644 index 0000000000..b47fcee257 --- /dev/null +++ b/browser/components/extensions/schemas/pkcs11.json @@ -0,0 +1,76 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["pkcs11"] + } + ] + } + ] + }, + { + "namespace": "pkcs11", + "description": "PKCS#11 module management API", + "permissions": ["pkcs11"], + "functions": [ + { + "name": "isModuleInstalled", + "type": "function", + "description": "checks whether a PKCS#11 module, given by name, is installed", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string" + } + ] + }, + { + "name": "installModule", + "type": "function", + "description": "Install a PKCS#11 module with a given name", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string" + }, + { + "name": "flags", + "type": "integer", + "optional": true + } + ] + }, + { + "name": "uninstallModule", + "type": "function", + "description": "Remove an installed PKCS#11 module from firefox", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string" + } + ] + }, + { + "name": "getModuleSlots", + "type": "function", + "description": "Enumerate a module's slots, each with their name and whether a token is present", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string" + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/search.json b/browser/components/extensions/schemas/search.json new file mode 100644 index 0000000000..abd4f59440 --- /dev/null +++ b/browser/components/extensions/schemas/search.json @@ -0,0 +1,127 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["search"] + } + ] + } + ] + }, + { + "namespace": "search", + "description": "Use browser.search to interact with search engines.", + "permissions": ["search"], + "types": [ + { + "id": "SearchEngine", + "type": "object", + "description": "An object encapsulating a search engine", + "properties": { + "name": { + "type": "string" + }, + "isDefault": { + "type": "boolean" + }, + "alias": { + "type": "string", + "optional": true + }, + "favIconUrl": { + "type": "string", + "optional": true, + "format": "url" + } + } + }, + { + "id": "Disposition", + "type": "string", + "description": "Location where search results should be displayed.", + "enum": ["CURRENT_TAB", "NEW_TAB", "NEW_WINDOW"] + } + ], + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets a list of search engines.", + "async": true, + "parameters": [] + }, + { + "name": "search", + "type": "function", + "description": "Perform a search.", + "async": true, + "parameters": [ + { + "type": "object", + "name": "searchProperties", + "properties": { + "query": { + "type": "string", + "description": "Terms to search for." + }, + "engine": { + "type": "string", + "optional": true, + "description": "Search engine to use. Uses the default if not specified." + }, + "disposition": { + "$ref": "Disposition", + "optional": true, + "description": "Location where search results should be displayed. NEW_TAB is the default." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "The ID of the tab for the search results. If not specified, a new tab is created, unless disposition is set. tabId cannot be used with disposition." + } + } + } + ] + }, + { + "name": "query", + "type": "function", + "async": "callback", + "description": "Use the chrome.search API to search via the default provider.", + "parameters": [ + { + "type": "object", + "name": "queryInfo", + "properties": { + "text": { + "type": "string", + "description": "String to query with the default search provider." + }, + "disposition": { + "$ref": "Disposition", + "optional": true, + "description": "Location where search results should be displayed. CURRENT_TAB is the default." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Location where search results should be displayed. tabId cannot be used with disposition." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/sessions.json b/browser/components/extensions/schemas/sessions.json new file mode 100644 index 0000000000..06b64e1525 --- /dev/null +++ b/browser/components/extensions/schemas/sessions.json @@ -0,0 +1,320 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["sessions"] + } + ] + } + ] + }, + { + "namespace": "sessions", + "description": "Use the <code>chrome.sessions</code> API to query and restore tabs and windows from a browsing session.", + "permissions": ["sessions"], + "types": [ + { + "id": "Filter", + "type": "object", + "properties": { + "maxResults": { + "type": "integer", + "minimum": 0, + "maximum": 25, + "optional": true, + "description": "The maximum number of entries to be fetched in the requested list. Omit this parameter to fetch the maximum number of entries ($(ref:sessions.MAX_SESSION_RESULTS))." + } + } + }, + { + "id": "Session", + "type": "object", + "properties": { + "lastModified": { + "type": "integer", + "description": "The time when the window or tab was closed or modified, represented in milliseconds since the epoch." + }, + "tab": { + "$ref": "tabs.Tab", + "optional": true, + "description": "The $(ref:tabs.Tab), if this entry describes a tab. Either this or $(ref:sessions.Session.window) will be set." + }, + "window": { + "$ref": "windows.Window", + "optional": true, + "description": "The $(ref:windows.Window), if this entry describes a window. Either this or $(ref:sessions.Session.tab) will be set." + } + } + }, + { + "id": "Device", + "type": "object", + "properties": { + "info": { "type": "string" }, + "deviceName": { + "type": "string", + "description": "The name of the foreign device." + }, + "sessions": { + "type": "array", + "items": { "$ref": "Session" }, + "description": "A list of open window sessions for the foreign device, sorted from most recently to least recently modified session." + } + } + } + ], + "functions": [ + { + "name": "forgetClosedTab", + "type": "function", + "description": "Forget a recently closed tab.", + "async": true, + "parameters": [ + { + "name": "windowId", + "type": "integer", + "description": "The windowId of the window to which the recently closed tab to be forgotten belongs." + }, + { + "name": "sessionId", + "type": "string", + "description": "The sessionId (closedId) of the recently closed tab to be forgotten." + } + ] + }, + { + "name": "forgetClosedWindow", + "type": "function", + "description": "Forget a recently closed window.", + "async": true, + "parameters": [ + { + "name": "sessionId", + "type": "string", + "description": "The sessionId (closedId) of the recently closed window to be forgotten." + } + ] + }, + { + "name": "getRecentlyClosed", + "type": "function", + "description": "Gets the list of recently closed tabs and/or windows.", + "async": "callback", + "parameters": [ + { + "$ref": "Filter", + "name": "filter", + "optional": true, + "default": {} + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "sessions", + "type": "array", + "items": { "$ref": "Session" }, + "description": "The list of closed entries in reverse order that they were closed (the most recently closed tab or window will be at index <code>0</code>). The entries may contain either tabs or windows." + } + ] + } + ] + }, + { + "name": "getDevices", + "unsupported": true, + "type": "function", + "description": "Retrieves all devices with synced sessions.", + "async": "callback", + "parameters": [ + { + "$ref": "Filter", + "name": "filter", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "devices", + "type": "array", + "items": { "$ref": "Device" }, + "description": "The list of $(ref:sessions.Device) objects for each synced session, sorted in order from device with most recently modified session to device with least recently modified session. $(ref:tabs.Tab) objects are sorted by recency in the $(ref:windows.Window) of the $(ref:sessions.Session) objects." + } + ] + } + ] + }, + { + "name": "restore", + "type": "function", + "description": "Reopens a $(ref:windows.Window) or $(ref:tabs.Tab), with an optional callback to run when the entry has been restored.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "sessionId", + "optional": true, + "description": "The $(ref:windows.Window.sessionId), or $(ref:tabs.Tab.sessionId) to restore. If this parameter is not specified, the most recently closed session is restored." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "$ref": "Session", + "name": "restoredSession", + "description": "A $(ref:sessions.Session) containing the restored $(ref:windows.Window) or $(ref:tabs.Tab) object." + } + ] + } + ] + }, + { + "name": "setTabValue", + "type": "function", + "description": "Set a key/value pair on a given tab.", + "async": true, + "parameters": [ + { + "type": "integer", + "minimum": 0, + "name": "tabId", + "description": "The id of the tab that the key/value pair is being set on." + }, + { + "type": "string", + "name": "key", + "description": "The key which corresponds to the value being set." + }, + { + "type": "any", + "name": "value", + "description": "The value being set." + } + ] + }, + { + "name": "getTabValue", + "type": "function", + "description": "Retrieve a value that was set for a given key on a given tab.", + "async": true, + "parameters": [ + { + "type": "integer", + "minimum": 0, + "name": "tabId", + "description": "The id of the tab whose value is being retrieved from." + }, + { + "type": "string", + "name": "key", + "description": "The key which corresponds to the value." + } + ] + }, + { + "name": "removeTabValue", + "type": "function", + "description": "Remove a key/value pair that was set on a given tab.", + "async": true, + "parameters": [ + { + "type": "integer", + "minimum": 0, + "name": "tabId", + "description": "The id of the tab whose key/value pair is being removed." + }, + { + "type": "string", + "name": "key", + "description": "The key which corresponds to the value." + } + ] + }, + { + "name": "setWindowValue", + "type": "function", + "description": "Set a key/value pair on a given window.", + "async": true, + "parameters": [ + { + "type": "integer", + "minimum": -2, + "name": "windowId", + "description": "The id of the window that the key/value pair is being set on." + }, + { + "type": "string", + "name": "key", + "description": "The key which corresponds to the value being set." + }, + { + "type": "any", + "name": "value", + "description": "The value being set." + } + ] + }, + { + "name": "getWindowValue", + "type": "function", + "description": "Retrieve a value that was set for a given key on a given window.", + "async": true, + "parameters": [ + { + "type": "integer", + "minimum": -2, + "name": "windowId", + "description": "The id of the window whose value is being retrieved from." + }, + { + "type": "string", + "name": "key", + "description": "The key which corresponds to the value." + } + ] + }, + { + "name": "removeWindowValue", + "type": "function", + "description": "Remove a key/value pair that was set on a given window.", + "async": true, + "parameters": [ + { + "type": "integer", + "minimum": -2, + "name": "windowId", + "description": "The id of the window whose key/value pair is being removed." + }, + { + "type": "string", + "name": "key", + "description": "The key which corresponds to the value." + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "description": "Fired when recently closed tabs and/or windows are changed. This event does not monitor synced sessions changes.", + "type": "function" + } + ], + "properties": { + "MAX_SESSION_RESULTS": { + "value": 25, + "description": "The maximum number of $(ref:sessions.Session) that will be included in a requested list." + } + } + } +] diff --git a/browser/components/extensions/schemas/sidebar_action.json b/browser/components/extensions/schemas/sidebar_action.json new file mode 100644 index 0000000000..a508cc1183 --- /dev/null +++ b/browser/components/extensions/schemas/sidebar_action.json @@ -0,0 +1,264 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "sidebar_action": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "default_title": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + "default_icon": { + "$ref": "IconPath", + "optional": true + }, + "browser_style": { + "type": "boolean", + "optional": true, + "description": "Defaults to true in Manifest V2; Deprecated in Manifest V3." + }, + "default_panel": { + "type": "string", + "format": "strictRelativeUrl", + "preprocess": "localize" + }, + "open_at_install": { + "type": "boolean", + "optional": true, + "default": true, + "description": "Whether or not the sidebar is opened at install. Default is <code>true</code>." + } + }, + "optional": true + } + } + } + ] + }, + { + "namespace": "sidebarAction", + "description": "Use sidebar actions to add a sidebar to Firefox.", + "permissions": ["manifest:sidebar_action"], + "types": [ + { + "id": "ImageDataType", + "type": "object", + "isInstanceOf": "ImageData", + "additionalProperties": { "type": "any" }, + "postprocess": "convertImageDataToURL", + "description": "Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element)." + } + ], + "functions": [ + { + "name": "setTitle", + "type": "function", + "description": "Sets the title of the sidebar action. This shows up in the tooltip.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "title": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "The string the sidebar action should display when moused over." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Sets the sidebar title for the tab specified by tabId. Automatically resets when the tab is closed." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "Sets the sidebar title for the window specified by windowId." + } + } + } + ] + }, + { + "name": "getTitle", + "type": "function", + "description": "Gets the title of the sidebar action.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "description": "Specify the tab to get the title from. If no tab nor window is specified, the global title is returned." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "Specify the window to get the title from. If no tab nor window is specified, the global title is returned." + } + } + } + ] + }, + { + "name": "setIcon", + "type": "function", + "description": "Sets the icon for the sidebar action. The icon can be specified either as the path to an image file or as the pixel data from a canvas element, or as dictionary of either one of those. Either the <strong>path</strong> or the <strong>imageData</strong> property must be specified.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "imageData": { + "choices": [ + { "$ref": "ImageDataType" }, + { + "type": "object", + "patternProperties": { + "^[1-9]\\d*$": { "$ref": "ImageDataType" } + }, + "additionalProperties": false + } + ], + "optional": true, + "description": "Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'" + }, + "path": { + "choices": [ + { "type": "string" }, + { + "type": "object", + "additionalProperties": { "type": "string" } + } + ], + "optional": true, + "description": "Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'" + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Sets the sidebar icon for the tab specified by tabId. Automatically resets when the tab is closed." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "Sets the sidebar icon for the window specified by windowId." + } + } + } + ] + }, + { + "name": "setPanel", + "type": "function", + "description": "Sets the url to the html document to be opened in the sidebar when the user clicks on the sidebar action's icon.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "Sets the sidebar url for the tab specified by tabId. Automatically resets when the tab is closed." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "Sets the sidebar url for the window specified by windowId." + }, + "panel": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "The url to the html file to show in a sidebar. If set to the empty string (''), no sidebar is shown." + } + } + } + ] + }, + { + "name": "getPanel", + "type": "function", + "description": "Gets the url to the html document set as the panel for this sidebar action.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "description": "Specify the tab to get the panel from. If no tab nor window is specified, the global panel is returned." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "Specify the window to get the panel from. If no tab nor window is specified, the global panel is returned." + } + } + } + ] + }, + { + "name": "open", + "type": "function", + "requireUserInput": true, + "description": "Opens the extension sidebar in the active window.", + "async": true, + "parameters": [] + }, + { + "name": "close", + "type": "function", + "requireUserInput": true, + "description": "Closes the extension sidebar in the active window if the sidebar belongs to the extension.", + "async": true, + "parameters": [] + }, + { + "name": "toggle", + "type": "function", + "requireUserInput": true, + "description": "Toggles the extension sidebar in the active window.", + "async": true, + "parameters": [] + }, + { + "name": "isOpen", + "type": "function", + "description": "Checks whether the sidebar action is open.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "windowId": { + "type": "integer", + "minimum": -2, + "optional": true, + "description": "Specify the window to get the openness from." + } + } + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/tabs.json b/browser/components/extensions/schemas/tabs.json new file mode 100644 index 0000000000..ee7cd3dd93 --- /dev/null +++ b/browser/components/extensions/schemas/tabs.json @@ -0,0 +1,1857 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["activeTab"] + } + ] + }, + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["tabs", "tabHide"] + } + ] + } + ] + }, + { + "namespace": "tabs", + "description": "Use the <code>browser.tabs</code> API to interact with the browser's tab system. You can use this API to create, modify, and rearrange tabs in the browser.", + "types": [ + { + "id": "MutedInfoReason", + "type": "string", + "description": "An event that caused a muted state change.", + "enum": [ + { + "name": "user", + "description": "A user input action has set/overridden the muted state." + }, + { + "name": "capture", + "description": "Tab capture started, forcing a muted state change." + }, + { + "name": "extension", + "description": "An extension, identified by the extensionId field, set the muted state." + } + ] + }, + { + "id": "MutedInfo", + "type": "object", + "description": "Tab muted state and the reason for the last state change.", + "properties": { + "muted": { + "type": "boolean", + "description": "Whether the tab is prevented from playing sound (but hasn't necessarily recently produced sound). Equivalent to whether the muted audio indicator is showing." + }, + "reason": { + "$ref": "MutedInfoReason", + "optional": true, + "description": "The reason the tab was muted or unmuted. Not set if the tab's mute state has never been changed." + }, + "extensionId": { + "type": "string", + "optional": true, + "description": "The ID of the extension that changed the muted state. Not set if an extension was not the reason the muted state last changed." + } + } + }, + { + "id": "SharingState", + "type": "object", + "description": "Tab sharing state for screen, microphone and camera.", + "properties": { + "screen": { + "type": "string", + "optional": true, + "description": "If the tab is sharing the screen the value will be one of \"Screen\", \"Window\", or \"Application\", or undefined if not screen sharing." + }, + "camera": { + "type": "boolean", + "description": "True if the tab is using the camera." + }, + "microphone": { + "type": "boolean", + "description": "True if the tab is using the microphone." + } + } + }, + { + "id": "Tab", + "type": "object", + "properties": { + "id": { + "type": "integer", + "minimum": -1, + "optional": true, + "description": "The ID of the tab. Tab IDs are unique within a browser session. Under some circumstances a Tab may not be assigned an ID, for example when querying foreign tabs using the $(ref:sessions) API, in which case a session ID may be present. Tab ID can also be set to $(ref:tabs.TAB_ID_NONE) for apps and devtools windows." + }, + "index": { + "type": "integer", + "minimum": -1, + "description": "The zero-based index of the tab within its window." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "The ID of the window the tab is contained within." + }, + "openerTabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that opened this tab, if any. This property is only present if the opener tab still exists." + }, + "highlighted": { + "type": "boolean", + "description": "Whether the tab is highlighted. Works as an alias of active" + }, + "active": { + "type": "boolean", + "description": "Whether the tab is active in its window. (Does not necessarily mean the window is focused.)" + }, + "pinned": { + "type": "boolean", + "description": "Whether the tab is pinned." + }, + "lastAccessed": { + "type": "integer", + "optional": true, + "description": "The last time the tab was accessed as the number of milliseconds since epoch." + }, + "audible": { + "type": "boolean", + "optional": true, + "description": "Whether the tab has produced sound over the past couple of seconds (but it might not be heard if also muted). Equivalent to whether the speaker audio indicator is showing." + }, + "autoDiscardable": { + "type": "boolean", + "optional": true, + "description": "Whether the tab can be discarded automatically by the browser when resources are low." + }, + "mutedInfo": { + "$ref": "MutedInfo", + "optional": true, + "description": "Current tab muted state and the reason for the last state change." + }, + "url": { + "type": "string", + "optional": true, + "permissions": ["tabs"], + "description": "The URL the tab is displaying. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission." + }, + "title": { + "type": "string", + "optional": true, + "permissions": ["tabs"], + "description": "The title of the tab. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission." + }, + "favIconUrl": { + "type": "string", + "optional": true, + "permissions": ["tabs"], + "description": "The URL of the tab's favicon. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission. It may also be an empty string if the tab is loading." + }, + "status": { + "type": "string", + "optional": true, + "description": "Either <em>loading</em> or <em>complete</em>." + }, + "discarded": { + "type": "boolean", + "optional": true, + "description": "True while the tab is not loaded with content." + }, + "incognito": { + "type": "boolean", + "description": "Whether the tab is in an incognito window." + }, + "width": { + "type": "integer", + "optional": true, + "description": "The width of the tab in pixels." + }, + "height": { + "type": "integer", + "optional": true, + "description": "The height of the tab in pixels." + }, + "hidden": { + "type": "boolean", + "optional": true, + "description": "True if the tab is hidden." + }, + "sessionId": { + "type": "string", + "optional": true, + "description": "The session ID used to uniquely identify a Tab obtained from the $(ref:sessions) API." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The CookieStoreId used for the tab." + }, + "isArticle": { + "type": "boolean", + "optional": true, + "description": "Whether the document in the tab can be rendered in reader mode." + }, + "isInReaderMode": { + "type": "boolean", + "optional": true, + "description": "Whether the document in the tab is being rendered in reader mode." + }, + "sharingState": { + "$ref": "SharingState", + "optional": true, + "description": "Current tab sharing state for screen, microphone and camera." + }, + "attention": { + "type": "boolean", + "optional": true, + "description": "Whether the tab is drawing attention." + }, + "successorTabId": { + "type": "integer", + "optional": true, + "minimum": -1, + "description": "The ID of this tab's successor, if any; $(ref:tabs.TAB_ID_NONE) otherwise." + } + } + }, + { + "id": "ZoomSettingsMode", + "type": "string", + "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.", + "enum": [ + { + "name": "automatic", + "description": "Zoom changes are handled automatically by the browser." + }, + { + "name": "manual", + "description": "Overrides the automatic handling of zoom changes. The <code>onZoomChange</code> event will still be dispatched, and it is the responsibility of the extension to listen for this event and manually scale the page. This mode does not support <code>per-origin</code> zooming, and will thus ignore the <code>scope</code> zoom setting and assume <code>per-tab</code>." + }, + { + "name": "disabled", + "description": "Disables all zooming in the tab. The tab will revert to the default zoom level, and all attempted zoom changes will be ignored." + } + ] + }, + { + "id": "ZoomSettingsScope", + "type": "string", + "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.", + "enum": [ + { + "name": "per-origin", + "description": "Zoom changes will persist in the zoomed page's origin, i.e. all other tabs navigated to that same origin will be zoomed as well. Moreover, <code>per-origin</code> zoom changes are saved with the origin, meaning that when navigating to other pages in the same origin, they will all be zoomed to the same zoom factor. The <code>per-origin</code> scope is only available in the <code>automatic</code> mode." + }, + { + "name": "per-tab", + "description": "Zoom changes only take effect in this tab, and zoom changes in other tabs will not affect the zooming of this tab. Also, <code>per-tab</code> zoom changes are reset on navigation; navigating a tab will always load pages with their <code>per-origin</code> zoom factors." + } + ] + }, + { + "id": "ZoomSettings", + "type": "object", + "description": "Defines how zoom changes in a tab are handled and at what scope.", + "properties": { + "mode": { + "$ref": "ZoomSettingsMode", + "description": "Defines how zoom changes are handled, i.e. which entity is responsible for the actual scaling of the page; defaults to <code>automatic</code>.", + "optional": true + }, + "scope": { + "$ref": "ZoomSettingsScope", + "description": "Defines whether zoom changes will persist for the page's origin, or only take effect in this tab; defaults to <code>per-origin</code> when in <code>automatic</code> mode, and <code>per-tab</code> otherwise.", + "optional": true + }, + "defaultZoomFactor": { + "type": "number", + "optional": true, + "description": "Used to return the default zoom level for the current tab in calls to tabs.getZoomSettings." + } + } + }, + { + "id": "PageSettings", + "type": "object", + "description": "Defines the page settings to be used when saving a page as a pdf file.", + "properties": { + "toFileName": { + "type": "string", + "optional": true, + "description": "The name of the file. May include optional .pdf extension." + }, + "paperSizeUnit": { + "type": "integer", + "optional": true, + "description": "The page size unit: 0 = inches, 1 = millimeters. Default: 0." + }, + "paperWidth": { + "type": "number", + "optional": true, + "description": "The paper width in paper size units. Default: 8.5." + }, + "paperHeight": { + "type": "number", + "optional": true, + "description": "The paper height in paper size units. Default: 11.0." + }, + "orientation": { + "type": "integer", + "optional": true, + "description": "The page content orientation: 0 = portrait, 1 = landscape. Default: 0." + }, + "scaling": { + "type": "number", + "optional": true, + "description": "The page content scaling factor: 1.0 = 100% = normal size. Default: 1.0." + }, + "shrinkToFit": { + "type": "boolean", + "optional": true, + "description": "Whether the page content should shrink to fit the page width (overrides scaling). Default: true." + }, + "showBackgroundColors": { + "type": "boolean", + "optional": true, + "description": "Whether the page background colors should be shown. Default: false." + }, + "showBackgroundImages": { + "type": "boolean", + "optional": true, + "description": "Whether the page background images should be shown. Default: false." + }, + "edgeLeft": { + "type": "number", + "optional": true, + "description": "The spacing between the left header/footer and the left edge of the paper (inches). Default: 0." + }, + "edgeRight": { + "type": "number", + "optional": true, + "description": "The spacing between the right header/footer and the right edge of the paper (inches). Default: 0." + }, + "edgeTop": { + "type": "number", + "optional": true, + "description": "The spacing between the top of the headers and the top edge of the paper (inches). Default: 0" + }, + "edgeBottom": { + "type": "number", + "optional": true, + "description": "The spacing between the bottom of the footers and the bottom edge of the paper (inches). Default: 0." + }, + "marginLeft": { + "type": "number", + "optional": true, + "description": "The margin between the page content and the left edge of the paper (inches). Default: 0.5." + }, + "marginRight": { + "type": "number", + "optional": true, + "description": "The margin between the page content and the right edge of the paper (inches). Default: 0.5." + }, + "marginTop": { + "type": "number", + "optional": true, + "description": "The margin between the page content and the top edge of the paper (inches). Default: 0.5." + }, + "marginBottom": { + "type": "number", + "optional": true, + "description": "The margin between the page content and the bottom edge of the paper (inches). Default: 0.5." + }, + "headerLeft": { + "type": "string", + "optional": true, + "description": "The text for the page's left header. Default: '&T'." + }, + "headerCenter": { + "type": "string", + "optional": true, + "description": "The text for the page's center header. Default: ''." + }, + "headerRight": { + "type": "string", + "optional": true, + "description": "The text for the page's right header. Default: '&U'." + }, + "footerLeft": { + "type": "string", + "optional": true, + "description": "The text for the page's left footer. Default: '&PT'." + }, + "footerCenter": { + "type": "string", + "optional": true, + "description": "The text for the page's center footer. Default: ''." + }, + "footerRight": { + "type": "string", + "optional": true, + "description": "The text for the page's right footer. Default: '&D'." + } + } + }, + { + "id": "TabStatus", + "type": "string", + "enum": ["loading", "complete"], + "description": "Whether the tabs have completed loading." + }, + { + "id": "WindowType", + "type": "string", + "enum": ["normal", "popup", "panel", "app", "devtools"], + "description": "The type of window." + }, + { + "id": "UpdatePropertyName", + "type": "string", + "enum": [ + "attention", + "audible", + "autoDiscardable", + "discarded", + "favIconUrl", + "hidden", + "isArticle", + "mutedInfo", + "pinned", + "sharingState", + "status", + "title", + "url" + ], + "description": "Event names supported in onUpdated." + }, + { + "id": "UpdateFilter", + "type": "object", + "description": "An object describing filters to apply to tabs.onUpdated events.", + "properties": { + "urls": { + "type": "array", + "description": "A list of URLs or URL patterns. Events that cannot match any of the URLs will be filtered out. Filtering with urls requires the <code>\"tabs\"</code> or <code>\"activeTab\"</code> permission.", + "optional": true, + "items": { "type": "string" }, + "minItems": 1 + }, + "properties": { + "type": "array", + "optional": true, + "description": "A list of property names. Events that do not match any of the names will be filtered out.", + "items": { "$ref": "UpdatePropertyName" }, + "minItems": 1 + }, + "tabId": { "type": "integer", "optional": true }, + "windowId": { "type": "integer", "optional": true } + } + } + ], + "properties": { + "TAB_ID_NONE": { + "value": -1, + "description": "An ID which represents the absence of a browser tab." + } + }, + "functions": [ + { + "name": "get", + "type": "function", + "description": "Retrieves details about the specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "function", + "name": "callback", + "parameters": [{ "name": "tab", "$ref": "Tab" }] + } + ] + }, + { + "name": "getCurrent", + "type": "function", + "description": "Gets the tab that this script call is being made from. May be undefined if called from a non-tab context (for example: a background page or popup view).", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "tab", + "$ref": "Tab", + "optional": true + } + ] + } + ] + }, + { + "name": "connect", + "type": "function", + "description": "Connects to the content script(s) in the specified tab. The $(ref:runtime.onConnect) event is fired in each content script running in the specified tab for the current extension. For more details, see $(topic:messaging)[Content Script Messaging].", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "object", + "name": "connectInfo", + "properties": { + "name": { + "type": "string", + "optional": true, + "description": "Will be passed into onConnect for content scripts that are listening for the connection event." + }, + "frameId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "Open a port to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab." + } + }, + "optional": true + } + ], + "returns": { + "$ref": "runtime.Port", + "description": "A port that can be used to communicate with the content scripts running in the specified tab. The port's $(ref:runtime.Port) event is fired if the tab closes or does not exist. " + } + }, + { + "name": "sendMessage", + "type": "function", + "description": "Sends a single message to the content script(s) in the specified tab, with an optional callback to run when a response is sent back. The $(ref:runtime.onMessage) event is fired in each content script running in the specified tab for the current extension.", + "async": "responseCallback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0 + }, + { + "type": "any", + "name": "message" + }, + { + "type": "object", + "name": "options", + "properties": { + "frameId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "Send a message to a specific $(topic:frame_ids)[frame] identified by <code>frameId</code> instead of all frames in the tab." + } + }, + "optional": true + }, + { + "type": "function", + "name": "responseCallback", + "optional": true, + "parameters": [ + { + "name": "response", + "type": "any", + "description": "The JSON response object sent by the handler of the message. If an error occurs while connecting to the specified tab, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message." + } + ] + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates a new tab.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "createProperties", + "properties": { + "windowId": { + "type": "integer", + "minimum": -2, + "optional": true, + "description": "The window to create the new tab in. Defaults to the $(topic:current-window)[current window]." + }, + "index": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The position the tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL to navigate the tab to initially. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page." + }, + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see $(ref:windows.update)). Defaults to <var>true</var>." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be pinned. Defaults to <var>false</var>" + }, + "openerTabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as the newly created tab." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The CookieStoreId for the tab that opened this tab." + }, + "openInReaderMode": { + "type": "boolean", + "optional": true, + "description": "Whether the document in the tab should be opened in reader mode." + }, + "discarded": { + "type": "boolean", + "optional": true, + "description": "Whether the tab is marked as 'discarded' when created." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title used for display if the tab is created in discarded mode." + }, + "muted": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be muted when created." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tab", + "$ref": "Tab", + "optional": true, + "description": "Details about the created tab. Will contain the ID of the new tab." + } + ] + } + ] + }, + { + "name": "duplicate", + "type": "function", + "description": "Duplicates a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "description": "The ID of the tab which is to be duplicated." + }, + { + "type": "object", + "name": "duplicateProperties", + "optional": true, + "properties": { + "index": { + "type": "integer", + "optional": true, + "description": "The position the new tab should take in the window. The provided value will be clamped to between zero and the number of tabs in the window." + }, + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should become the active tab in the window. Does not affect whether the window is focused (see $(ref:windows.update)). Defaults to <var>true</var>." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tab", + "optional": true, + "description": "Details about the duplicated tab. The $(ref:tabs.Tab) object doesn't contain <code>url</code>, <code>title</code> and <code>favIconUrl</code> if the <code>\"tabs\"</code> permission has not been requested.", + "$ref": "Tab" + } + ] + } + ] + }, + { + "name": "query", + "type": "function", + "description": "Gets all tabs that have the specified properties, or all tabs if no properties are specified.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "queryInfo", + "properties": { + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are active in their windows." + }, + "attention": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are drawing attention." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are pinned." + }, + "audible": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are audible." + }, + "autoDiscardable": { + "type": "boolean", + "optional": true, + "description": "Whether the tab can be discarded automatically by the browser when resources are low." + }, + "muted": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are muted." + }, + "highlighted": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are highlighted. Works as an alias of active." + }, + "currentWindow": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are in the $(topic:current-window)[current window]." + }, + "lastFocusedWindow": { + "type": "boolean", + "optional": true, + "description": "Whether the tabs are in the last focused window." + }, + "status": { + "$ref": "TabStatus", + "optional": true, + "description": "Whether the tabs have completed loading." + }, + "discarded": { + "type": "boolean", + "optional": true, + "description": "True while the tabs are not loaded with content." + }, + "hidden": { + "type": "boolean", + "optional": true, + "description": "True while the tabs are hidden." + }, + "title": { + "type": "string", + "optional": true, + "description": "Match page titles against a pattern." + }, + "url": { + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } } + ], + "optional": true, + "description": "Match tabs against one or more $(topic:match_patterns)[URL patterns]. Note that fragment identifiers are not matched." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "The ID of the parent window, or $(ref:windows.WINDOW_ID_CURRENT) for the $(topic:current-window)[current window]." + }, + "windowType": { + "$ref": "WindowType", + "optional": true, + "description": "The type of window the tabs are in." + }, + "index": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "The position of the tabs within their windows." + }, + "cookieStoreId": { + "choices": [ + { + "type": "array", + "items": { "type": "string" } + }, + { + "type": "string" + } + ], + "optional": true, + "description": "The CookieStoreId used for the tab." + }, + "openerTabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab." + }, + "screen": { + "choices": [ + { + "type": "string", + "enum": ["Screen", "Window", "Application"] + }, + { "type": "boolean" } + ], + "optional": true, + "description": "True for any screen sharing, or a string to specify type of screen sharing." + }, + "camera": { + "type": "boolean", + "optional": true, + "description": "True if the tab is using the camera." + }, + "microphone": { + "type": "boolean", + "optional": true, + "description": "True if the tab is using the microphone." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "array", + "items": { + "$ref": "Tab" + } + } + ] + } + ] + }, + { + "name": "highlight", + "type": "function", + "description": "Highlights the given tabs.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "highlightInfo", + "properties": { + "windowId": { + "type": "integer", + "optional": true, + "description": "The window that contains the tabs.", + "minimum": -2 + }, + "populate": { + "type": "boolean", + "optional": true, + "default": true, + "description": "If true, the $(ref:windows.Window) returned will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission. If false, the $(ref:windows.Window) won't have the <var>tabs</var> property." + }, + "tabs": { + "description": "One or more tab indices to highlight.", + "choices": [ + { + "type": "array", + "items": { "type": "integer", "minimum": 0 } + }, + { "type": "integer" } + ] + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", + "$ref": "windows.Window", + "description": "Contains details about the window whose tabs were highlighted." + } + ] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Modifies the properties of a tab. Properties that are not specified in <var>updateProperties</var> are not modified.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "Defaults to the selected tab of the $(topic:current-window)[current window]." + }, + { + "type": "object", + "name": "updateProperties", + "properties": { + "url": { + "type": "string", + "optional": true, + "description": "A URL to navigate the tab to." + }, + "active": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be active. Does not affect whether the window is focused (see $(ref:windows.update))." + }, + "autoDiscardable": { + "type": "boolean", + "optional": true, + "description": "Whether the tab can be discarded automatically by the browser when resources are low." + }, + "highlighted": { + "type": "boolean", + "optional": true, + "description": "Adds or removes the tab from the current selection." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be pinned." + }, + "muted": { + "type": "boolean", + "optional": true, + "description": "Whether the tab should be muted." + }, + "openerTabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that opened this tab. If specified, the opener tab must be in the same window as this tab." + }, + "loadReplace": { + "type": "boolean", + "optional": true, + "description": "Whether the load should replace the current history entry for the tab." + }, + "successorTabId": { + "type": "integer", + "minimum": -1, + "optional": true, + "description": "The ID of this tab's successor. If specified, the successor tab must be in the same window as this tab." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tab", + "$ref": "Tab", + "optional": true, + "description": "Details about the updated tab. The $(ref:tabs.Tab) object doesn't contain <code>url</code>, <code>title</code> and <code>favIconUrl</code> if the <code>\"tabs\"</code> permission has not been requested." + } + ] + } + ] + }, + { + "name": "move", + "type": "function", + "description": "Moves one or more tabs to a new position within its window, or to a new window. Note that tabs can only be moved to and from normal (window.type === \"normal\") windows.", + "async": "callback", + "parameters": [ + { + "name": "tabIds", + "description": "The tab or list of tabs to move.", + "choices": [ + { "type": "integer", "minimum": 0 }, + { "type": "array", "items": { "type": "integer", "minimum": 0 } } + ] + }, + { + "type": "object", + "name": "moveProperties", + "properties": { + "windowId": { + "type": "integer", + "minimum": -2, + "optional": true, + "description": "Defaults to the window the tab is currently in." + }, + "index": { + "type": "integer", + "minimum": -1, + "description": "The position to move the window to. -1 will place the tab at the end of the window." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "tabs", + "description": "Details about the moved tabs.", + "choices": [ + { "$ref": "Tab" }, + { "type": "array", "items": { "$ref": "Tab" } } + ] + } + ] + } + ] + }, + { + "name": "reload", + "type": "function", + "description": "Reload a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to reload; defaults to the selected tab of the current window." + }, + { + "type": "object", + "name": "reloadProperties", + "optional": true, + "properties": { + "bypassCache": { + "type": "boolean", + "optional": true, + "description": "Whether using any local cache. Default is false." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "warmup", + "type": "function", + "description": "Warm up a tab", + "async": true, + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": false, + "description": "The ID of the tab to warm up." + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Closes one or more tabs.", + "async": "callback", + "parameters": [ + { + "name": "tabIds", + "description": "The tab or list of tabs to close.", + "choices": [ + { "type": "integer", "minimum": 0 }, + { "type": "array", "items": { "type": "integer", "minimum": 0 } } + ] + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "discard", + "type": "function", + "description": "discards one or more tabs.", + "async": true, + "parameters": [ + { + "name": "tabIds", + "description": "The tab or list of tabs to discard.", + "choices": [ + { "type": "integer", "minimum": 0 }, + { "type": "array", "items": { "type": "integer", "minimum": 0 } } + ] + } + ] + }, + { + "name": "detectLanguage", + "type": "function", + "description": "Detects the primary language of the content in a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "Defaults to the active tab of the $(topic:current-window)[current window]." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "string", + "name": "language", + "description": "An ISO language code such as <code>en</code> or <code>fr</code>. For a complete list of languages supported by this method, see <a href='http://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc'>kLanguageInfoTable</a>. The 2nd to 4th columns will be checked and the first non-NULL value will be returned except for Simplified Chinese for which zh-CN will be returned. For an unknown language, <code>und</code> will be returned." + } + ] + } + ] + }, + { + "name": "toggleReaderMode", + "type": "function", + "description": "Toggles reader mode for the document in the tab.", + "async": true, + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "Defaults to the active tab of the $(topic:current-window)[current window]." + } + ] + }, + { + "name": "captureTab", + "type": "function", + "description": "Captures an area of a specified tab. You must have $(topic:declare_permissions)[<all_urls>] permission to use this method.", + "permissions": ["<all_urls>"], + "async": true, + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The tab to capture. Defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.ImageDetails", + "name": "options", + "optional": true + } + ] + }, + { + "name": "captureVisibleTab", + "type": "function", + "description": "Captures an area of the currently active tab in the specified window. You must have $(topic:declare_permissions)[<all_urls>] permission to use this method.", + "permissions": ["<all_urls>"], + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2, + "optional": true, + "description": "The target window. Defaults to the $(topic:current-window)[current window]." + }, + { + "$ref": "extensionTypes.ImageDetails", + "name": "options", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "string", + "name": "dataUrl", + "description": "A data URL which encodes an image of the visible area of the captured tab. May be assigned to the 'src' property of an HTML Image element for display." + } + ] + } + ] + }, + { + "name": "executeScript", + "type": "function", + "max_manifest_version": 2, + "description": "Injects JavaScript code into a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab in which to run the script; defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.InjectDetails", + "name": "details", + "description": "Details of the script to run." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after all the JavaScript has been executed.", + "parameters": [ + { + "name": "result", + "optional": true, + "type": "array", + "items": { "type": "any" }, + "description": "The result of the script in every injected frame." + } + ] + } + ] + }, + { + "name": "insertCSS", + "type": "function", + "max_manifest_version": 2, + "description": "Injects CSS into a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab in which to insert the CSS; defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.InjectDetails", + "name": "details", + "description": "Details of the CSS text to insert." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when all the CSS has been inserted.", + "parameters": [] + } + ] + }, + { + "name": "removeCSS", + "type": "function", + "max_manifest_version": 2, + "description": "Removes injected CSS from a page. For details, see the $(topic:content_scripts)[programmatic injection] section of the content scripts doc.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab from which to remove the injected CSS; defaults to the active tab of the current window." + }, + { + "$ref": "extensionTypes.InjectDetails", + "name": "details", + "description": "Details of the CSS text to remove." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when all the CSS has been removed.", + "parameters": [] + } + ] + }, + { + "name": "setZoom", + "type": "function", + "description": "Zooms a specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to zoom; defaults to the active tab of the current window." + }, + { + "type": "number", + "name": "zoomFactor", + "description": "The new zoom factor. Use a value of 0 here to set the tab to its current default zoom factor. Values greater than zero specify a (possibly non-default) zoom factor for the tab." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after the zoom factor has been changed.", + "parameters": [] + } + ] + }, + { + "name": "getZoom", + "type": "function", + "description": "Gets the current zoom factor of a specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to get the current zoom factor from; defaults to the active tab of the current window." + }, + { + "type": "function", + "name": "callback", + "description": "Called with the tab's current zoom factor after it has been fetched.", + "parameters": [ + { + "type": "number", + "name": "zoomFactor", + "description": "The tab's current zoom factor." + } + ] + } + ] + }, + { + "name": "setZoomSettings", + "type": "function", + "description": "Sets the zoom settings for a specified tab, which define how zoom changes are handled. These settings are reset to defaults upon navigating the tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "optional": true, + "minimum": 0, + "description": "The ID of the tab to change the zoom settings for; defaults to the active tab of the current window." + }, + { + "$ref": "ZoomSettings", + "name": "zoomSettings", + "description": "Defines how zoom changes are handled and at what scope." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after the zoom settings have been changed.", + "parameters": [] + } + ] + }, + { + "name": "getZoomSettings", + "type": "function", + "description": "Gets the current zoom settings of a specified tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "optional": true, + "minimum": 0, + "description": "The ID of the tab to get the current zoom settings from; defaults to the active tab of the current window." + }, + { + "type": "function", + "name": "callback", + "description": "Called with the tab's current zoom settings.", + "parameters": [ + { + "$ref": "ZoomSettings", + "name": "zoomSettings", + "description": "The tab's current zoom settings." + } + ] + } + ] + }, + { + "name": "print", + "type": "function", + "description": "Prints page in active tab.", + "parameters": [] + }, + { + "name": "printPreview", + "type": "function", + "description": "Shows print preview for page in active tab.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after print preview entered.", + "parameters": [] + } + ] + }, + { + "name": "saveAsPDF", + "type": "function", + "description": "Saves page in active tab as a PDF file.", + "async": "callback", + "parameters": [ + { + "$ref": "PageSettings", + "name": "pageSettings", + "description": "The page settings used to save the PDF file." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called after save as dialog closed.", + "parameters": [ + { + "type": "string", + "name": "status", + "description": "Save status: saved, replaced, canceled, not_saved, not_replaced." + } + ] + } + ] + }, + { + "name": "show", + "type": "function", + "description": "Shows one or more tabs.", + "permissions": ["tabHide"], + "async": true, + "parameters": [ + { + "name": "tabIds", + "description": "The TAB ID or list of TAB IDs to show.", + "choices": [ + { "type": "integer", "minimum": 0 }, + { "type": "array", "items": { "type": "integer", "minimum": 0 } } + ] + } + ] + }, + { + "name": "hide", + "type": "function", + "description": "Hides one or more tabs. The <code>\"tabHide\"</code> permission is required to hide tabs. Not all tabs are hidable. Returns an array of hidden tabs.", + "permissions": ["tabHide"], + "async": true, + "parameters": [ + { + "name": "tabIds", + "description": "The TAB ID or list of TAB IDs to hide.", + "choices": [ + { "type": "integer", "minimum": 0 }, + { "type": "array", "items": { "type": "integer", "minimum": 0 } } + ] + } + ] + }, + { + "name": "moveInSuccession", + "type": "function", + "async": true, + "description": "Removes an array of tabs from their lines of succession and prepends or appends them in a chain to another tab.", + "parameters": [ + { + "name": "tabIds", + "type": "array", + "items": { "type": "integer", "minimum": 0 }, + "minItems": 1, + "description": "An array of tab IDs to move in the line of succession. For each tab in the array, the tab's current predecessors will have their successor set to the tab's current successor, and each tab will then be set to be the successor of the previous tab in the array. Any tabs not in the same window as the tab indicated by the second argument (or the first tab in the array, if no second argument) will be skipped." + }, + { + "name": "tabId", + "type": "integer", + "optional": true, + "default": -1, + "minimum": -1, + "description": "The ID of a tab to set as the successor of the last tab in the array, or $(ref:tabs.TAB_ID_NONE) to leave the last tab without a successor. If options.append is true, then this tab is made the predecessor of the first tab in the array instead." + }, + { + "name": "options", + "type": "object", + "optional": true, + "properties": { + "append": { + "type": "boolean", + "optional": true, + "default": false, + "description": "Whether to move the tabs before (false) or after (true) tabId in the succession. Defaults to false." + }, + "insert": { + "type": "boolean", + "optional": true, + "default": false, + "description": "Whether to link up the current predecessors or successor (depending on options.append) of tabId to the other side of the chain after it is prepended or appended. If true, one of the following happens: if options.append is false, the first tab in the array is set as the successor of any current predecessors of tabId; if options.append is true, the current successor of tabId is set as the successor of the last tab in the array. Defaults to false." + } + } + } + ] + }, + { + "name": "goForward", + "type": "function", + "description": "Navigate to next page in tab's history, if available", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to navigate forward." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "goBack", + "type": "function", + "description": "Navigate to previous page in tab's history, if available.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "optional": true, + "description": "The ID of the tab to navigate backward." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onCreated", + "type": "function", + "description": "Fired when a tab is created. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.", + "parameters": [ + { + "$ref": "Tab", + "name": "tab", + "description": "Details of the tab that was created." + } + ] + }, + { + "name": "onUpdated", + "type": "function", + "description": "Fired when a tab is updated.", + "parameters": [ + { "type": "integer", "name": "tabId", "minimum": 0 }, + { + "type": "object", + "name": "changeInfo", + "description": "Lists the changes to the state of the tab that was updated.", + "properties": { + "attention": { + "type": "boolean", + "optional": true, + "description": "The tab's new attention state." + }, + "audible": { + "type": "boolean", + "optional": true, + "description": "The tab's new audible state." + }, + "autoDiscardable": { + "type": "boolean", + "optional": true, + "description": "The tab's new autoDiscardable state." + }, + "discarded": { + "type": "boolean", + "optional": true, + "description": "True while the tab is not loaded with content." + }, + "favIconUrl": { + "type": "string", + "optional": true, + "permissions": ["tabs"], + "description": "The tab's new favicon URL. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission." + }, + "hidden": { + "type": "boolean", + "optional": true, + "description": "The tab's new hidden state." + }, + "isArticle": { + "type": "boolean", + "optional": true, + "description": "Whether the document in the tab can be rendered in reader mode." + }, + "mutedInfo": { + "$ref": "MutedInfo", + "optional": true, + "description": "The tab's new muted state and the reason for the change." + }, + "pinned": { + "type": "boolean", + "optional": true, + "description": "The tab's new pinned state." + }, + "sharingState": { + "$ref": "SharingState", + "optional": true, + "description": "The tab's new sharing state for screen, microphone and camera." + }, + "status": { + "type": "string", + "optional": true, + "description": "The status of the tab. Can be either <em>loading</em> or <em>complete</em>." + }, + "title": { + "type": "string", + "optional": true, + "permissions": ["tabs"], + "description": "The title of the tab if it has changed. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission." + }, + "url": { + "type": "string", + "optional": true, + "permissions": ["tabs"], + "description": "The tab's URL if it has changed. This property is only present if the extension's manifest includes the <code>\"tabs\"</code> permission." + } + } + }, + { + "$ref": "Tab", + "name": "tab", + "description": "Gives the state of the tab that was updated." + } + ], + "extraParameters": [ + { + "$ref": "UpdateFilter", + "name": "filter", + "optional": true, + "description": "A set of filters that restricts the events that will be sent to this listener." + } + ] + }, + { + "name": "onMoved", + "type": "function", + "description": "Fired when a tab is moved within a window. Only one move event is fired, representing the tab the user directly moved. Move events are not fired for the other tabs that must move in response. This event is not fired when a tab is moved between windows. For that, see $(ref:tabs.onDetached).", + "parameters": [ + { "type": "integer", "name": "tabId", "minimum": 0 }, + { + "type": "object", + "name": "moveInfo", + "properties": { + "windowId": { "type": "integer", "minimum": 0 }, + "fromIndex": { "type": "integer", "minimum": 0 }, + "toIndex": { "type": "integer", "minimum": 0 } + } + } + ] + }, + { + "name": "onActivated", + "type": "function", + "description": "Fires when the active tab in a window changes. Note that the tab's URL may not be set at the time this event fired, but you can listen to onUpdated events to be notified when a URL is set.", + "parameters": [ + { + "type": "object", + "name": "activeInfo", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the tab that has become active." + }, + "previousTabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the tab that was previously active, if that tab is still open." + }, + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the window the active tab changed inside of." + } + } + } + ] + }, + { + "name": "onHighlighted", + "type": "function", + "description": "Fired when the highlighted or selected tabs in a window changes.", + "parameters": [ + { + "type": "object", + "name": "highlightInfo", + "properties": { + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The window whose tabs changed." + }, + "tabIds": { + "type": "array", + "items": { "type": "integer", "minimum": 0 }, + "description": "All highlighted tabs in the window." + } + } + } + ] + }, + { + "name": "onDetached", + "type": "function", + "description": "Fired when a tab is detached from a window, for example because it is being moved between windows.", + "parameters": [ + { "type": "integer", "name": "tabId", "minimum": 0 }, + { + "type": "object", + "name": "detachInfo", + "properties": { + "oldWindowId": { "type": "integer", "minimum": 0 }, + "oldPosition": { "type": "integer", "minimum": 0 } + } + } + ] + }, + { + "name": "onAttached", + "type": "function", + "description": "Fired when a tab is attached to a window, for example because it was moved between windows.", + "parameters": [ + { "type": "integer", "name": "tabId", "minimum": 0 }, + { + "type": "object", + "name": "attachInfo", + "properties": { + "newWindowId": { "type": "integer", "minimum": 0 }, + "newPosition": { "type": "integer", "minimum": 0 } + } + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a tab is closed.", + "parameters": [ + { "type": "integer", "name": "tabId", "minimum": 0 }, + { + "type": "object", + "name": "removeInfo", + "properties": { + "windowId": { + "type": "integer", + "minimum": 0, + "description": "The window whose tab is closed." + }, + "isWindowClosing": { + "type": "boolean", + "description": "True when the tab is being closed because its window is being closed." + } + } + } + ] + }, + { + "name": "onReplaced", + "type": "function", + "description": "Fired when a tab is replaced with another tab due to prerendering or instant.", + "parameters": [ + { "type": "integer", "name": "addedTabId", "minimum": 0 }, + { "type": "integer", "name": "removedTabId", "minimum": 0 } + ] + }, + { + "name": "onZoomChange", + "type": "function", + "description": "Fired when a tab is zoomed.", + "parameters": [ + { + "type": "object", + "name": "ZoomChangeInfo", + "properties": { + "tabId": { "type": "integer", "minimum": 0 }, + "oldZoomFactor": { "type": "number" }, + "newZoomFactor": { "type": "number" }, + "zoomSettings": { "$ref": "ZoomSettings" } + } + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/top_sites.json b/browser/components/extensions/schemas/top_sites.json new file mode 100644 index 0000000000..a2d86e9b06 --- /dev/null +++ b/browser/components/extensions/schemas/top_sites.json @@ -0,0 +1,133 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["topSites"] + } + ] + } + ] + }, + { + "namespace": "topSites", + "description": "Use the chrome.topSites API to access the top sites that are displayed on the new tab page. ", + "permissions": ["topSites"], + "types": [ + { + "id": "MostVisitedURL", + "type": "object", + "description": "An object encapsulating a most visited URL, such as the URLs on the new tab page.", + "properties": { + "url": { + "type": "string", + "description": "The most visited URL." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the page." + }, + "favicon": { + "type": "string", + "optional": true, + "description": "Data URL for the favicon, if available." + }, + "type": { + "type": "string", + "enum": ["url", "search"], + "optional": true, + "default": "url", + "description": "The entry type, either <code>url</code> for a normal page link, or <code>search</code> for a search shortcut." + } + } + } + ], + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets a list of top sites.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "options", + "properties": { + "providers": { + "type": "array", + "items": { "type": "string" }, + "deprecated": "Please use the other options to tune the results received from topSites.", + "default": [], + "optional": true + }, + "limit": { + "type": "integer", + "default": 12, + "maximum": 100, + "minimum": 1, + "optional": true, + "description": "The number of top sites to return, defaults to the value used by Firefox" + }, + "onePerDomain": { + "type": "boolean", + "default": true, + "optional": true, + "description": "Limit the result to a single top site link per domain" + }, + "includeBlocked": { + "type": "boolean", + "default": false, + "optional": true, + "description": "Include sites that the user has blocked from appearing on the Firefox new tab." + }, + "includeFavicon": { + "type": "boolean", + "default": false, + "optional": true, + "description": "Include sites favicon if available." + }, + "includePinned": { + "type": "boolean", + "default": false, + "optional": true, + "description": "Include sites that the user has pinned on the Firefox new tab." + }, + "includeSearchShortcuts": { + "type": "boolean", + "default": false, + "optional": true, + "description": "Include search shortcuts appearing on the Firefox new tab." + }, + "newtab": { + "type": "boolean", + "default": false, + "optional": true, + "description": "Return the sites that exactly appear on the user's new-tab page. When true, all other options are ignored except limit and includeFavicon. If the user disabled newtab Top Sites, the newtab parameter will be ignored." + } + }, + "default": {}, + "optional": true + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "MostVisitedURL" + } + } + ] + } + ] + } + ] + } +] diff --git a/browser/components/extensions/schemas/url_overrides.json b/browser/components/extensions/schemas/url_overrides.json new file mode 100644 index 0000000000..8c8449ee57 --- /dev/null +++ b/browser/components/extensions/schemas/url_overrides.json @@ -0,0 +1,35 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "chrome_url_overrides": { + "type": "object", + "optional": true, + "properties": { + "newtab": { + "$ref": "ExtensionURL", + "optional": true, + "preprocess": "localize" + }, + "bookmarks": { + "unsupported": true, + "$ref": "ExtensionURL", + "optional": true, + "preprocess": "localize" + }, + "history": { + "unsupported": true, + "$ref": "ExtensionURL", + "optional": true, + "preprocess": "localize" + } + } + } + } + } + ] + } +] diff --git a/browser/components/extensions/schemas/windows.json b/browser/components/extensions/schemas/windows.json new file mode 100644 index 0000000000..7cc1b209cd --- /dev/null +++ b/browser/components/extensions/schemas/windows.json @@ -0,0 +1,505 @@ +[ + { + "namespace": "windows", + "description": "Use the <code>browser.windows</code> API to interact with browser windows. You can use this API to create, modify, and rearrange windows in the browser.", + "types": [ + { + "id": "WindowType", + "type": "string", + "description": "The type of browser window this is. Under some circumstances a Window may not be assigned type property, for example when querying closed windows from the $(ref:sessions) API.", + "enum": ["normal", "popup", "panel", "app", "devtools"] + }, + { + "id": "WindowState", + "type": "string", + "description": "The state of this browser window. Under some circumstances a Window may not be assigned state property, for example when querying closed windows from the $(ref:sessions) API.", + "enum": ["normal", "minimized", "maximized", "fullscreen", "docked"] + }, + { + "id": "Window", + "type": "object", + "properties": { + "id": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "The ID of the window. Window IDs are unique within a browser session. Under some circumstances a Window may not be assigned an ID, for example when querying windows using the $(ref:sessions) API, in which case a session ID may be present." + }, + "focused": { + "type": "boolean", + "description": "Whether the window is currently the focused window." + }, + "top": { + "type": "integer", + "optional": true, + "description": "The offset of the window from the top edge of the screen in pixels. Under some circumstances a Window may not be assigned top property, for example when querying closed windows from the $(ref:sessions) API." + }, + "left": { + "type": "integer", + "optional": true, + "description": "The offset of the window from the left edge of the screen in pixels. Under some circumstances a Window may not be assigned left property, for example when querying closed windows from the $(ref:sessions) API." + }, + "width": { + "type": "integer", + "optional": true, + "description": "The width of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned width property, for example when querying closed windows from the $(ref:sessions) API." + }, + "height": { + "type": "integer", + "optional": true, + "description": "The height of the window, including the frame, in pixels. Under some circumstances a Window may not be assigned height property, for example when querying closed windows from the $(ref:sessions) API." + }, + "tabs": { + "type": "array", + "items": { "$ref": "tabs.Tab" }, + "optional": true, + "description": "Array of $(ref:tabs.Tab) objects representing the current tabs in the window." + }, + "incognito": { + "type": "boolean", + "description": "Whether the window is incognito." + }, + "type": { + "$ref": "WindowType", + "optional": true, + "description": "The type of browser window this is." + }, + "state": { + "$ref": "WindowState", + "optional": true, + "description": "The state of this browser window." + }, + "alwaysOnTop": { + "type": "boolean", + "description": "Whether the window is set to be always on top." + }, + "sessionId": { + "type": "string", + "optional": true, + "description": "The session ID used to uniquely identify a Window obtained from the $(ref:sessions) API." + }, + "title": { + "type": "string", + "optional": true, + "description": "The title of the window. Read-only." + } + } + }, + { + "id": "CreateType", + "type": "string", + "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set.", + "enum": ["normal", "popup", "panel", "detached_panel"] + }, + { + "id": "GetInfo", + "type": "object", + "description": "Specifies whether the $(ref:windows.Window) returned should contain a list of the $(ref:tabs.Tab) objects.", + "properties": { + "populate": { + "type": "boolean", + "optional": true, + "description": "If true, the $(ref:windows.Window) returned will have a <var>tabs</var> property that contains a list of the $(ref:tabs.Tab) objects. The <code>Tab</code> objects only contain the <code>url</code>, <code>title</code> and <code>favIconUrl</code> properties if the extension's manifest file includes the <code>\"tabs\"</code> permission." + }, + "windowTypes": { + "type": "array", + "items": { + "$ref": "WindowType" + }, + "optional": true, + "deprecated": true, + "description": "<code>windowTypes</code> is deprecated and ignored on Firefox." + } + } + } + ], + "properties": { + "WINDOW_ID_NONE": { + "value": -1, + "description": "The windowId value that represents the absence of a browser window." + }, + "WINDOW_ID_CURRENT": { + "value": -2, + "description": "The windowId value that represents the $(topic:current-window)[current window]." + } + }, + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets details about a window.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2 + }, + { + "$ref": "GetInfo", + "name": "getInfo", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "getCurrent", + "type": "function", + "description": "Gets the $(topic:current-window)[current window].", + "async": "callback", + "parameters": [ + { + "$ref": "GetInfo", + "name": "getInfo", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "getLastFocused", + "type": "function", + "description": "Gets the window that was most recently focused — typically the window 'on top'.", + "async": "callback", + "parameters": [ + { + "$ref": "GetInfo", + "name": "getInfo", + "optional": true + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "getAll", + "type": "function", + "description": "Gets all windows.", + "async": "callback", + "parameters": [ + { + "type": "object", + "$import": "GetInfo", + "name": "getInfo", + "optional": true, + "description": "Specifies properties used to filter the $(ref:windows.Window) returned and to determine whether they should contain a list of the $(ref:tabs.Tab) objects.", + "properties": { + "windowTypes": { + "type": "array", + "items": { "$ref": "WindowType" }, + "optional": true, + "description": "If set, the $(ref:windows.Window) returned will be filtered based on its type. If unset the default filter is set to <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "windows", + "type": "array", + "items": { "$ref": "Window" } + } + ] + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates (opens) a new browser with any optional sizing, position or default URL provided.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "createData", + "optional": true, + "default": {}, + "properties": { + "url": { + "description": "A URL or array of URLs to open as tabs in the window. Fully-qualified URLs must include a scheme (i.e. 'http://www.google.com', not 'www.google.com'). Relative URLs will be relative to the current page within the extension. Defaults to the New Tab Page.", + "optional": true, + "choices": [ + { "type": "string" }, + { + "type": "array", + "items": { "type": "string" } + } + ] + }, + "tabId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The id of the tab for which you want to adopt to the new window." + }, + "left": { + "type": "integer", + "optional": true, + "description": "The number of pixels to position the new window from the left edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels." + }, + "top": { + "type": "integer", + "optional": true, + "description": "The number of pixels to position the new window from the top edge of the screen. If not specified, the new window is offset naturally from the last focused window. This value is ignored for panels." + }, + "width": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The width in pixels of the new window, including the frame. If not specified defaults to a natural width." + }, + "height": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The height in pixels of the new window, including the frame. If not specified defaults to a natural height." + }, + "focused": { + "choices": [ + { + "type": "boolean", + "enum": [true] + }, + { + "type": "boolean", + "enum": [false], + "deprecated": "Opening inactive windows is not supported." + } + ], + "optional": true, + "description": "If true, opens an active window. If false, opens an inactive window." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "Whether the new window should be an incognito window." + }, + "type": { + "$ref": "CreateType", + "optional": true, + "description": "Specifies what type of browser window to create. The 'panel' and 'detached_panel' types create a popup unless the '--enable-panels' flag is set." + }, + "state": { + "$ref": "WindowState", + "optional": true, + "description": "The initial state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'." + }, + "allowScriptsToClose": { + "type": "boolean", + "optional": true, + "description": "Allow scripts to close the window." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The CookieStoreId to use for all tabs that were created when the window is opened." + }, + "titlePreface": { + "type": "string", + "optional": true, + "description": "A string to add to the beginning of the window title." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", + "$ref": "Window", + "description": "Contains details about the created window.", + "optional": true + } + ] + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates the properties of a window. Specify only the properties that you want to change; unspecified properties will be left unchanged.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2 + }, + { + "type": "object", + "name": "updateInfo", + "properties": { + "left": { + "type": "integer", + "optional": true, + "description": "The offset from the left edge of the screen to move the window to in pixels. This value is ignored for panels." + }, + "top": { + "type": "integer", + "optional": true, + "description": "The offset from the top edge of the screen to move the window to in pixels. This value is ignored for panels." + }, + "width": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The width to resize the window to in pixels. This value is ignored for panels." + }, + "height": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The height to resize the window to in pixels. This value is ignored for panels." + }, + "focused": { + "type": "boolean", + "optional": true, + "description": "If true, brings the window to the front. If false, brings the next window in the z-order to the front." + }, + "drawAttention": { + "type": "boolean", + "optional": true, + "description": "If true, causes the window to be displayed in a manner that draws the user's attention to the window, without changing the focused window. The effect lasts until the user changes focus to the window. This option has no effect if the window already has focus. Set to false to cancel a previous draw attention request." + }, + "state": { + "$ref": "WindowState", + "optional": true, + "description": "The new state of the window. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'." + }, + "titlePreface": { + "type": "string", + "optional": true, + "description": "A string to add to the beginning of the window title." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "window", + "$ref": "Window" + } + ] + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes (closes) a window, and all the tabs inside it.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -2 + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onCreated", + "type": "function", + "description": "Fired when a window is created.", + "filters": [ + { + "name": "windowTypes", + "type": "array", + "items": { "$ref": "WindowType" }, + "description": "Conditions that the window's type being created must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + ], + "parameters": [ + { + "$ref": "Window", + "name": "window", + "description": "Details of the window that was created." + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a window is removed (closed).", + "filters": [ + { + "name": "windowTypes", + "type": "array", + "items": { "$ref": "WindowType" }, + "description": "Conditions that the window's type being removed must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + ], + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": 0, + "description": "ID of the removed window." + } + ] + }, + { + "name": "onFocusChanged", + "type": "function", + "description": "Fired when the currently focused window changes. Will be $(ref:windows.WINDOW_ID_NONE) if all browser windows have lost focus. Note: On some Linux window managers, WINDOW_ID_NONE will always be sent immediately preceding a switch from one browser window to another.", + "filters": [ + { + "name": "windowTypes", + "type": "array", + "items": { "$ref": "WindowType" }, + "description": "Conditions that the window's type being removed must satisfy. By default it will satisfy <code>['app', 'normal', 'panel', 'popup']</code>, with <code>'app'</code> and <code>'panel'</code> window types limited to the extension's own windows." + } + ], + "parameters": [ + { + "type": "integer", + "name": "windowId", + "minimum": -1, + "description": "ID of the newly focused window." + } + ] + } + ] + } +] |