diff options
Diffstat (limited to 'toolkit/components/extensions/schemas')
45 files changed, 13129 insertions, 0 deletions
diff --git a/toolkit/components/extensions/schemas/LICENSE b/toolkit/components/extensions/schemas/LICENSE new file mode 100644 index 0000000000..9314092fdc --- /dev/null +++ b/toolkit/components/extensions/schemas/LICENSE @@ -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/toolkit/components/extensions/schemas/activity_log.json b/toolkit/components/extensions/schemas/activity_log.json new file mode 100644 index 0000000000..7f60817539 --- /dev/null +++ b/toolkit/components/extensions/schemas/activity_log.json @@ -0,0 +1,101 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionPrivileged", + "choices": [ + { + "type": "string", + "enum": ["activityLog"] + } + ] + } + ] + }, + { + "namespace": "activityLog", + "description": "Monitor extension activity", + "permissions": ["activityLog"], + "events": [ + { + "name": "onExtensionActivity", + "description": "Receives an activityItem for each logging event.", + "type": "function", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "timeStamp": { + "$ref": "extensionTypes.Date", + "description": "The date string when this call is triggered." + }, + "type": { + "type": "string", + "enum": [ + "api_call", + "api_event", + "content_script", + "user_script" + ], + "description": "The type of log entry. api_call is a function call made by the extension and api_event is an event callback to the extension. content_script is logged when a content script is injected." + }, + "viewType": { + "type": "string", + "optional": true, + "enum": [ + "background", + "popup", + "sidebar", + "tab", + "devtools_page", + "devtools_panel" + ], + "description": "The type of view where the activity occurred. Content scripts will not have a viewType." + }, + "name": { + "type": "string", + "description": "The name of the api call or event, or the script url if this is a content or user script event." + }, + "data": { + "type": "object", + "properties": { + "args": { + "type": "array", + "optional": true, + "items": { + "type": "any" + }, + "description": "A list of arguments passed to the call." + }, + "result": { + "type": "object", + "optional": true, + "description": "The result of the call." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "The tab associated with this event if it is a tab or content script." + }, + "url": { + "type": "string", + "optional": true, + "description": "If the type is content_script, this is the url of the script that was injected." + } + } + } + } + } + ], + "extraParameters": [ + { + "name": "id", + "type": "string" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/alarms.json b/toolkit/components/extensions/schemas/alarms.json new file mode 100644 index 0000000000..6fd754569c --- /dev/null +++ b/toolkit/components/extensions/schemas/alarms.json @@ -0,0 +1,170 @@ +// 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 file. + +[ + { + "namespace": "alarms", + "permissions": ["alarms"], + "types": [ + { + "id": "Alarm", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of this alarm." + }, + "scheduledTime": { + "type": "number", + "description": "Time when the alarm is scheduled to fire, in milliseconds past the epoch." + }, + "periodInMinutes": { + "type": "number", + "optional": true, + "description": "When present, signals that the alarm triggers periodically after so many minutes." + } + } + } + ], + "functions": [ + { + "name": "create", + "type": "function", + "description": "Creates an alarm. After the delay is expired, the onAlarm event is fired. If there is another alarm with the same name (or no name if none is specified), it will be cancelled and replaced by this alarm.", + "parameters": [ + { + "type": "string", + "name": "name", + "optional": true, + "description": "Optional name to identify this alarm. Defaults to the empty string." + }, + { + "type": "object", + "name": "alarmInfo", + "description": "Details about the alarm. The alarm first fires either at 'when' milliseconds past the epoch (if 'when' is provided), after 'delayInMinutes' minutes from the current time (if 'delayInMinutes' is provided instead), or after 'periodInMinutes' minutes from the current time (if only 'periodInMinutes' is provided). Users should never provide both 'when' and 'delayInMinutes'. If 'periodInMinutes' is provided, then the alarm recurs repeatedly after that many minutes.", + "properties": { + "when": { + "type": "number", + "optional": true, + "description": "Time when the alarm is scheduled to first fire, in milliseconds past the epoch." + }, + "delayInMinutes": { + "type": "number", + "optional": true, + "description": "Number of minutes from the current time after which the alarm should first fire." + }, + "periodInMinutes": { + "type": "number", + "optional": true, + "description": "Number of minutes after which the alarm should recur repeatedly." + } + } + } + ] + }, + { + "name": "get", + "type": "function", + "description": "Retrieves details about the specified alarm.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "name", + "optional": true, + "description": "The name of the alarm to get. Defaults to the empty string." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "alarm", + "$ref": "Alarm", + "optional": true + } + ] + } + ] + }, + { + "name": "getAll", + "type": "function", + "description": "Gets an array of all the alarms.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "alarms", + "type": "array", + "items": { "$ref": "Alarm" } + } + ] + } + ] + }, + { + "name": "clear", + "type": "function", + "description": "Clears the alarm with the given name.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "name", + "optional": true, + "description": "The name of the alarm to clear. Defaults to the empty string." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "wasCleared", + "type": "boolean", + "description": "Whether an alarm of the given name was found to clear." + } + ] + } + ] + }, + { + "name": "clearAll", + "type": "function", + "description": "Clears all alarms.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "wasCleared", + "type": "boolean", + "description": "Whether any alarm was found to clear." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onAlarm", + "type": "function", + "description": "Fired when an alarm has expired. Useful for transient background pages.", + "parameters": [ + { + "name": "name", + "$ref": "Alarm", + "description": "The alarm that has expired." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/browser_action.json b/toolkit/components/extensions/schemas/browser_action.json new file mode 100644 index 0000000000..b74ff5348e --- /dev/null +++ b/toolkit/components/extensions/schemas/browser_action.json @@ -0,0 +1,508 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "id": "ActionManifest", + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "default_title": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + "default_icon": { + "$ref": "IconPath", + "optional": true + }, + "theme_icons": { + "type": "array", + "optional": true, + "minItems": 1, + "items": { "$ref": "ThemeIcons" }, + "description": "Specifies icons to use for dark and light themes" + }, + "default_popup": { + "type": "string", + "format": "relativeUrl", + "optional": true, + "preprocess": "localize" + }, + "browser_style": { + "type": "boolean", + "optional": true, + "description": "Deprecated in Manifest V3." + }, + "default_area": { + "description": "Defines the location the browserAction will appear by default. The default location is navbar.", + "type": "string", + "enum": ["navbar", "menupanel", "tabstrip", "personaltoolbar"], + "optional": true + } + } + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "action": { + "min_manifest_version": 3, + "$ref": "ActionManifest", + "optional": true + } + } + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "browser_action": { + "max_manifest_version": 2, + "$ref": "ActionManifest", + "optional": true + } + } + } + ] + }, + { + "namespace": "action", + "description": "Use browser actions to put icons in the main browser toolbar, to the right of the address bar. In addition to its icon, a browser action can also have a tooltip, a badge, and a popup.", + "permissions": ["manifest:action", "manifest:browser_action"], + "min_manifest_version": 3, + "types": [ + { + "id": "Details", + "type": "object", + "description": "Specifies to which tab or window the value should be set, or from which one it should be retrieved. If no tab nor window is specified, the global value is set or retrieved.", + "properties": { + "tabId": { + "type": "integer", + "optional": true, + "minimum": 0, + "description": "When setting a value, it will be specific to the specified tab, and will automatically reset when the tab navigates. When getting, specifies the tab to get the value from; if there is no tab-specific value, the window one will be inherited." + }, + "windowId": { + "type": "integer", + "optional": true, + "minimum": -2, + "description": "When setting a value, it will be specific to the specified window. When getting, specifies the window to get the value from; if there is no window-specific value, the global one will be inherited." + } + } + }, + { + "id": "ColorArray", + "type": "array", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + }, + "minItems": 4, + "maxItems": 4 + }, + { + "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)." + }, + { + "id": "ColorValue", + "description": "An array of four integers in the range [0,255] that make up the RGBA color of the badge. For example, opaque red is <code>[255, 0, 0, 255]</code>. Can also be a string with a CSS value, with opaque red being <code>#FF0000</code> or <code>#F00</code>.", + "choices": [ + { "type": "string" }, + { "$ref": "ColorArray" }, + { "type": "null" } + ] + }, + { + "id": "OnClickData", + "type": "object", + "description": "Information sent when a browser action is clicked.", + "properties": { + "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." + } + } + } + ], + "functions": [ + { + "name": "setTitle", + "type": "function", + "description": "Sets the title of the browser action. This shows up in the tooltip.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "$import": "Details", + "properties": { + "title": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "The string the browser action should display when moused over." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getTitle", + "type": "function", + "description": "Gets the title of the browser action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "$ref": "Details" + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setIcon", + "type": "function", + "description": "Sets the icon for the browser 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 <b>path</b> or the <b>imageData</b> property must be specified.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "$import": "Details", + "properties": { + "imageData": { + "choices": [ + { "$ref": "ImageDataType" }, + { + "type": "object", + "patternProperties": { + "^[1-9]\\d*$": { "$ref": "ImageDataType" } + } + } + ], + "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", + "patternProperties": { + "^[1-9]\\d*$": { "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}'" + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "setPopup", + "type": "function", + "description": "Sets the html document to be opened as a popup when the user clicks on the browser action's icon.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "$import": "Details", + "properties": { + "popup": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getPopup", + "type": "function", + "description": "Gets the html document set as the popup for this browser action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "$ref": "Details" + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setBadgeText", + "type": "function", + "description": "Sets the badge text for the browser action. The badge is displayed on top of the icon.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "$import": "Details", + "properties": { + "text": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "Any number of characters can be passed, but only about four can fit in the space." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getBadgeText", + "type": "function", + "description": "Gets the badge text of the browser action. If no tab nor window is specified is specified, the global badge text is returned.", + "async": "callback", + "parameters": [ + { + "name": "details", + "$ref": "Details" + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setBadgeBackgroundColor", + "type": "function", + "description": "Sets the background color for the badge.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "$import": "Details", + "properties": { + "color": { "$ref": "ColorValue" } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "getBadgeBackgroundColor", + "type": "function", + "description": "Gets the background color of the browser action badge.", + "async": "callback", + "parameters": [ + { + "name": "details", + "$ref": "Details" + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "$ref": "ColorArray" + } + ] + } + ] + }, + { + "name": "setBadgeTextColor", + "type": "function", + "description": "Sets the text color for the badge.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "$import": "Details", + "properties": { + "color": { "$ref": "ColorValue" } + } + } + ] + }, + { + "name": "getBadgeTextColor", + "type": "function", + "description": "Gets the text color of the browser action badge.", + "async": true, + "parameters": [ + { + "name": "details", + "$ref": "Details" + } + ] + }, + { + "name": "enable", + "type": "function", + "description": "Enables the browser action for a tab. By default, browser actions are enabled.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "optional": true, + "name": "tabId", + "minimum": 0, + "description": "The id of the tab for which you want to modify the browser action." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "disable", + "type": "function", + "description": "Disables the browser action for a tab.", + "async": "callback", + "parameters": [ + { + "type": "integer", + "optional": true, + "name": "tabId", + "minimum": 0, + "description": "The id of the tab for which you want to modify the browser action." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "isEnabled", + "type": "function", + "description": "Checks whether the browser action is enabled.", + "async": true, + "parameters": [ + { + "name": "details", + "$ref": "Details" + } + ] + }, + { + "name": "openPopup", + "type": "function", + "description": "Opens the extension popup window in the specified window.", + "async": true, + "parameters": [ + { + "name": "options", + "optional": true, + "type": "object", + "description": "An object with information about the popup to open.", + "properties": { + "windowId": { + "type": "integer", + "minimum": -2, + "optional": true, + "description": "Defaults to the $(topic:current-window)[current window]." + } + } + } + ] + } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "description": "Fired when a browser action icon is clicked. This event will not fire if the browser action has a popup.", + "parameters": [ + { + "name": "tab", + "$ref": "tabs.Tab" + }, + { + "name": "info", + "$ref": "OnClickData", + "optional": true + } + ] + } + ] + }, + { + "namespace": "browserAction", + "permissions": ["manifest:action", "manifest:browser_action"], + "max_manifest_version": 2, + "$import": "action" + } +] diff --git a/toolkit/components/extensions/schemas/browser_settings.json b/toolkit/components/extensions/schemas/browser_settings.json new file mode 100644 index 0000000000..051d8c73b5 --- /dev/null +++ b/toolkit/components/extensions/schemas/browser_settings.json @@ -0,0 +1,139 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["browserSettings"] + } + ] + } + ] + }, + { + "namespace": "browserSettings", + "description": "Use the <code>browser.browserSettings</code> API to control global settings of the browser.", + "permissions": ["browserSettings"], + "types": [ + { + "id": "ImageAnimationBehavior", + "type": "string", + "enum": ["normal", "none", "once"], + "description": "How images should be animated in the browser." + }, + { + "id": "ContextMenuMouseEvent", + "type": "string", + "enum": ["mouseup", "mousedown"], + "description": "After which mouse event context menus should popup." + }, + { + "id": "ColorManagementMode", + "type": "string", + "enum": ["off", "full", "tagged_only"], + "description": "Color management mode." + } + ], + "properties": { + "allowPopupsForUserEvents": { + "$ref": "types.Setting", + "description": "Allows or disallows pop-up windows from opening in response to user events." + }, + "cacheEnabled": { + "$ref": "types.Setting", + "description": "Enables or disables the browser cache." + }, + "closeTabsByDoubleClick": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether the selected tab can be closed with a double click." + }, + "contextMenuShowEvent": { + "$ref": "types.Setting", + "description": "Controls after which mouse event context menus popup. This setting's value is of type ContextMenuMouseEvent, which has possible values of <code>mouseup</code> and <code>mousedown</code>." + }, + "ftpProtocolEnabled": { + "$ref": "types.Setting", + "description": "Returns whether the FTP protocol is enabled. Read-only.", + "deprecated": "FTP support was removed from Firefox in bug 1574475" + }, + "homepageOverride": { + "$ref": "types.Setting", + "description": "Returns the value of the overridden home page. Read-only." + }, + "imageAnimationBehavior": { + "$ref": "types.Setting", + "description": "Controls the behaviour of image animation in the browser. This setting's value is of type ImageAnimationBehavior, defaulting to <code>normal</code>." + }, + "newTabPageOverride": { + "$ref": "types.Setting", + "description": "Returns the value of the overridden new tab page. Read-only." + }, + "newTabPosition": { + "$ref": "types.Setting", + "description": "Controls where new tabs are opened. `afterCurrent` will open all new tabs next to the current tab, `relatedAfterCurrent` will open only related tabs next to the current tab, and `atEnd` will open all tabs at the end of the tab strip. The default is `relatedAfterCurrent`." + }, + "openBookmarksInNewTabs": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether bookmarks are opened in the current tab or in a new tab." + }, + "openSearchResultsInNewTabs": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether search results are opened in the current tab or in a new tab." + }, + "openUrlbarResultsInNewTabs": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether urlbar results are opened in the current tab or in a new tab." + }, + "webNotificationsDisabled": { + "$ref": "types.Setting", + "description": "Disables webAPI notifications." + }, + "overrideDocumentColors": { + "$ref": "types.Setting", + "description": "This setting controls whether the user-chosen colors override the page's colors." + }, + "overrideContentColorScheme": { + "$ref": "types.Setting", + "description": "This setting controls whether a light or dark color scheme overrides the page's preferred color scheme." + }, + "useDocumentFonts": { + "$ref": "types.Setting", + "description": "This setting controls whether the document's fonts are used." + }, + "zoomFullPage": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether zoom is applied to the full page or to text only." + }, + "zoomSiteSpecific": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether zoom is applied on a per-site basis or to the current tab only. If privacy.resistFingerprinting is true, this setting has no effect and zoom is applied to the current tab only." + } + } + }, + { + "namespace": "browserSettings.colorManagement", + "description": "Use the <code>browserSettings.colorManagement</code> API to query and set items related to color management.", + "permissions": ["browserSettings"], + "properties": { + "mode": { + "$ref": "types.Setting", + "description": "This setting controls the mode used for color management and must be a string from $(ref:browserSettings.ColorManagementMode)" + }, + "useNativeSRGB": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether or not native sRGB color management is used." + }, + "useWebRenderCompositor": { + "$ref": "types.Setting", + "description": "This boolean setting controls whether or not the WebRender compositor is used." + } + } + } +] diff --git a/toolkit/components/extensions/schemas/browsing_data.json b/toolkit/components/extensions/schemas/browsing_data.json new file mode 100644 index 0000000000..b9202e2558 --- /dev/null +++ b/toolkit/components/extensions/schemas/browsing_data.json @@ -0,0 +1,423 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["browsingData"] + } + ] + } + ] + }, + { + "namespace": "browsingData", + "description": "Use the <code>chrome.browsingData</code> API to remove browsing data from a user's local profile.", + "permissions": ["browsingData"], + "types": [ + { + "id": "RemovalOptions", + "type": "object", + "description": "Options that determine exactly what data will be removed.", + "properties": { + "since": { + "$ref": "extensionTypes.Date", + "optional": true, + "description": "Remove data accumulated on or after this date, represented in milliseconds since the epoch (accessible via the <code>getTime</code> method of the JavaScript <code>Date</code> object). If absent, defaults to 0 (which would remove all browsing data)." + }, + "hostnames": { + "type": "array", + "items": { "type": "string", "format": "hostname" }, + "optional": true, + "description": "Only remove data associated with these hostnames (only applies to cookies and localStorage)." + }, + "cookieStoreId": { + "type": "string", + "description": "Only remove data associated with this specific cookieStoreId.", + "optional": true + }, + "originTypes": { + "type": "object", + "optional": true, + "description": "An object whose properties specify which origin types ought to be cleared. If this object isn't specified, it defaults to clearing only \"unprotected\" origins. Please ensure that you <em>really</em> want to remove application data before adding 'protectedWeb' or 'extensions'.", + "properties": { + "unprotectedWeb": { + "type": "boolean", + "optional": true, + "description": "Normal websites." + }, + "protectedWeb": { + "type": "boolean", + "optional": true, + "description": "Websites that have been installed as hosted applications (be careful!)." + }, + "extension": { + "type": "boolean", + "optional": true, + "description": "Extensions and packaged applications a user has installed (be _really_ careful!)." + } + } + } + } + }, + { + "id": "DataTypeSet", + "type": "object", + "description": "A set of data types. Missing data types are interpreted as <code>false</code>.", + "properties": { + "cache": { + "type": "boolean", + "optional": true, + "description": "The browser's cache. Note: when removing data, this clears the <em>entire</em> cache: it is not limited to the range you specify." + }, + "cookies": { + "type": "boolean", + "optional": true, + "description": "The browser's cookies." + }, + "downloads": { + "type": "boolean", + "optional": true, + "description": "The browser's download list." + }, + "formData": { + "type": "boolean", + "optional": true, + "description": "The browser's stored form data." + }, + "history": { + "type": "boolean", + "optional": true, + "description": "The browser's history." + }, + "indexedDB": { + "type": "boolean", + "optional": true, + "description": "Websites' IndexedDB data." + }, + "localStorage": { + "type": "boolean", + "optional": true, + "description": "Websites' local storage data." + }, + "serverBoundCertificates": { + "type": "boolean", + "optional": true, + "description": "Server-bound certificates." + }, + "passwords": { + "type": "boolean", + "optional": true, + "description": "Stored passwords." + }, + "pluginData": { + "type": "boolean", + "optional": true, + "description": "Plugins' data." + }, + "serviceWorkers": { + "type": "boolean", + "optional": true, + "description": "Service Workers." + } + } + } + ], + "functions": [ + { + "name": "settings", + "description": "Reports which types of data are currently selected in the 'Clear browsing data' settings UI. Note: some of the data types included in this API are not available in the settings UI, and some UI settings control more than one data type listed here.", + "type": "function", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "result", + "type": "object", + "properties": { + "options": { + "$ref": "RemovalOptions" + }, + "dataToRemove": { + "$ref": "DataTypeSet", + "description": "All of the types will be present in the result, with values of <code>true</code> if they are both selected to be removed and permitted to be removed, otherwise <code>false</code>." + }, + "dataRemovalPermitted": { + "$ref": "DataTypeSet", + "description": "All of the types will be present in the result, with values of <code>true</code> if they are permitted to be removed (e.g., by enterprise policy) and <code>false</code> if not." + } + } + } + ] + } + ] + }, + { + "name": "remove", + "description": "Clears various types of browsing data stored in a user's profile.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "dataToRemove", + "$ref": "DataTypeSet", + "description": "The set of data types to remove." + }, + { + "name": "callback", + "type": "function", + "description": "Called when deletion has completed.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeAppcache", + "description": "Clears websites' appcache data.", + "type": "function", + "async": "callback", + "unsupported": true, + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when websites' appcache data has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeCache", + "description": "Clears the browser's cache.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when the browser's cache has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeCookies", + "description": "Clears the browser's cookies and server-bound certificates modified within a particular timeframe.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when the browser's cookies and server-bound certificates have been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeDownloads", + "description": "Clears the browser's list of downloaded files (<em>not</em> the downloaded files themselves).", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when the browser's list of downloaded files has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeFileSystems", + "description": "Clears websites' file system data.", + "type": "function", + "async": "callback", + "unsupported": true, + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when websites' file systems have been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeFormData", + "description": "Clears the browser's stored form data (autofill).", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when the browser's form data has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeHistory", + "description": "Clears the browser's history.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when the browser's history has cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeIndexedDB", + "description": "Clears websites' IndexedDB data.", + "type": "function", + "async": "callback", + "unsupported": true, + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when websites' IndexedDB data has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeLocalStorage", + "description": "Clears websites' local storage data.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when websites' local storage has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removePluginData", + "description": "Clears plugins' data.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when plugins' data has been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removePasswords", + "description": "Clears the browser's stored passwords.", + "type": "function", + "async": "callback", + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when the browser's passwords have been cleared.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "removeWebSQL", + "description": "Clears websites' WebSQL data.", + "type": "function", + "async": "callback", + "unsupported": true, + "parameters": [ + { + "$ref": "RemovalOptions", + "name": "options" + }, + { + "name": "callback", + "type": "function", + "description": "Called when websites' WebSQL databases have been cleared.", + "optional": true, + "parameters": [] + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/captive_portal.json b/toolkit/components/extensions/schemas/captive_portal.json new file mode 100644 index 0000000000..fd697c66ae --- /dev/null +++ b/toolkit/components/extensions/schemas/captive_portal.json @@ -0,0 +1,80 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["captivePortal"] + } + ] + } + ] + }, + { + "namespace": "captivePortal", + "description": "This API provides the ability detect the captive portal state of the users connection.", + "permissions": ["captivePortal"], + "properties": { + "canonicalURL": { + "$ref": "types.Setting", + "description": "Return the canonical captive-portal detection URL. Read-only." + } + }, + "functions": [ + { + "name": "getState", + "type": "function", + "description": "Returns the current portal state, one of `unknown`, `not_captive`, `unlocked_portal`, `locked_portal`.", + "async": true, + "parameters": [] + }, + { + "name": "getLastChecked", + "type": "function", + "description": "Returns the time difference between NOW and the last time a request was completed in milliseconds.", + "async": true, + "parameters": [] + } + ], + "events": [ + { + "name": "onStateChanged", + "type": "function", + "description": "Fired when the captive portal state changes.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "state": { + "type": "string", + "enum": [ + "unknown", + "not_captive", + "unlocked_portal", + "locked_portal" + ], + "description": "The current captive portal state." + } + } + } + ] + }, + { + "name": "onConnectivityAvailable", + "type": "function", + "description": "This notification will be emitted when the captive portal service has determined that we can connect to the internet. The service will pass either `captive` if there is an unlocked captive portal present, or `clear` if no captive portal was detected.", + "parameters": [ + { + "name": "status", + "enum": ["captive", "clear"], + "type": "string" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/clipboard.json b/toolkit/components/extensions/schemas/clipboard.json new file mode 100644 index 0000000000..010a003c4c --- /dev/null +++ b/toolkit/components/extensions/schemas/clipboard.json @@ -0,0 +1,30 @@ +[ + { + "namespace": "clipboard", + "description": "Offers the ability to write to the clipboard. Reading is not supported because the clipboard can already be read through the standard web platform APIs.", + "permissions": ["clipboardWrite"], + "functions": [ + { + "name": "setImageData", + "type": "function", + "description": "Copy an image to the clipboard. The image is re-encoded before it is written to the clipboard. If the image is invalid, the clipboard is not modified.", + "async": true, + "parameters": [ + { + "type": "object", + "isInstanceOf": "ArrayBuffer", + "additionalProperties": true, + "name": "imageData", + "description": "The image data to be copied." + }, + { + "type": "string", + "name": "imageType", + "enum": ["jpeg", "png"], + "description": "The type of imageData." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/content_scripts.json b/toolkit/components/extensions/schemas/content_scripts.json new file mode 100644 index 0000000000..5dd390c2ad --- /dev/null +++ b/toolkit/components/extensions/schemas/content_scripts.json @@ -0,0 +1,110 @@ +/* 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/. */ + +[ + { + "namespace": "contentScripts", + "max_manifest_version": 2, + "types": [ + { + "id": "RegisteredContentScriptOptions", + "type": "object", + "description": "Details of a content script registered programmatically", + "properties": { + "matches": { + "type": "array", + "optional": false, + "minItems": 1, + "items": { "$ref": "manifest.MatchPattern" } + }, + "excludeMatches": { + "type": "array", + "optional": true, + "minItems": 1, + "items": { "$ref": "manifest.MatchPattern" } + }, + "includeGlobs": { + "type": "array", + "optional": true, + "items": { "type": "string" } + }, + "excludeGlobs": { + "type": "array", + "optional": true, + "items": { "type": "string" } + }, + "css": { + "type": "array", + "optional": true, + "description": "The list of CSS files to inject", + "items": { "$ref": "extensionTypes.ExtensionFileOrCode" } + }, + "js": { + "type": "array", + "optional": true, + "description": "The list of JS files to inject", + "items": { "$ref": "extensionTypes.ExtensionFileOrCode" } + }, + "allFrames": { + "type": "boolean", + "optional": true, + "description": "If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame." + }, + "matchAboutBlank": { + "type": "boolean", + "optional": true, + "description": "If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>." + }, + "runAt": { + "$ref": "extensionTypes.RunAt", + "optional": true, + "description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"." + }, + "cookieStoreId": { + "choices": [ + { + "type": "array", + "minItems": 1, + "items": { "type": "string" } + }, + { + "type": "string" + } + ], + "optional": true, + "description": "limit the set of matched tabs to those that belong to the given cookie store id" + } + } + }, + { + "id": "RegisteredContentScript", + "type": "object", + "description": "An object that represents a content script registered programmatically", + "functions": [ + { + "name": "unregister", + "type": "function", + "description": "Unregister a content script registered programmatically", + "async": true, + "parameters": [] + } + ] + } + ], + "functions": [ + { + "name": "register", + "type": "function", + "description": "Register a content script programmatically", + "async": true, + "parameters": [ + { + "name": "contentScriptOptions", + "$ref": "RegisteredContentScriptOptions" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/contextual_identities.json b/toolkit/components/extensions/schemas/contextual_identities.json new file mode 100644 index 0000000000..1621e99a15 --- /dev/null +++ b/toolkit/components/extensions/schemas/contextual_identities.json @@ -0,0 +1,224 @@ +/* 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/. */ + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["contextualIdentities"] + } + ] + } + ] + }, + { + "namespace": "contextualIdentities", + "description": "Use the <code>browser.contextualIdentities</code> API to query and modify contextual identity, also called as containers.", + "permissions": ["contextualIdentities"], + "types": [ + { + "id": "ContextualIdentity", + "type": "object", + "description": "Represents information about a contextual identity.", + "properties": { + "name": { + "type": "string", + "description": "The name of the contextual identity." + }, + "icon": { + "type": "string", + "description": "The icon name of the contextual identity." + }, + "iconUrl": { + "type": "string", + "description": "The icon url of the contextual identity." + }, + "color": { + "type": "string", + "description": "The color name of the contextual identity." + }, + "colorCode": { + "type": "string", + "description": "The color hash of the contextual identity." + }, + "cookieStoreId": { + "type": "string", + "description": "The cookie store ID of the contextual identity." + } + } + } + ], + "functions": [ + { + "name": "get", + "type": "function", + "description": "Retrieves information about a single contextual identity.", + "async": true, + "parameters": [ + { + "type": "string", + "name": "cookieStoreId", + "description": "The ID of the contextual identity cookie store. " + } + ] + }, + { + "name": "query", + "type": "function", + "description": "Retrieves all contextual identities", + "async": true, + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Information to filter the contextual identities being retrieved.", + "properties": { + "name": { + "type": "string", + "optional": true, + "description": "Filters the contextual identity by name." + } + } + } + ] + }, + { + "name": "create", + "type": "function", + "description": "Creates a contextual identity with the given data.", + "async": true, + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Details about the contextual identity being created.", + "properties": { + "name": { + "type": "string", + "optional": false, + "description": "The name of the contextual identity." + }, + "color": { + "type": "string", + "optional": false, + "description": "The color of the contextual identity." + }, + "icon": { + "type": "string", + "optional": false, + "description": "The icon of the contextual identity." + } + } + } + ] + }, + { + "name": "update", + "type": "function", + "description": "Updates a contextual identity with the given data.", + "async": true, + "parameters": [ + { + "type": "string", + "name": "cookieStoreId", + "description": "The ID of the contextual identity cookie store. " + }, + { + "type": "object", + "name": "details", + "description": "Details about the contextual identity being created.", + "properties": { + "name": { + "type": "string", + "optional": true, + "description": "The name of the contextual identity." + }, + "color": { + "type": "string", + "optional": true, + "description": "The color of the contextual identity." + }, + "icon": { + "type": "string", + "optional": true, + "description": "The icon of the contextual identity." + } + } + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Deletes a contetual identity by its cookie Store ID.", + "async": true, + "parameters": [ + { + "type": "string", + "name": "cookieStoreId", + "description": "The ID of the contextual identity cookie store. " + } + ] + } + ], + "events": [ + { + "name": "onUpdated", + "type": "function", + "description": "Fired when a container is updated.", + "parameters": [ + { + "type": "object", + "name": "changeInfo", + "properties": { + "contextualIdentity": { + "$ref": "ContextualIdentity", + "description": "Contextual identity that has been updated" + } + } + } + ] + }, + { + "name": "onCreated", + "type": "function", + "description": "Fired when a new container is created.", + "parameters": [ + { + "type": "object", + "name": "changeInfo", + "properties": { + "contextualIdentity": { + "$ref": "ContextualIdentity", + "description": "Contextual identity that has been created" + } + } + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when a container is removed.", + "parameters": [ + { + "type": "object", + "name": "changeInfo", + "properties": { + "contextualIdentity": { + "$ref": "ContextualIdentity", + "description": "Contextual identity that has been removed" + } + } + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/cookies.json b/toolkit/components/extensions/schemas/cookies.json new file mode 100644 index 0000000000..b1c6b02a45 --- /dev/null +++ b/toolkit/components/extensions/schemas/cookies.json @@ -0,0 +1,471 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["cookies"] + } + ] + } + ] + }, + { + "namespace": "cookies", + "description": "Use the <code>browser.cookies</code> API to query and modify cookies, and to be notified when they change.", + "permissions": ["cookies"], + "types": [ + { + "id": "SameSiteStatus", + "type": "string", + "enum": ["no_restriction", "lax", "strict"], + "description": "A cookie's 'SameSite' state (https://tools.ietf.org/html/draft-west-first-party-cookies). 'no_restriction' corresponds to a cookie set without a 'SameSite' attribute, 'lax' to 'SameSite=Lax', and 'strict' to 'SameSite=Strict'." + }, + { + "id": "PartitionKey", + "type": "object", + "description": "The description of the storage partition of a cookie. This object may be omitted (null) if a cookie is not partitioned.", + "properties": { + "topLevelSite": { + "type": "string", + "optional": true, + "description": "The first-party URL of the cookie, if the cookie is in storage partitioned by the top-level site." + } + } + }, + { + "id": "Cookie", + "type": "object", + "description": "Represents information about an HTTP cookie.", + "properties": { + "name": { + "type": "string", + "description": "The name of the cookie." + }, + "value": { + "type": "string", + "description": "The value of the cookie." + }, + "domain": { + "type": "string", + "description": "The domain of the cookie (e.g. \"www.google.com\", \"example.com\")." + }, + "hostOnly": { + "type": "boolean", + "description": "True if the cookie is a host-only cookie (i.e. a request's host must exactly match the domain of the cookie)." + }, + "path": { + "type": "string", + "description": "The path of the cookie." + }, + "secure": { + "type": "boolean", + "description": "True if the cookie is marked as Secure (i.e. its scope is limited to secure channels, typically HTTPS)." + }, + "httpOnly": { + "type": "boolean", + "description": "True if the cookie is marked as HttpOnly (i.e. the cookie is inaccessible to client-side scripts)." + }, + "sameSite": { + "$ref": "SameSiteStatus", + "description": "The cookie's same-site status (i.e. whether the cookie is sent with cross-site requests)." + }, + "session": { + "type": "boolean", + "description": "True if the cookie is a session cookie, as opposed to a persistent cookie with an expiration date." + }, + "expirationDate": { + "type": "number", + "optional": true, + "description": "The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies." + }, + "storeId": { + "type": "string", + "description": "The ID of the cookie store containing this cookie, as provided in getAllCookieStores()." + }, + "firstPartyDomain": { + "type": "string", + "description": "The first-party domain of the cookie." + }, + "partitionKey": { + "$ref": "PartitionKey", + "optional": true, + "description": "The cookie's storage partition, if any. null if not partitioned." + } + } + }, + { + "id": "CookieStore", + "type": "object", + "description": "Represents a cookie store in the browser. An incognito mode window, for instance, uses a separate cookie store from a non-incognito window.", + "properties": { + "id": { + "type": "string", + "description": "The unique identifier for the cookie store." + }, + "tabIds": { + "type": "array", + "items": { "type": "integer" }, + "description": "Identifiers of all the browser tabs that share this cookie store." + }, + "incognito": { + "type": "boolean", + "description": "Indicates if this is an incognito cookie store" + } + } + }, + { + "id": "OnChangedCause", + "type": "string", + "enum": [ + "evicted", + "expired", + "explicit", + "expired_overwrite", + "overwrite" + ], + "description": "The underlying reason behind the cookie's change. If a cookie was inserted, or removed via an explicit call to $(ref:cookies.remove), \"cause\" will be \"explicit\". If a cookie was automatically removed due to expiry, \"cause\" will be \"expired\". If a cookie was removed due to being overwritten with an already-expired expiration date, \"cause\" will be set to \"expired_overwrite\". If a cookie was automatically removed due to garbage collection, \"cause\" will be \"evicted\". If a cookie was automatically removed due to a \"set\" call that overwrote it, \"cause\" will be \"overwrite\". Plan your response accordingly." + } + ], + "functions": [ + { + "name": "get", + "type": "function", + "description": "Retrieves information about a single cookie. If more than one cookie of the same name exists for the given URL, the one with the longest path will be returned. For cookies with the same path length, the cookie with the earliest creation time will be returned.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Details to identify the cookie being retrieved.", + "properties": { + "url": { + "type": "string", + "description": "The URL with which the cookie to retrieve is associated. This argument may be a full URL, in which case any data following the URL path (e.g. the query string) is simply ignored. If host permissions for this URL are not specified in the manifest file, the API call will fail." + }, + "name": { + "type": "string", + "description": "The name of the cookie to retrieve." + }, + "storeId": { + "type": "string", + "optional": true, + "description": "The ID of the cookie store in which to look for the cookie. By default, the current execution context's cookie store will be used." + }, + "firstPartyDomain": { + "type": "string", + "optional": true, + "description": "The first-party domain which the cookie to retrieve is associated. This attribute is required if First-Party Isolation is enabled." + }, + "partitionKey": { + "$ref": "PartitionKey", + "optional": true, + "description": "The storage partition, if the cookie is part of partitioned storage. By default, only non-partitioned cookies are returned." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "cookie", + "$ref": "Cookie", + "optional": true, + "description": "Contains details about the cookie. This parameter is null if no such cookie was found." + } + ] + } + ] + }, + { + "name": "getAll", + "type": "function", + "description": "Retrieves all cookies from a single cookie store that match the given information. The cookies returned will be sorted, with those with the longest path first. If multiple cookies have the same path length, those with the earliest creation time will be first.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Information to filter the cookies being retrieved.", + "properties": { + "url": { + "type": "string", + "optional": true, + "description": "Restricts the retrieved cookies to those that would match the given URL." + }, + "name": { + "type": "string", + "optional": true, + "description": "Filters the cookies by name." + }, + "domain": { + "type": "string", + "optional": true, + "description": "Restricts the retrieved cookies to those whose domains match or are subdomains of this one." + }, + "path": { + "type": "string", + "optional": true, + "description": "Restricts the retrieved cookies to those whose path exactly matches this string." + }, + "secure": { + "type": "boolean", + "optional": true, + "description": "Filters the cookies by their Secure property." + }, + "session": { + "type": "boolean", + "optional": true, + "description": "Filters out session vs. persistent cookies." + }, + "storeId": { + "type": "string", + "optional": true, + "description": "The cookie store to retrieve cookies from. If omitted, the current execution context's cookie store will be used." + }, + "firstPartyDomain": { + "type": "string", + "optional": "omit-key-if-missing", + "description": "Restricts the retrieved cookies to those whose first-party domains match this one. This attribute is required if First-Party Isolation is enabled. To not filter by a specific first-party domain, use `null` or `undefined`." + }, + "partitionKey": { + "$ref": "PartitionKey", + "optional": true, + "description": "Selects a specific storage partition to look up cookies. Defaults to null, in which case only non-partitioned cookies are retrieved. If an object iis passed, partitioned cookies are also included, and filtered based on the keys present in the given PartitionKey description. An empty object ({}) returns all cookies (partitioned + unpartitioned), a non-empty object (e.g. {topLevelSite: '...'}) only returns cookies whose partition match all given attributes." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "cookies", + "type": "array", + "items": { "$ref": "Cookie" }, + "description": "All the existing, unexpired cookies that match the given cookie info." + } + ] + } + ] + }, + { + "name": "set", + "type": "function", + "description": "Sets a cookie with the given cookie data; may overwrite equivalent cookies if they exist.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Details about the cookie being set.", + "properties": { + "url": { + "type": "string", + "description": "The request-URI to associate with the setting of the cookie. This value can affect the default domain and path values of the created cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail." + }, + "name": { + "type": "string", + "optional": true, + "description": "The name of the cookie. Empty by default if omitted." + }, + "value": { + "type": "string", + "optional": true, + "description": "The value of the cookie. Empty by default if omitted." + }, + "domain": { + "type": "string", + "optional": true, + "description": "The domain of the cookie. If omitted, the cookie becomes a host-only cookie." + }, + "path": { + "type": "string", + "optional": true, + "description": "The path of the cookie. Defaults to the path portion of the url parameter." + }, + "secure": { + "type": "boolean", + "optional": true, + "description": "Whether the cookie should be marked as Secure. Defaults to false." + }, + "httpOnly": { + "type": "boolean", + "optional": true, + "description": "Whether the cookie should be marked as HttpOnly. Defaults to false." + }, + "sameSite": { + "$ref": "SameSiteStatus", + "optional": true, + "description": "The cookie's same-site status.", + "default": "no_restriction" + }, + "expirationDate": { + "type": "number", + "optional": true, + "description": "The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted, the cookie becomes a session cookie." + }, + "storeId": { + "type": "string", + "optional": true, + "description": "The ID of the cookie store in which to set the cookie. By default, the cookie is set in the current execution context's cookie store." + }, + "firstPartyDomain": { + "type": "string", + "optional": true, + "description": "The first-party domain of the cookie. This attribute is required if First-Party Isolation is enabled." + }, + "partitionKey": { + "$ref": "PartitionKey", + "optional": true, + "description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "cookie", + "$ref": "Cookie", + "optional": true, + "description": "Contains details about the cookie that's been set. If setting failed for any reason, this will be \"null\", and $(ref:runtime.lastError) will be set." + } + ] + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Deletes a cookie by name.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Information to identify the cookie to remove.", + "properties": { + "url": { + "type": "string", + "description": "The URL associated with the cookie. If host permissions for this URL are not specified in the manifest file, the API call will fail." + }, + "name": { + "type": "string", + "description": "The name of the cookie to remove." + }, + "storeId": { + "type": "string", + "optional": true, + "description": "The ID of the cookie store to look in for the cookie. If unspecified, the cookie is looked for by default in the current execution context's cookie store." + }, + "firstPartyDomain": { + "type": "string", + "optional": true, + "description": "The first-party domain associated with the cookie. This attribute is required if First-Party Isolation is enabled." + }, + "partitionKey": { + "$ref": "PartitionKey", + "optional": true, + "description": "The storage partition, if the cookie is part of partitioned storage. By default, non-partitioned storage is used." + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "details", + "type": "object", + "description": "Contains details about the cookie that's been removed. If removal failed for any reason, this will be \"null\", and $(ref:runtime.lastError) will be set.", + "optional": true, + "properties": { + "url": { + "type": "string", + "description": "The URL associated with the cookie that's been removed." + }, + "name": { + "type": "string", + "description": "The name of the cookie that's been removed." + }, + "storeId": { + "type": "string", + "description": "The ID of the cookie store from which the cookie was removed." + }, + "firstPartyDomain": { + "type": "string", + "description": "The first-party domain associated with the cookie that's been removed." + }, + "partitionKey": { + "$ref": "PartitionKey", + "optional": true, + "description": "The storage partition, if the cookie is part of partitioned storage. null if not partitioned." + } + } + } + ] + } + ] + }, + { + "name": "getAllCookieStores", + "type": "function", + "description": "Lists all existing cookie stores.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "cookieStores", + "type": "array", + "items": { "$ref": "CookieStore" }, + "description": "All the existing cookie stores." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "type": "function", + "description": "Fired when a cookie is set or removed. As a special case, note that updating a cookie's properties is implemented as a two step process: the cookie to be updated is first removed entirely, generating a notification with \"cause\" of \"overwrite\" . Afterwards, a new cookie is written with the updated values, generating a second notification with \"cause\" \"explicit\".", + "parameters": [ + { + "type": "object", + "name": "changeInfo", + "properties": { + "removed": { + "type": "boolean", + "description": "True if a cookie was removed." + }, + "cookie": { + "$ref": "Cookie", + "description": "Information about the cookie that was set or removed." + }, + "cause": { + "$ref": "OnChangedCause", + "description": "The underlying reason behind the cookie's change." + } + } + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/declarative_net_request.json b/toolkit/components/extensions/schemas/declarative_net_request.json new file mode 100644 index 0000000000..aee2cdcfda --- /dev/null +++ b/toolkit/components/extensions/schemas/declarative_net_request.json @@ -0,0 +1,789 @@ +/* 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/. */ + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [ + { + "type": "string", + "enum": ["declarativeNetRequest"] + } + ] + }, + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["declarativeNetRequestFeedback"] + } + ] + }, + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["declarativeNetRequestWithHostAccess"] + } + ] + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "declarative_net_request": { + "type": "object", + "optional": true, + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "rule_resources": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "id": { + "type": "string", + "pattern": "^[^_]", + "description": "A non-empty string uniquely identifying the ruleset. IDs beginning with '_' are reserved for internal use." + }, + "enabled": { + "type": "boolean", + "description": "Whether the ruleset is enabled by default." + }, + "path": { + "$ref": "manifest.ExtensionURL", + "description": "The path of the JSON ruleset relative to the extension directory." + } + } + } + } + } + } + } + } + ] + }, + { + "namespace": "declarativeNetRequest", + "description": "Use the declarativeNetRequest API to block or modify network requests by specifying declarative rules.", + "permissions": [ + "declarativeNetRequest", + "declarativeNetRequestWithHostAccess" + ], + "types": [ + { + "id": "ResourceType", + "type": "string", + "description": "How the requested resource will be used. Comparable to the webRequest.ResourceType type.", + "enum": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "object", + "object_subrequest", + "xmlhttprequest", + "xslt", + "ping", + "beacon", + "xml_dtd", + "font", + "media", + "websocket", + "csp_report", + "imageset", + "web_manifest", + "speculative", + "other" + ] + }, + { + "id": "UnsupportedRegexReason", + "type": "string", + "description": "Describes the reason why a given regular expression isn't supported.", + "enum": ["syntaxError", "memoryLimitExceeded"] + }, + { + "id": "MatchedRule", + "type": "object", + "properties": { + "ruleId": { + "type": "integer", + "description": "A matching rule's ID." + }, + "rulesetId": { + "type": "string", + "description": "ID of the Ruleset this rule belongs to." + }, + "extensionId": { + "type": "string", + "description": "ID of the extension, if this rule belongs to a different extension.", + "optional": true + } + } + }, + { + "id": "URLTransform", + "type": "object", + "description": "Describes the type of the Rule.action.redirect.transform property.", + "properties": { + "scheme": { + "type": "string", + "optional": true, + "description": "The new scheme for the request.", + "enum": ["http", "https", "moz-extension"] + }, + "username": { + "type": "string", + "optional": true, + "description": "The new username for the request." + }, + "password": { + "type": "string", + "optional": true, + "description": "The new password for the request." + }, + "host": { + "type": "string", + "optional": true, + "description": "The new host name for the request." + }, + "port": { + "type": "string", + "optional": true, + "description": "The new port for the request. If empty, the existing port is cleared." + }, + "path": { + "type": "string", + "optional": true, + "description": "The new path for the request. If empty, the existing path is cleared." + }, + "query": { + "type": "string", + "optional": true, + "description": "The new query for the request. Should be either empty, in which case the existing query is cleared; or should begin with '?'. Cannot be specified if 'queryTransform' is specified." + }, + "queryTransform": { + "type": "object", + "optional": true, + "description": "Add, remove or replace query key-value pairs. Cannot be specified if 'query' is specified.", + "properties": { + "removeParams": { + "type": "array", + "optional": true, + "description": "The list of query keys to be removed.", + "items": { + "type": "string" + } + }, + "addOrReplaceParams": { + "type": "array", + "optional": true, + "description": "The list of query key-value pairs to be added or replaced.", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "value": { + "type": "string" + }, + "replaceOnly": { + "type": "boolean", + "optional": true, + "description": "If true, the query key is replaced only if it's already present. Otherwise, the key is also added if it's missing.", + "default": false + } + } + } + } + } + }, + "fragment": { + "type": "string", + "optional": true, + "description": "The new fragment for the request. Should be either empty, in which case the existing fragment is cleared; or should begin with '#'." + } + } + }, + { + "id": "Rule", + "type": "object", + "properties": { + "id": { + "type": "integer", + "description": "An id which uniquely identifies a rule. Mandatory and should be >= 1.", + "minimum": 1 + }, + "priority": { + "type": "integer", + "optional": true, + "description": "Rule priority. Defaults to 1. When specified, should be >= 1", + "minimum": 1, + "default": 1 + }, + "condition": { + "type": "object", + "description": "The condition under which this rule is triggered.", + "properties": { + "urlFilter": { + "type": "string", + "optional": true, + "description": "TODO: link to doc explaining supported pattern. The pattern which is matched against the network request url. Only one of 'urlFilter' or 'regexFilter' can be specified." + }, + "regexFilter": { + "type": "string", + "optional": true, + "description": "Regular expression to match against the network request url. Only one of 'urlFilter' or 'regexFilter' can be specified." + }, + "isUrlFilterCaseSensitive": { + "type": "boolean", + "optional": true, + "description": "Whether 'urlFilter' or 'regexFilter' is case-sensitive." + }, + "initiatorDomains": { + "type": "array", + "optional": true, + "description": "The rule will only match network requests originating from the list of 'initiatorDomains'. If the list is omitted, the rule is applied to requests from all domains.", + "minItems": 1, + "items": { + "type": "string", + "format": "canonicalDomain" + } + }, + "excludedInitiatorDomains": { + "type": "array", + "optional": true, + "description": "The rule will not match network requests originating from the list of 'initiatorDomains'. If the list is empty or omitted, no domains are excluded. This takes precedence over 'initiatorDomains'.", + "items": { + "type": "string", + "format": "canonicalDomain" + } + }, + "requestDomains": { + "type": "array", + "optional": true, + "description": "The rule will only match network requests when the domain matches one from the list of 'requestDomains'. If the list is omitted, the rule is applied to requests from all domains.", + "minItems": 1, + "items": { + "type": "string", + "format": "canonicalDomain" + } + }, + "excludedRequestDomains": { + "type": "array", + "optional": true, + "description": "The rule will not match network requests when the domains matches one from the list of 'excludedRequestDomains'. If the list is empty or omitted, no domains are excluded. This takes precedence over 'requestDomains'.", + "items": { + "type": "string", + "format": "canonicalDomain" + } + }, + "resourceTypes": { + "type": "array", + "optional": true, + "description": "List of resource types which the rule can match. When the rule action is 'allowAllRequests', this must be specified and may only contain 'main_frame' or 'sub_frame'. Cannot be specified if 'excludedResourceTypes' is specified. If neither of them is specified, all resource types except 'main_frame' are matched.", + "minItems": 1, + "items": { + "$ref": "ResourceType" + } + }, + "excludedResourceTypes": { + "type": "array", + "optional": true, + "description": "List of resource types which the rule won't match. Cannot be specified if 'resourceTypes' is specified. If neither of them is specified, all resource types except 'main_frame' are matched.", + "items": { + "$ref": "ResourceType" + } + }, + "requestMethods": { + "type": "array", + "optional": true, + "description": "List of HTTP request methods which the rule can match. Should be a lower-case method such as 'connect', 'delete', 'get', 'head', 'options', 'patch', 'post', 'put'.'", + "minItems": 1, + "items": { + "type": "string" + } + }, + "excludedRequestMethods": { + "type": "array", + "optional": true, + "description": "List of request methods which the rule won't match. Cannot be specified if 'requestMethods' is specified. If neither of them is specified, all request methods are matched.", + "items": { + "type": "string" + } + }, + "domainType": { + "type": "string", + "optional": true, + "description": "Specifies whether the network request is first-party or third-party to the domain from which it originated. If omitted, all requests are matched.", + "enum": ["firstParty", "thirdParty"] + }, + "tabIds": { + "type": "array", + "optional": true, + "description": "List of tabIds which the rule should match. An ID of -1 matches requests which don't originate from a tab. Only supported for session-scoped rules.", + "minItems": 1, + "items": { + "type": "integer" + } + }, + "excludedTabIds": { + "type": "array", + "optional": true, + "description": "List of tabIds which the rule should not match. An ID of -1 excludes requests which don't originate from a tab. Only supported for session-scoped rules.", + "items": { + "type": "integer" + } + } + } + }, + "action": { + "type": "object", + "description": "The action to take if this rule is matched.", + "properties": { + "type": { + "type": "string", + "enum": [ + "block", + "redirect", + "allow", + "upgradeScheme", + "modifyHeaders", + "allowAllRequests" + ] + }, + "redirect": { + "type": "object", + "optional": true, + "description": "Describes how the redirect should be performed. Only valid when type is 'redirect'.", + "properties": { + "extensionPath": { + "type": "string", + "optional": true, + "description": "Path relative to the extension directory. Should start with '/'." + }, + "transform": { + "$ref": "URLTransform", + "optional": true, + "description": "Url transformations to perform." + }, + "url": { + "type": "string", + "format": "url", + "optional": true, + "description": "The redirect url. Redirects to JavaScript urls are not allowed." + }, + "regexSubstitution": { + "type": "string", + "optional": true, + "description": "Substitution pattern for rules which specify a 'regexFilter'. The first match of regexFilter within the url will be replaced with this pattern. Within regexSubstitution, backslash-escaped digits (\\1 to \\9) can be used to insert the corresponding capture groups. \\0 refers to the entire matching text." + } + } + }, + "requestHeaders": { + "type": "array", + "optional": true, + "description": "The request headers to modify for the request. Only valid when type is 'modifyHeaders'.", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "header": { + "type": "string", + "description": "The name of the request header to be modified." + }, + "operation": { + "type": "string", + "description": "The operation to be performed on a header.", + "enum": ["append", "set", "remove"] + }, + "value": { + "type": "string", + "optional": true, + "description": "The new value for the header. Must be specified for the 'append' and 'set' operations." + } + } + } + }, + "responseHeaders": { + "type": "array", + "optional": true, + "description": "The response headers to modify for the request. Only valid when type is 'modifyHeaders'.", + "minItems": 1, + "items": { + "type": "object", + "properties": { + "header": { + "type": "string", + "description": "The name of the response header to be modified." + }, + "operation": { + "type": "string", + "description": "The operation to be performed on a header.", + "enum": ["append", "set", "remove"] + }, + "value": { + "type": "string", + "optional": true, + "description": "The new value for the header. Must be specified for the 'append' and 'set' operations." + } + } + } + } + } + } + } + } + ], + "functions": [ + { + "name": "updateDynamicRules", + "type": "function", + "description": "Modifies the current set of dynamic rules for the extension. The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. These rules are persisted across browser sessions and extension updates.", + "async": "callback", + "parameters": [ + { + "name": "options", + "type": "object", + "properties": { + "removeRuleIds": { + "type": "array", + "optional": true, + "description": "IDs of the rules to remove. Any invalid IDs will be ignored.", + "items": { + "type": "integer" + } + }, + "addRules": { + "type": "array", + "optional": true, + "description": "Rules to add.", + "items": { + "$ref": "Rule" + } + } + } + }, + { + "name": "callback", + "type": "function", + "description": "Called when the dynamic rules have been updated", + "parameters": [] + } + ] + }, + { + "name": "updateSessionRules", + "type": "function", + "description": "Modifies the current set of session scoped rules for the extension. The rules with IDs listed in options.removeRuleIds are first removed, and then the rules given in options.addRules are added. These rules are not persisted across sessions and are backed in memory.", + "async": "callback", + "parameters": [ + { + "name": "options", + "type": "object", + "properties": { + "removeRuleIds": { + "type": "array", + "optional": true, + "description": "IDs of the rules to remove. Any invalid IDs will be ignored.", + "items": { + "type": "integer" + } + }, + "addRules": { + "type": "array", + "optional": true, + "description": "Rules to add.", + "items": { + "$ref": "Rule" + } + } + } + }, + { + "name": "callback", + "type": "function", + "description": "Called when the session rules have been updated", + "parameters": [] + } + ] + }, + { + "name": "getEnabledRulesets", + "type": "function", + "description": "Returns the ids for the current set of enabled static rulesets.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "type": "array", + "name": "rulesetIds", + "items": { "type": "string" } + } + ] + } + ] + }, + { + "name": "updateEnabledRulesets", + "type": "function", + "description": "Returns the ids for the current set of enabled static rulesets.", + "async": "callback", + "parameters": [ + { + "name": "updateRulesetOptions", + "type": "object", + "properties": { + "disableRulesetIds": { + "type": "array", + "items": { "type": "string" }, + "optional": true, + "default": [] + }, + "enableRulesetIds": { + "type": "array", + "items": { "type": "string" }, + "optional": true, + "default": [] + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [] + } + ] + }, + { + "name": "getAvailableStaticRuleCount", + "type": "function", + "description": "Returns the remaining number of static rules an extension can enable", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "count", + "type": "integer" + } + ] + } + ] + }, + { + "name": "getDynamicRules", + "type": "function", + "description": "Returns the current set of dynamic rules for the extension.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "dynamicRules", + "type": "array", + "items": { + "$ref": "Rule" + } + } + ] + } + ] + }, + { + "name": "getSessionRules", + "type": "function", + "description": "Returns the current set of session scoped rules for the extension.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "sessionRules", + "type": "array", + "items": { + "$ref": "Rule" + } + } + ] + } + ] + }, + { + "name": "isRegexSupported", + "type": "function", + "description": "Checks if the given regular expression will be supported as a 'regexFilter' rule condition.", + "async": "callback", + "parameters": [ + { + "name": "regexOptions", + "type": "object", + "properties": { + "regex": { + "type": "string", + "description": "The regular expresson to check." + }, + "isCaseSensitive": { + "type": "boolean", + "optional": true, + "description": "Whether the 'regex' specified is case sensitive.", + "default": false + }, + "requireCapturing": { + "type": "boolean", + "optional": true, + "description": "Whether the 'regex' specified requires capturing. Capturing is only required for redirect rules which specify a 'regexSubstition' action.", + "default": false + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "result", + "type": "object", + "properties": { + "isSupported": { + "type": "boolean", + "description": "Whether the given regex is supported" + }, + "reason": { + "$ref": "UnsupportedRegexReason", + "optional": true, + "description": "Specifies the reason why the regular expression is not supported. Only provided if 'isSupported' is false." + } + } + } + ] + } + ] + }, + { + "name": "testMatchOutcome", + "type": "function", + "description": "Checks if any of the extension's declarativeNetRequest rules would match a hypothetical request.", + "permissions": ["declarativeNetRequestFeedback"], + "async": "callback", + "parameters": [ + { + "name": "request", + "type": "object", + "description": "The details of the request to test.", + "properties": { + "url": { + "type": "string", + "description": "The URL of the hypothetical request." + }, + "initiator": { + "type": "string", + "description": "The initiator URL (if any) for the hypothetical request.", + "optional": true + }, + "method": { + "type": "string", + "description": "Standard HTTP method of the hypothetical request.", + "optional": true, + "default": "get" + }, + "type": { + "$ref": "ResourceType", + "description": "The resource type of the hypothetical request." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the hypothetical request takes place. Does not need to correspond to a real tab ID. Default is -1, meaning that the request isn't related to a tab.", + "optional": true, + "default": -1 + } + } + }, + { + "name": "options", + "type": "object", + "optional": true, + "properties": { + "includeOtherExtensions": { + "type": "boolean", + "description": "Whether to account for rules from other installed extensions during rule evaluation.", + "optional": true + } + } + }, + { + "name": "callback", + "type": "function", + "description": "Called with the details of matched rules.", + "parameters": [ + { + "name": "result", + "type": "object", + "properties": { + "matchedRules": { + "type": "array", + "description": "The rules (if any) that match the hypothetical request.", + "items": { + "$ref": "MatchedRule" + } + } + } + } + ] + } + ] + } + ], + "properties": { + "DYNAMIC_RULESET_ID": { + "type": "string", + "value": "_dynamic", + "description": "Ruleset ID for the dynamic rules added by the extension." + }, + "GUARANTEED_MINIMUM_STATIC_RULES": { + "type": "number", + "description": "The minimum number of static rules guaranteed to an extension across its enabled static rulesets. Any rules above this limit will count towards the global static rule limit." + }, + "MAX_NUMBER_OF_STATIC_RULESETS": { + "type": "number", + "description": "The maximum number of static Rulesets an extension can specify as part of the rule_resources manifest key." + }, + "MAX_NUMBER_OF_ENABLED_STATIC_RULESETS": { + "type": "number", + "description": "The maximum number of static Rulesets an extension can enable at any one time." + }, + "MAX_NUMBER_OF_DYNAMIC_AND_SESSION_RULES": { + "type": "number", + "description": "The maximum number of dynamic and session rules an extension can add. NOTE: in the Firefox we are enforcing this limit to the session and dynamic rules count separately, instead of enforcing it to the rules count for both combined as the Chrome implementation does." + }, + "MAX_NUMBER_OF_REGEX_RULES": { + "type": "number", + "description": "The maximum number of regular expression rules that an extension can add. This limit is evaluated separately for the set of session rules, dynamic rules and those specified in the rule_resources file." + }, + "SESSION_RULESET_ID": { + "type": "string", + "value": "_session", + "description": "Ruleset ID for the session-scoped rules added by the extension." + } + } + } +] diff --git a/toolkit/components/extensions/schemas/dns.json b/toolkit/components/extensions/schemas/dns.json new file mode 100644 index 0000000000..415849c6de --- /dev/null +++ b/toolkit/components/extensions/schemas/dns.json @@ -0,0 +1,82 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["dns"] + } + ] + } + ] + }, + { + "namespace": "dns", + "description": "Asynchronous DNS API", + "permissions": ["dns"], + "types": [ + { + "id": "DNSRecord", + "type": "object", + "description": "An object encapsulating a DNS Record.", + "properties": { + "canonicalName": { + "type": "string", + "optional": true, + "description": "The canonical hostname for this record. this value is empty if the record was not fetched with the 'canonical_name' flag." + }, + "isTRR": { + "type": "string", + "description": "Record retreived with TRR." + }, + "addresses": { + "type": "array", + "items": { "type": "string" } + } + } + }, + { + "id": "ResolveFlags", + "type": "array", + "items": { + "type": "string", + "enum": [ + "allow_name_collisions", + "bypass_cache", + "canonical_name", + "disable_ipv4", + "disable_ipv6", + "disable_trr", + "offline", + "priority_low", + "priority_medium", + "speculate" + ] + } + } + ], + "functions": [ + { + "name": "resolve", + "type": "function", + "description": "Resolves a hostname to a DNS record.", + "async": true, + "parameters": [ + { + "name": "hostname", + "type": "string" + }, + { + "name": "flags", + "optional": true, + "default": [], + "$ref": "ResolveFlags" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/downloads.json b/toolkit/components/extensions/schemas/downloads.json new file mode 100644 index 0000000000..ed3c1002e0 --- /dev/null +++ b/toolkit/components/extensions/schemas/downloads.json @@ -0,0 +1,810 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["downloads", "downloads.open"] + } + ] + } + ] + }, + { + "namespace": "downloads", + "permissions": ["downloads"], + "types": [ + { + "id": "FilenameConflictAction", + "type": "string", + "enum": ["uniquify", "overwrite", "prompt"] + }, + { + "id": "InterruptReason", + "type": "string", + "enum": [ + "FILE_FAILED", + "FILE_ACCESS_DENIED", + "FILE_NO_SPACE", + "FILE_NAME_TOO_LONG", + "FILE_TOO_LARGE", + "FILE_VIRUS_INFECTED", + "FILE_TRANSIENT_ERROR", + "FILE_BLOCKED", + "FILE_SECURITY_CHECK_FAILED", + "FILE_TOO_SHORT", + "NETWORK_FAILED", + "NETWORK_TIMEOUT", + "NETWORK_DISCONNECTED", + "NETWORK_SERVER_DOWN", + "NETWORK_INVALID_REQUEST", + "SERVER_FAILED", + "SERVER_NO_RANGE", + "SERVER_BAD_CONTENT", + "SERVER_UNAUTHORIZED", + "SERVER_CERT_PROBLEM", + "SERVER_FORBIDDEN", + "USER_CANCELED", + "USER_SHUTDOWN", + "CRASH" + ] + }, + { + "id": "DangerType", + "type": "string", + "enum": [ + "file", + "url", + "content", + "uncommon", + "host", + "unwanted", + "safe", + "accepted" + ], + "description": "<dl><dt>file</dt><dd>The download's filename is suspicious.</dd><dt>url</dt><dd>The download's URL is known to be malicious.</dd><dt>content</dt><dd>The downloaded file is known to be malicious.</dd><dt>uncommon</dt><dd>The download's URL is not commonly downloaded and could be dangerous.</dd><dt>safe</dt><dd>The download presents no known danger to the user's computer.</dd></dl>These string constants will never change, however the set of DangerTypes may change." + }, + { + "id": "State", + "type": "string", + "enum": ["in_progress", "interrupted", "complete"], + "description": "<dl><dt>in_progress</dt><dd>The download is currently receiving data from the server.</dd><dt>interrupted</dt><dd>An error broke the connection with the file host.</dd><dt>complete</dt><dd>The download completed successfully.</dd></dl>These string constants will never change, however the set of States may change." + }, + { + "id": "DownloadItem", + "type": "object", + "properties": { + "id": { + "description": "An identifier that is persistent across browser sessions.", + "type": "integer" + }, + "url": { + "description": "Absolute URL.", + "type": "string" + }, + "referrer": { + "type": "string", + "optional": true + }, + "filename": { + "description": "Absolute local path.", + "type": "string" + }, + "incognito": { + "description": "False if this download is recorded in the history, true if it is not recorded.", + "type": "boolean" + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "danger": { + "$ref": "DangerType", + "description": "Indication of whether this download is thought to be safe or known to be suspicious." + }, + "mime": { + "description": "The file's MIME type.", + "type": "string", + "optional": true + }, + "startTime": { + "description": "Number of milliseconds between the unix epoch and when this download began.", + "type": "string" + }, + "endTime": { + "description": "Number of milliseconds between the unix epoch and when this download ended.", + "optional": true, + "type": "string" + }, + "estimatedEndTime": { + "type": "string", + "optional": true + }, + "state": { + "$ref": "State", + "description": "Indicates whether the download is progressing, interrupted, or complete." + }, + "paused": { + "description": "True if the download has stopped reading data from the host, but kept the connection open.", + "type": "boolean" + }, + "canResume": { + "type": "boolean" + }, + "error": { + "description": "Number indicating why a download was interrupted.", + "optional": true, + "$ref": "InterruptReason" + }, + "bytesReceived": { + "description": "Number of bytes received so far from the host, without considering file compression.", + "type": "number" + }, + "totalBytes": { + "description": "Number of bytes in the whole file, without considering file compression, or -1 if unknown.", + "type": "number" + }, + "fileSize": { + "description": "Number of bytes in the whole file post-decompression, or -1 if unknown.", + "type": "number" + }, + "exists": { + "type": "boolean" + }, + "byExtensionId": { + "type": "string", + "optional": true + }, + "byExtensionName": { + "type": "string", + "optional": true + } + } + }, + { + "id": "StringDelta", + "type": "object", + "properties": { + "current": { + "optional": true, + "type": "string" + }, + "previous": { + "optional": true, + "type": "string" + } + } + }, + { + "id": "DoubleDelta", + "type": "object", + "properties": { + "current": { + "optional": true, + "type": "number" + }, + "previous": { + "optional": true, + "type": "number" + } + } + }, + { + "id": "BooleanDelta", + "type": "object", + "properties": { + "current": { + "optional": true, + "type": "boolean" + }, + "previous": { + "optional": true, + "type": "boolean" + } + } + }, + { + "id": "DownloadTime", + "description": "A time specified as a Date object, a number or string representing milliseconds since the epoch, or an ISO 8601 string", + "choices": [ + { + "type": "string", + "pattern": "^[1-9]\\d*$" + }, + { + "$ref": "extensionTypes.Date" + } + ] + }, + { + "id": "DownloadQuery", + "description": "Parameters that combine to specify a predicate that can be used to select a set of downloads. Used for example in search() and erase()", + "type": "object", + "properties": { + "query": { + "description": "This array of search terms limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> or <code>url</code> contain all of the search terms that do not begin with a dash '-' and none of the search terms that do begin with a dash.", + "optional": true, + "type": "array", + "items": { "type": "string" } + }, + "startedBefore": { + "description": "Limits results to downloads that started before the given ms since the epoch.", + "optional": true, + "$ref": "DownloadTime" + }, + "startedAfter": { + "description": "Limits results to downloads that started after the given ms since the epoch.", + "optional": true, + "$ref": "DownloadTime" + }, + "endedBefore": { + "description": "Limits results to downloads that ended before the given ms since the epoch.", + "optional": true, + "$ref": "DownloadTime" + }, + "endedAfter": { + "description": "Limits results to downloads that ended after the given ms since the epoch.", + "optional": true, + "$ref": "DownloadTime" + }, + "totalBytesGreater": { + "description": "Limits results to downloads whose totalBytes is greater than the given integer.", + "optional": true, + "type": "number" + }, + "totalBytesLess": { + "description": "Limits results to downloads whose totalBytes is less than the given integer.", + "optional": true, + "type": "number" + }, + "filenameRegex": { + "description": "Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>filename</code> matches the given regular expression.", + "optional": true, + "type": "string" + }, + "urlRegex": { + "description": "Limits results to <a href='#type-DownloadItem'>DownloadItems</a> whose <code>url</code> matches the given regular expression.", + "optional": true, + "type": "string" + }, + "limit": { + "description": "Setting this integer limits the number of results. Otherwise, all matching <a href='#type-DownloadItem'>DownloadItems</a> will be returned.", + "optional": true, + "type": "integer" + }, + "orderBy": { + "description": "Setting elements of this array to <a href='#type-DownloadItem'>DownloadItem</a> properties in order to sort the search results. For example, setting <code>orderBy='startTime'</code> sorts the <a href='#type-DownloadItem'>DownloadItems</a> by their start time in ascending order. To specify descending order, prefix <code>orderBy</code> with a hyphen: '-startTime'.", + "optional": true, + "type": "array", + "items": { "type": "string" } + }, + "id": { + "type": "integer", + "optional": true + }, + "url": { + "description": "Absolute URL.", + "optional": true, + "type": "string" + }, + "filename": { + "description": "Absolute local path.", + "optional": true, + "type": "string" + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "danger": { + "$ref": "DangerType", + "description": "Indication of whether this download is thought to be safe or known to be suspicious.", + "optional": true + }, + "mime": { + "description": "The file's MIME type.", + "optional": true, + "type": "string" + }, + "startTime": { + "optional": true, + "type": "string" + }, + "endTime": { + "optional": true, + "type": "string" + }, + "state": { + "$ref": "State", + "description": "Indicates whether the download is progressing, interrupted, or complete.", + "optional": true + }, + "paused": { + "description": "True if the download has stopped reading data from the host, but kept the connection open.", + "optional": true, + "type": "boolean" + }, + "error": { + "description": "Why a download was interrupted.", + "optional": true, + "$ref": "InterruptReason" + }, + "bytesReceived": { + "description": "Number of bytes received so far from the host, without considering file compression.", + "optional": true, + "type": "number" + }, + "totalBytes": { + "description": "Number of bytes in the whole file, without considering file compression, or -1 if unknown.", + "optional": true, + "type": "number" + }, + "fileSize": { + "description": "Number of bytes in the whole file post-decompression, or -1 if unknown.", + "optional": true, + "type": "number" + }, + "exists": { + "type": "boolean", + "optional": true + } + } + } + ], + "functions": [ + { + "name": "download", + "type": "function", + "async": "callback", + "description": "Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both <code>filename</code> and <code>saveAs</code> are specified, then the Save As dialog will be displayed, pre-populated with the specified <code>filename</code>. If the download started successfully, <code>callback</code> will be called with the new <a href='#type-DownloadItem'>DownloadItem</a>'s <code>downloadId</code>. If there was an error starting the download, then <code>callback</code> will be called with <code>downloadId=undefined</code> and <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. You must not parse it.", + "parameters": [ + { + "description": "What to download and how.", + "name": "options", + "type": "object", + "properties": { + "url": { + "description": "The URL to download.", + "type": "string", + "format": "url" + }, + "filename": { + "description": "A file path relative to the Downloads directory to contain the downloaded file.", + "optional": true, + "type": "string" + }, + "incognito": { + "description": "Whether to associate the download with a private browsing session.", + "optional": true, + "default": false, + "type": "boolean" + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity; requires \"cookies\" permission." + }, + "conflictAction": { + "$ref": "FilenameConflictAction", + "optional": true + }, + "saveAs": { + "description": "Use a file-chooser to allow the user to select a filename. If the option is not specified, the file chooser will be shown only if the Firefox \"Always ask you where to save files\" option is enabled (i.e. the pref <code>browser.download.useDownloadDir</code> is set to <code>false</code>).", + "optional": true, + "type": "boolean" + }, + "method": { + "description": "The HTTP method to use if the URL uses the HTTP[S] protocol.", + "enum": ["GET", "POST"], + "optional": true, + "type": "string" + }, + "headers": { + "optional": true, + "type": "array", + "description": "Extra HTTP headers to send with the request if the URL uses the HTTP[s] protocol. Each header is represented as a dictionary containing the keys <code>name</code> and either <code>value</code> or <code>binaryValue</code>, restricted to those allowed by XMLHttpRequest.", + "items": { + "type": "object", + "properties": { + "name": { + "description": "Name of the HTTP header.", + "type": "string" + }, + "value": { + "description": "Value of the HTTP header.", + "type": "string" + } + } + } + }, + "body": { + "description": "Post body.", + "optional": true, + "type": "string" + }, + "allowHttpErrors": { + "description": "When this flag is set to <code>true</code>, then the browser will allow downloads to proceed after encountering HTTP errors such as <code>404 Not Found</code>.", + "optional": true, + "default": false, + "type": "boolean" + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "name": "downloadId", + "type": "integer" + } + ] + } + ] + }, + { + "name": "search", + "type": "function", + "async": "callback", + "description": "Find <a href='#type-DownloadItem'>DownloadItems</a>. Set <code>query</code> to the empty object to get all <a href='#type-DownloadItem'>DownloadItems</a>. To get a specific <a href='#type-DownloadItem'>DownloadItem</a>, set only the <code>id</code> field.", + "parameters": [ + { + "name": "query", + "$ref": "DownloadQuery" + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "items": { + "$ref": "DownloadItem" + }, + "name": "results", + "type": "array" + } + ] + } + ] + }, + { + "name": "pause", + "type": "function", + "async": "callback", + "description": "Pause the download. If the request was successful the download is in a paused state. Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. The request will fail if the download is not active.", + "parameters": [ + { + "description": "The id of the download to pause.", + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "optional": true, + "parameters": [], + "type": "function" + } + ] + }, + { + "name": "resume", + "type": "function", + "async": "callback", + "description": "Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise <a href='extension.html#property-lastError'>chrome.extension.lastError</a> contains an error message. The request will fail if the download is not active.", + "parameters": [ + { + "description": "The id of the download to resume.", + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "optional": true, + "parameters": [], + "type": "function" + } + ] + }, + { + "name": "cancel", + "type": "function", + "async": "callback", + "description": "Cancel a download. When <code>callback</code> is run, the download is cancelled, completed, interrupted or doesn't exist anymore.", + "parameters": [ + { + "description": "The id of the download to cancel.", + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "optional": true, + "parameters": [], + "type": "function" + } + ] + }, + { + "name": "getFileIcon", + "type": "function", + "async": "callback", + "description": "Retrieve an icon for the specified download. For new downloads, file icons are available after the <a href='#event-onCreated'>onCreated</a> event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, <a href='extension.html#property-lastError'>chrome.extension.lastError</a> will contain an error message.", + "parameters": [ + { + "description": "The identifier for the download.", + "name": "downloadId", + "type": "integer" + }, + { + "name": "options", + "optional": true, + "properties": { + "size": { + "description": "The size of the icon. The returned icon will be square with dimensions size * size pixels. The default size for the icon is 32x32 pixels.", + "optional": true, + "minimum": 1, + "maximum": 127, + "type": "integer" + } + }, + "type": "object" + }, + { + "name": "callback", + "parameters": [ + { + "name": "iconURL", + "optional": true, + "type": "string" + } + ], + "type": "function" + } + ] + }, + { + "name": "open", + "type": "function", + "async": "callback", + "requireUserInput": true, + "description": "Open the downloaded file.", + "permissions": ["downloads.open"], + "parameters": [ + { + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "show", + "type": "function", + "description": "Show the downloaded file in its folder in a file manager.", + "async": "callback", + "parameters": [ + { + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "name": "success", + "type": "boolean" + } + ] + } + ] + }, + { + "name": "showDefaultFolder", + "type": "function", + "parameters": [] + }, + { + "name": "erase", + "type": "function", + "async": "callback", + "description": "Erase matching <a href='#type-DownloadItem'>DownloadItems</a> from history", + "parameters": [ + { + "name": "query", + "$ref": "DownloadQuery" + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "items": { + "type": "integer" + }, + "name": "erasedIds", + "type": "array" + } + ] + } + ] + }, + { + "name": "removeFile", + "async": "callback", + "type": "function", + "parameters": [ + { + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "description": "Prompt the user to either accept or cancel a dangerous download. <code>acceptDanger()</code> does not automatically accept dangerous downloads.", + "name": "acceptDanger", + "unsupported": true, + "parameters": [ + { + "name": "downloadId", + "type": "integer" + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ], + "type": "function" + }, + { + "description": "Initiate dragging the file to another application.", + "name": "drag", + "unsupported": true, + "parameters": [ + { + "name": "downloadId", + "type": "integer" + } + ], + "type": "function" + }, + { + "name": "setShelfEnabled", + "type": "function", + "unsupported": true, + "parameters": [ + { + "name": "enabled", + "type": "boolean" + } + ] + } + ], + "events": [ + { + "description": "This event fires with the <a href='#type-DownloadItem'>DownloadItem</a> object when a download begins.", + "name": "onCreated", + "parameters": [ + { + "$ref": "DownloadItem", + "name": "downloadItem" + } + ], + "type": "function" + }, + { + "description": "Fires with the <code>downloadId</code> when a download is erased from history.", + "name": "onErased", + "parameters": [ + { + "name": "downloadId", + "description": "The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that was erased.", + "type": "integer" + } + ], + "type": "function" + }, + { + "name": "onChanged", + "description": "When any of a <a href='#type-DownloadItem'>DownloadItem</a>'s properties except <code>bytesReceived</code> changes, this event fires with the <code>downloadId</code> and an object containing the properties that changed.", + "parameters": [ + { + "name": "downloadDelta", + "type": "object", + "properties": { + "id": { + "description": "The <code>id</code> of the <a href='#type-DownloadItem'>DownloadItem</a> that changed.", + "type": "integer" + }, + "url": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>url</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "filename": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>filename</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "danger": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>danger</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "mime": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>mime</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "startTime": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>startTime</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "endTime": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>endTime</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "state": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>state</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "canResume": { + "optional": true, + "$ref": "BooleanDelta" + }, + "paused": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>paused</code>.", + "optional": true, + "$ref": "BooleanDelta" + }, + "error": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>error</code>.", + "optional": true, + "$ref": "StringDelta" + }, + "totalBytes": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>totalBytes</code>.", + "optional": true, + "$ref": "DoubleDelta" + }, + "fileSize": { + "description": "Describes a change in a <a href='#type-DownloadItem'>DownloadItem</a>'s <code>fileSize</code>.", + "optional": true, + "$ref": "DoubleDelta" + }, + "exists": { + "optional": true, + "$ref": "BooleanDelta" + } + } + } + ], + "type": "function" + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/events.json b/toolkit/components/extensions/schemas/events.json new file mode 100644 index 0000000000..348fa77979 --- /dev/null +++ b/toolkit/components/extensions/schemas/events.json @@ -0,0 +1,328 @@ +// 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 file. + +[ + { + "namespace": "events", + "description": "The <code>chrome.events</code> namespace contains common types used by APIs dispatching events to notify you when something interesting happens.", + "types": [ + { + "id": "Rule", + "type": "object", + "description": "Description of a declarative rule for handling events.", + "properties": { + "id": { + "type": "string", + "optional": true, + "description": "Optional identifier that allows referencing this rule." + }, + "tags": { + "type": "array", + "items": { "type": "string" }, + "optional": true, + "description": "Tags can be used to annotate rules and perform operations on sets of rules." + }, + "conditions": { + "type": "array", + "items": { "type": "any" }, + "description": "List of conditions that can trigger the actions." + }, + "actions": { + "type": "array", + "items": { "type": "any" }, + "description": "List of actions that are triggered if one of the condtions is fulfilled." + }, + "priority": { + "type": "integer", + "optional": true, + "description": "Optional priority of this rule. Defaults to 100." + } + } + }, + { + "id": "Event", + "type": "object", + "description": "An object which allows the addition and removal of listeners for a Chrome event.", + "functions": [ + { + "name": "addListener", + "type": "function", + "description": "Registers an event listener <em>callback</em> to an event.", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "Called when an event occurs. The parameters of this function depend on the type of event." + } + ] + }, + { + "name": "removeListener", + "type": "function", + "description": "Deregisters an event listener <em>callback</em> from an event.", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "Listener that shall be unregistered." + } + ] + }, + { + "name": "hasListener", + "type": "function", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "Listener whose registration status shall be tested." + } + ], + "returns": { + "type": "boolean", + "description": "True if <em>callback</em> is registered to the event." + } + }, + { + "name": "hasListeners", + "type": "function", + "parameters": [], + "returns": { + "type": "boolean", + "description": "True if any event listeners are registered to the event." + } + }, + { + "name": "addRules", + "unsupported": true, + "type": "function", + "description": "Registers rules to handle events.", + "parameters": [ + { + "name": "eventName", + "type": "string", + "description": "Name of the event this function affects." + }, + { + "name": "webViewInstanceId", + "type": "integer", + "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call." + }, + { + "name": "rules", + "type": "array", + "items": { "$ref": "Rule" }, + "description": "Rules to be registered. These do not replace previously registered rules." + }, + { + "name": "callback", + "optional": true, + "type": "function", + "parameters": [ + { + "name": "rules", + "type": "array", + "items": { "$ref": "Rule" }, + "description": "Rules that were registered, the optional parameters are filled with values." + } + ], + "description": "Called with registered rules." + } + ] + }, + { + "name": "getRules", + "unsupported": true, + "type": "function", + "description": "Returns currently registered rules.", + "parameters": [ + { + "name": "eventName", + "type": "string", + "description": "Name of the event this function affects." + }, + { + "name": "webViewInstanceId", + "type": "integer", + "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call." + }, + { + "name": "ruleIdentifiers", + "optional": true, + "type": "array", + "items": { "type": "string" }, + "description": "If an array is passed, only rules with identifiers contained in this array are returned." + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "rules", + "type": "array", + "items": { "$ref": "Rule" }, + "description": "Rules that were registered, the optional parameters are filled with values." + } + ], + "description": "Called with registered rules." + } + ] + }, + { + "name": "removeRules", + "unsupported": true, + "type": "function", + "description": "Unregisters currently registered rules.", + "parameters": [ + { + "name": "eventName", + "type": "string", + "description": "Name of the event this function affects." + }, + { + "name": "webViewInstanceId", + "type": "integer", + "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call." + }, + { + "name": "ruleIdentifiers", + "optional": true, + "type": "array", + "items": { "type": "string" }, + "description": "If an array is passed, only rules with identifiers contained in this array are unregistered." + }, + { + "name": "callback", + "optional": true, + "type": "function", + "parameters": [], + "description": "Called when rules were unregistered." + } + ] + } + ] + }, + { + "id": "UrlFilter", + "type": "object", + "description": "Filters URLs for various criteria. See <a href='events#filtered'>event filtering</a>. All criteria are case sensitive.", + "properties": { + "hostContains": { + "type": "string", + "description": "Matches if the host name of the URL contains a specified string. To test whether a host name component has a prefix 'foo', use hostContains: '.foo'. This matches 'www.foobar.com' and 'foo.com', because an implicit dot is added at the beginning of the host name. Similarly, hostContains can be used to match against component suffix ('foo.') and to exactly match against components ('.foo.'). Suffix- and exact-matching for the last components need to be done separately using hostSuffix, because no implicit dot is added at the end of the host name.", + "optional": true + }, + "hostEquals": { + "type": "string", + "description": "Matches if the host name of the URL is equal to a specified string.", + "optional": true + }, + "hostPrefix": { + "type": "string", + "description": "Matches if the host name of the URL starts with a specified string.", + "optional": true + }, + "hostSuffix": { + "type": "string", + "description": "Matches if the host name of the URL ends with a specified string.", + "optional": true + }, + "pathContains": { + "type": "string", + "description": "Matches if the path segment of the URL contains a specified string.", + "optional": true + }, + "pathEquals": { + "type": "string", + "description": "Matches if the path segment of the URL is equal to a specified string.", + "optional": true + }, + "pathPrefix": { + "type": "string", + "description": "Matches if the path segment of the URL starts with a specified string.", + "optional": true + }, + "pathSuffix": { + "type": "string", + "description": "Matches if the path segment of the URL ends with a specified string.", + "optional": true + }, + "queryContains": { + "type": "string", + "description": "Matches if the query segment of the URL contains a specified string.", + "optional": true + }, + "queryEquals": { + "type": "string", + "description": "Matches if the query segment of the URL is equal to a specified string.", + "optional": true + }, + "queryPrefix": { + "type": "string", + "description": "Matches if the query segment of the URL starts with a specified string.", + "optional": true + }, + "querySuffix": { + "type": "string", + "description": "Matches if the query segment of the URL ends with a specified string.", + "optional": true + }, + "urlContains": { + "type": "string", + "description": "Matches if the URL (without fragment identifier) contains a specified string. Port numbers are stripped from the URL if they match the default port number.", + "optional": true + }, + "urlEquals": { + "type": "string", + "description": "Matches if the URL (without fragment identifier) is equal to a specified string. Port numbers are stripped from the URL if they match the default port number.", + "optional": true + }, + "urlMatches": { + "type": "string", + "description": "Matches if the URL (without fragment identifier) matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the <a href=\"https://github.com/google/re2/blob/master/doc/syntax.txt\">RE2 syntax</a>.", + "optional": true + }, + "originAndPathMatches": { + "type": "string", + "description": "Matches if the URL without query segment and fragment identifier matches a specified regular expression. Port numbers are stripped from the URL if they match the default port number. The regular expressions use the <a href=\"https://github.com/google/re2/blob/master/doc/syntax.txt\">RE2 syntax</a>.", + "optional": true + }, + "urlPrefix": { + "type": "string", + "description": "Matches if the URL (without fragment identifier) starts with a specified string. Port numbers are stripped from the URL if they match the default port number.", + "optional": true + }, + "urlSuffix": { + "type": "string", + "description": "Matches if the URL (without fragment identifier) ends with a specified string. Port numbers are stripped from the URL if they match the default port number.", + "optional": true + }, + "schemes": { + "type": "array", + "description": "Matches if the scheme of the URL is equal to any of the schemes specified in the array.", + "optional": true, + "items": { "type": "string" } + }, + "ports": { + "type": "array", + "description": "Matches if the port of the URL is contained in any of the specified port lists. For example <code>[80, 443, [1000, 1200]]</code> matches all requests on port 80, 443 and in the range 1000-1200.", + "optional": true, + "items": { + "choices": [ + { "type": "integer", "description": "A specific port." }, + { + "type": "array", + "minItems": 2, + "maxItems": 2, + "items": { "type": "integer" }, + "description": "A pair of integers identiying the start and end (both inclusive) of a port range." + } + ] + } + } + } + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/experiments.json b/toolkit/components/extensions/schemas/experiments.json new file mode 100644 index 0000000000..78f23cd8f2 --- /dev/null +++ b/toolkit/components/extensions/schemas/experiments.json @@ -0,0 +1,119 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "Permission", + "choices": [ + { + "type": "string", + "pattern": "^experiments(\\.\\w+)+$" + } + ] + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "experiment_apis": { + "type": "object", + "additionalProperties": { "$ref": "experiments.ExperimentAPI" }, + "optional": true, + "privileged": true + } + } + } + ] + }, + { + "namespace": "experiments", + "types": [ + { + "id": "ExperimentAPI", + "type": "object", + "properties": { + "schema": { "$ref": "ExperimentURL" }, + + "parent": { + "type": "object", + "properties": { + "events": { + "$ref": "APIEvents", + "optional": true, + "default": [] + }, + + "paths": { + "$ref": "APIPaths", + "optional": true, + "default": [] + }, + + "script": { "$ref": "ExperimentURL" }, + + "scopes": { + "type": "array", + "items": { "$ref": "APIParentScope", "onError": "warn" }, + "optional": true, + "default": [] + } + }, + "optional": true + }, + + "child": { + "type": "object", + "properties": { + "paths": { "$ref": "APIPaths" }, + + "script": { "$ref": "ExperimentURL" }, + + "scopes": { + "type": "array", + "minItems": 1, + "items": { "$ref": "APIChildScope", "onError": "warn" } + } + }, + "optional": true + } + } + }, + { + "id": "ExperimentURL", + "type": "string", + "format": "unresolvedRelativeUrl" + }, + { + "id": "APIPaths", + "type": "array", + "items": { "$ref": "APIPath" }, + "minItems": 1 + }, + { + "id": "APIPath", + "type": "array", + "items": { "type": "string" }, + "minItems": 1 + }, + { + "id": "APIEvents", + "type": "array", + "items": { "$ref": "APIEvent", "onError": "warn" } + }, + { + "id": "APIEvent", + "type": "string", + "enum": ["startup"] + }, + { + "id": "APIParentScope", + "type": "string", + "enum": ["addon_parent", "content_parent", "devtools_parent"] + }, + { + "id": "APIChildScope", + "type": "string", + "enum": ["addon_child", "content_child", "devtools_child"] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/extension.json b/toolkit/components/extensions/schemas/extension.json new file mode 100644 index 0000000000..8b3eba7845 --- /dev/null +++ b/toolkit/components/extensions/schemas/extension.json @@ -0,0 +1,204 @@ +// 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 file. + +[ + { + "namespace": "extension", + "allowedContexts": ["content", "devtools"], + "description": "The <code>browser.extension</code> API has utilities that can be used by any extension page. It includes support for exchanging messages between an extension and its content scripts or between extensions, as described in detail in $(topic:messaging)[Message Passing].", + "properties": { + "lastError": { + "type": "object", + "optional": true, + "max_manifest_version": 2, + "deprecated": "Please use $(ref:runtime.lastError).", + "allowedContexts": ["content", "devtools"], + "description": "Set for the lifetime of a callback if an ansychronous extension api has resulted in an error. If no error has occured lastError will be <var>undefined</var>.", + "properties": { + "message": { + "type": "string", + "description": "Description of the error that has taken place." + } + }, + "additionalProperties": { + "type": "any" + } + }, + "inIncognitoContext": { + "type": "boolean", + "optional": true, + "allowedContexts": ["content", "devtools"], + "description": "True for content scripts running inside incognito tabs, and for extension pages running inside an incognito process. The latter only applies to extensions with 'split' incognito_behavior." + } + }, + "types": [ + { + "id": "ViewType", + "type": "string", + "enum": ["tab", "popup", "sidebar"], + "description": "The type of extension view." + } + ], + "functions": [ + { + "name": "getURL", + "type": "function", + "deprecated": "Please use $(ref:runtime.getURL).", + "max_manifest_version": 2, + "allowedContexts": ["content", "devtools"], + "description": "Converts a relative path within an extension install directory to a fully-qualified URL.", + "parameters": [ + { + "type": "string", + "name": "path", + "description": "A path to a resource within an extension expressed relative to its install directory." + } + ], + "returns": { + "type": "string", + "description": "The fully-qualified URL to the resource." + } + }, + { + "name": "getViews", + "type": "function", + "description": "Returns an array of the JavaScript 'window' objects for each of the pages running inside the current extension.", + "parameters": [ + { + "type": "object", + "name": "fetchProperties", + "optional": true, + "properties": { + "type": { + "$ref": "ViewType", + "optional": true, + "description": "The type of view to get. If omitted, returns all views (including background pages and tabs). Valid values: 'tab', 'popup', 'sidebar'." + }, + "windowId": { + "type": "integer", + "optional": true, + "description": "The window to restrict the search to. If omitted, returns all views." + }, + "tabId": { + "type": "integer", + "optional": true, + "description": "Find a view according to a tab id. If this field is omitted, returns all views." + } + } + } + ], + "returns": { + "type": "array", + "description": "Array of global objects", + "items": { + "type": "object", + "isInstanceOf": "Window", + "additionalProperties": { "type": "any" } + } + } + }, + { + "name": "getBackgroundPage", + "type": "function", + "description": "Returns the JavaScript 'window' object for the background page running inside the current extension. Returns null if the extension has no background page.", + "parameters": [], + "returns": { + "type": "object", + "optional": true, + "isInstanceOf": "Window", + "additionalProperties": { "type": "any" } + } + }, + { + "name": "isAllowedIncognitoAccess", + "type": "function", + "description": "Retrieves the state of the extension's access to Incognito-mode (as determined by the user-controlled 'Allowed in Incognito' checkbox.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "isAllowedAccess", + "type": "boolean", + "description": "True if the extension has access to Incognito mode, false otherwise." + } + ] + } + ] + }, + { + "name": "isAllowedFileSchemeAccess", + "type": "function", + "description": "Retrieves the state of the extension's access to the 'file://' scheme (as determined by the user-controlled 'Allow access to File URLs' checkbox.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "isAllowedAccess", + "type": "boolean", + "description": "True if the extension can access the 'file://' scheme, false otherwise." + } + ] + } + ] + }, + { + "name": "setUpdateUrlData", + "unsupported": true, + "type": "function", + "description": "Sets the value of the ap CGI parameter used in the extension's update URL. This value is ignored for extensions that are hosted in the browser vendor's store.", + "parameters": [{ "type": "string", "name": "data", "maxLength": 1024 }] + } + ], + "events": [ + { + "name": "onRequest", + "unsupported": true, + "deprecated": "Please use $(ref:runtime.onMessage).", + "type": "function", + "description": "Fired when a request is sent from either an extension process or a content script.", + "parameters": [ + { + "name": "request", + "type": "any", + "optional": true, + "description": "The request sent by the calling script." + }, + { "name": "sender", "$ref": "runtime.MessageSender" }, + { + "name": "sendResponse", + "type": "function", + "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response. If you have more than one <code>onRequest</code> listener in the same document, then only one may send a response." + } + ] + }, + { + "name": "onRequestExternal", + "unsupported": true, + "deprecated": "Please use $(ref:runtime.onMessageExternal).", + "type": "function", + "description": "Fired when a request is sent from another extension.", + "parameters": [ + { + "name": "request", + "type": "any", + "optional": true, + "description": "The request sent by the calling script." + }, + { "name": "sender", "$ref": "runtime.MessageSender" }, + { + "name": "sendResponse", + "type": "function", + "description": "Function to call when you have a response. The argument should be any JSON-ifiable object, or undefined if there is no response." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/extension_protocol_handlers.json b/toolkit/components/extensions/schemas/extension_protocol_handlers.json new file mode 100644 index 0000000000..b77e1e7426 --- /dev/null +++ b/toolkit/components/extensions/schemas/extension_protocol_handlers.json @@ -0,0 +1,75 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "id": "ProtocolHandler", + "type": "object", + "description": "Represents a protocol handler definition.", + "properties": { + "name": { + "description": "A user-readable title string for the protocol handler. This will be displayed to the user in interface objects as needed.", + "type": "string" + }, + "protocol": { + "description": "The protocol the site wishes to handle, specified as a string. For example, you can register to handle SMS text message links by registering to handle the \"sms\" scheme.", + "choices": [ + { + "type": "string", + "enum": [ + "bitcoin", + "dat", + "dweb", + "ftp", + "geo", + "gopher", + "im", + "ipfs", + "ipns", + "irc", + "ircs", + "magnet", + "mailto", + "matrix", + "mms", + "news", + "nntp", + "sip", + "sms", + "smsto", + "ssb", + "ssh", + "tel", + "urn", + "webcal", + "wtai", + "xmpp" + ] + }, + { + "type": "string", + "pattern": "^(ext|web)\\+[a-z0-9.+-]+$" + } + ] + }, + "uriTemplate": { + "description": "The URL of the handler, as a string. This string should include \"%s\" as a placeholder which will be replaced with the escaped URL of the document to be handled. This URL might be a true URL, or it could be a phone number, email address, or so forth.", + "preprocess": "localize", + "choices": [{ "$ref": "ExtensionURL" }, { "$ref": "HttpURL" }] + } + } + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "protocol_handlers": { + "description": "A list of protocol handler definitions.", + "optional": true, + "type": "array", + "items": { "$ref": "ProtocolHandler" } + } + } + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/extension_types.json b/toolkit/components/extensions/schemas/extension_types.json new file mode 100644 index 0000000000..ecafbb2496 --- /dev/null +++ b/toolkit/components/extensions/schemas/extension_types.json @@ -0,0 +1,168 @@ +// Copyright 2014 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 file. + +[ + { + "namespace": "extensionTypes", + "description": "The <code>browser.extensionTypes</code> API contains type declarations for WebExtensions.", + "types": [ + { + "id": "ImageFormat", + "type": "string", + "enum": ["jpeg", "png"], + "description": "The format of an image." + }, + { + "id": "ImageDetails", + "type": "object", + "description": "Details about the format, quality, area and scale of the capture.", + "properties": { + "format": { + "$ref": "ImageFormat", + "optional": true, + "description": "The format of the resulting image. Default is <code>\"jpeg\"</code>." + }, + "quality": { + "type": "integer", + "optional": true, + "minimum": 0, + "maximum": 100, + "description": "When format is <code>\"jpeg\"</code>, controls the quality of the resulting image. This value is ignored for PNG images. As quality is decreased, the resulting image will have more visual artifacts, and the number of bytes needed to store it will decrease." + }, + "rect": { + "type": "object", + "optional": true, + "description": "The area of the document to capture, in CSS pixels, relative to the page. If omitted, capture the visible viewport.", + "properties": { + "x": { "type": "number" }, + "y": { "type": "number" }, + "width": { "type": "number" }, + "height": { "type": "number" } + } + }, + "scale": { + "type": "number", + "optional": true, + "description": "The scale of the resulting image. Defaults to <code>devicePixelRatio</code>." + }, + "resetScrollPosition": { + "type": "boolean", + "optional": true, + "description": "If true, temporarily resets the scroll position of the document to 0. Only takes effect if rect is also specified." + } + } + }, + { + "id": "RunAt", + "type": "string", + "enum": ["document_start", "document_end", "document_idle"], + "description": "The soonest that the JavaScript or CSS will be injected into the tab." + }, + { + "id": "CSSOrigin", + "type": "string", + "enum": ["user", "author"], + "description": "The origin of the CSS to inject, this affects the cascading order (priority) of the stylesheet." + }, + { + "id": "InjectDetails", + "type": "object", + "description": "Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time.", + "properties": { + "code": { + "type": "string", + "optional": true, + "description": "JavaScript or CSS code to inject.<br><br><b>Warning:</b><br>Be careful using the <code>code</code> parameter. Incorrect use of it may open your extension to <a href=\"https://en.wikipedia.org/wiki/Cross-site_scripting\">cross site scripting</a> attacks." + }, + "file": { + "type": "string", + "optional": true, + "description": "JavaScript or CSS file to inject." + }, + "allFrames": { + "type": "boolean", + "optional": true, + "description": "If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame." + }, + "matchAboutBlank": { + "type": "boolean", + "optional": true, + "description": "If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>." + }, + "frameId": { + "type": "integer", + "minimum": 0, + "optional": true, + "description": "The ID of the frame to inject the script into. This may not be used in combination with <code>allFrames</code>." + }, + "runAt": { + "$ref": "RunAt", + "optional": true, + "default": "document_idle", + "description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"." + }, + "cssOrigin": { + "$ref": "CSSOrigin", + "optional": true, + "description": "The css origin of the stylesheet to inject. Defaults to \"author\"." + } + } + }, + { + "id": "Date", + "choices": [ + { + "type": "string", + "format": "date" + }, + { + "type": "integer", + "minimum": 0 + }, + { + "type": "object", + "isInstanceOf": "Date", + "additionalProperties": { "type": "any" } + } + ] + }, + { + "id": "ExtensionFileOrCode", + "choices": [ + { + "type": "object", + "properties": { + "file": { + "$ref": "manifest.ExtensionURL" + } + } + }, + { + "type": "object", + "properties": { + "code": { + "type": "string" + } + } + } + ] + }, + { + "id": "PlainJSONValue", + "description": "A plain JSON value", + "choices": [ + { "type": "null" }, + { "type": "number" }, + { "type": "string" }, + { "type": "boolean" }, + { "type": "array", "items": { "$ref": "PlainJSONValue" } }, + { + "type": "object", + "additionalProperties": { "$ref": "PlainJSONValue" } + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/geckoProfiler.json b/toolkit/components/extensions/schemas/geckoProfiler.json new file mode 100644 index 0000000000..f70996a1c3 --- /dev/null +++ b/toolkit/components/extensions/schemas/geckoProfiler.json @@ -0,0 +1,190 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["geckoProfiler"] + } + ] + } + ] + }, + { + "namespace": "geckoProfiler", + "description": "Exposes the browser's profiler.", + + "permissions": ["geckoProfiler"], + "types": [ + { + "id": "ProfilerFeature", + "type": "string", + "enum": [ + "java", + "js", + "mainthreadio", + "fileio", + "fileioall", + "nomarkerstacks", + "screenshots", + "seqstyle", + "stackwalk", + "jsallocations", + "nostacksampling", + "nativeallocations", + "ipcmessages", + "audiocallbacktracing", + "cpu", + "notimerresolutionchange", + "cpuallthreads", + "samplingallthreads", + "markersallthreads", + "unregisteredthreads", + "processcpu", + "power", + "responsiveness" + ] + }, + { + "id": "supports", + "type": "string", + "enum": ["windowLength"] + } + ], + "functions": [ + { + "name": "start", + "type": "function", + "description": "Starts the profiler with the specified settings.", + "async": true, + "parameters": [ + { + "name": "settings", + "type": "object", + "properties": { + "bufferSize": { + "type": "integer", + "minimum": 0, + "description": "The maximum size in bytes of the buffer used to store profiling data. A larger value allows capturing a profile that covers a greater amount of time." + }, + "windowLength": { + "type": "number", + "optional": true, + "description": "The length of the window of time that's kept in the buffer. Any collected samples are discarded as soon as they are older than the number of seconds specified in this setting. Zero means no duration restriction." + }, + "interval": { + "type": "number", + "description": "Interval in milliseconds between samples of profiling data. A smaller value will increase the detail of the profiles captured." + }, + "features": { + "type": "array", + "description": "A list of active features for the profiler.", + "items": { + "$ref": "ProfilerFeature" + } + }, + "threads": { + "type": "array", + "description": "A list of thread names for which to capture profiles.", + "optional": true, + "items": { + "type": "string" + } + } + } + } + ] + }, + { + "name": "stop", + "type": "function", + "description": "Stops the profiler and discards any captured profile data.", + "async": true, + "parameters": [] + }, + { + "name": "pause", + "type": "function", + "description": "Pauses the profiler, keeping any profile data that is already written.", + "async": true, + "parameters": [] + }, + { + "name": "resume", + "type": "function", + "description": "Resumes the profiler with the settings that were initially used to start it.", + "async": true, + "parameters": [] + }, + { + "name": "dumpProfileToFile", + "type": "function", + "description": "Gathers the profile data from the current profiling session, and writes it to disk. The returned promise resolves to a path that locates the created file.", + "async": true, + "parameters": [ + { + "type": "string", + "name": "fileName", + "description": "The name of the file inside the profile/profiler directory" + } + ] + }, + { + "name": "getProfile", + "type": "function", + "description": "Gathers the profile data from the current profiling session.", + "async": true, + "parameters": [] + }, + { + "name": "getProfileAsArrayBuffer", + "type": "function", + "description": "Gathers the profile data from the current profiling session. The returned promise resolves to an array buffer that contains a JSON string.", + "async": true, + "parameters": [] + }, + { + "name": "getProfileAsGzippedArrayBuffer", + "type": "function", + "description": "Gathers the profile data from the current profiling session. The returned promise resolves to an array buffer that contains a gzipped JSON string.", + "async": true, + "parameters": [] + }, + { + "name": "getSymbols", + "type": "function", + "description": "Gets the debug symbols for a particular library.", + "async": true, + "parameters": [ + { + "type": "string", + "name": "debugName", + "description": "The name of the library's debug file. For example, 'xul.pdb" + }, + { + "type": "string", + "name": "breakpadId", + "description": "The Breakpad ID of the library" + } + ] + } + ], + "events": [ + { + "name": "onRunning", + "type": "function", + "description": "Fires when the profiler starts/stops running.", + "parameters": [ + { + "name": "isRunning", + "type": "boolean", + "description": "Whether the profiler is running or not. Pausing the profiler will not affect this value." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/i18n.json b/toolkit/components/extensions/schemas/i18n.json new file mode 100644 index 0000000000..e85aa0bb89 --- /dev/null +++ b/toolkit/components/extensions/schemas/i18n.json @@ -0,0 +1,143 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "default_locale": { + "type": "string", + "optional": "true" + }, + "l10n_resources": { + "type": "array", + "items": { + "type": "string" + }, + "optional": true, + "privileged": true + } + } + } + ] + }, + { + "namespace": "i18n", + "allowedContexts": ["content", "devtools"], + "defaultContexts": ["content", "devtools"], + "description": "Use the <code>browser.i18n</code> infrastructure to implement internationalization across your whole app or extension.", + "types": [ + { + "id": "LanguageCode", + "type": "string", + "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>. For an unknown language, <code>und</code> will be returned, which means that [percentage] of the text is unknown to CLD" + } + ], + "functions": [ + { + "name": "getAcceptLanguages", + "type": "function", + "description": "Gets the accept-languages of the browser. This is different from the locale used by the browser; to get the locale, use $(ref:i18n.getUILanguage).", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "languages", + "type": "array", + "items": { "$ref": "LanguageCode" }, + "description": "Array of LanguageCode" + } + ] + } + ] + }, + { + "name": "getMessage", + "type": "function", + "description": "Gets the localized string for the specified message. If the message is missing, this method returns an empty string (''). If the format of the <code>getMessage()</code> call is wrong — for example, <em>messageName</em> is not a string or the <em>substitutions</em> array has more than 9 elements — this method returns <code>undefined</code>.", + "parameters": [ + { + "type": "string", + "name": "messageName", + "description": "The name of the message, as specified in the <code>$(topic:i18n-messages)[messages.json]</code> file." + }, + { + "type": "any", + "name": "substitutions", + "optional": true, + "description": "Substitution strings, if the message requires any." + } + ], + "returns": { + "type": "string", + "description": "Message localized for current locale." + } + }, + { + "name": "getUILanguage", + "type": "function", + "description": "Gets the browser UI language of the browser. This is different from $(ref:i18n.getAcceptLanguages) which returns the preferred user languages.", + "parameters": [], + "returns": { + "type": "string", + "description": "The browser UI language code such as en-US or fr-FR." + } + }, + { + "name": "detectLanguage", + "type": "function", + "description": "Detects the language of the provided text using CLD.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "text", + "description": "User input string to be translated." + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "object", + "name": "result", + "description": "LanguageDetectionResult object that holds detected langugae reliability and array of DetectedLanguage", + "properties": { + "isReliable": { + "type": "boolean", + "description": "CLD detected language reliability" + }, + "languages": { + "type": "array", + "description": "array of detectedLanguage", + "items": { + "type": "object", + "description": "DetectedLanguage object that holds detected ISO language code and its percentage in the input string", + "properties": { + "language": { + "$ref": "LanguageCode" + }, + "percentage": { + "type": "integer", + "description": "The percentage of the detected language" + } + } + } + } + } + } + ] + } + ] + } + ], + "events": [] + } +] diff --git a/toolkit/components/extensions/schemas/identity.json b/toolkit/components/extensions/schemas/identity.json new file mode 100644 index 0000000000..947630aa8c --- /dev/null +++ b/toolkit/components/extensions/schemas/identity.json @@ -0,0 +1,219 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["identity"] + } + ] + } + ] + }, + { + "namespace": "identity", + "description": "Use the chrome.identity API to get OAuth2 access tokens. ", + "permissions": ["identity"], + "types": [ + { + "id": "AccountInfo", + "type": "object", + "description": "An object encapsulating an OAuth account id.", + "properties": { + "id": { + "type": "string", + "description": "A unique identifier for the account. This ID will not change for the lifetime of the account. " + } + } + } + ], + "functions": [ + { + "name": "getAccounts", + "type": "function", + "unsupported": true, + "description": "Retrieves a list of AccountInfo objects describing the accounts present on the profile.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "AccountInfo" + } + } + ] + } + ] + }, + { + "name": "getAuthToken", + "type": "function", + "unsupported": true, + "description": "Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json.", + "async": "callback", + "parameters": [ + { + "name": "details", + "optional": true, + "type": "object", + "properties": { + "interactive": { + "optional": true, + "type": "boolean" + }, + "account": { + "optional": true, + "$ref": "AccountInfo" + }, + "scopes": { + "optional": true, + "type": "array", + "items": { + "type": "string" + } + } + } + }, + { + "name": "callback", + "optional": true, + "type": "function", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { + "$ref": "AccountInfo" + } + } + ] + } + ] + }, + { + "name": "getProfileUserInfo", + "type": "function", + "unsupported": true, + "description": "Retrieves email address and obfuscated gaia id of the user signed into a profile.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "userinfo", + "type": "object", + "properties": { + "email": { "type": "string" }, + "id": { "type": "string" } + } + } + ] + } + ] + }, + { + "name": "removeCachedAuthToken", + "type": "function", + "unsupported": true, + "description": "Removes an OAuth2 access token from the Identity API's token cache.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "token": { "type": "string" } + } + }, + { + "name": "callback", + "optional": true, + "type": "function", + "parameters": [ + { + "name": "userinfo", + "type": "object", + "properties": { + "email": { "type": "string" }, + "id": { "type": "string" } + } + } + ] + } + ] + }, + { + "name": "launchWebAuthFlow", + "type": "function", + "description": "Starts an auth flow at the specified URL.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "url": { "$ref": "manifest.HttpURL" }, + "interactive": { "type": "boolean", "optional": true } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": " responseUrl", + "type": "string", + "optional": true + } + ] + } + ] + }, + { + "name": "getRedirectURL", + "type": "function", + "description": "Generates a redirect URL to be used in |launchWebAuthFlow|.", + "parameters": [ + { + "name": "path", + "type": "string", + "default": "", + "optional": true, + "description": "The path appended to the end of the generated URL. " + } + ], + "returns": { + "type": "string" + } + } + ], + "events": [ + { + "name": "onSignInChanged", + "unsupported": true, + "type": "function", + "description": "Fired when signin state changes for an account on the user's profile.", + "parameters": [ + { + "name": "account", + "$ref": "AccountInfo" + }, + { + "name": "signedIn", + "type": "boolean" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/idle.json b/toolkit/components/extensions/schemas/idle.json new file mode 100644 index 0000000000..e0b3b951ee --- /dev/null +++ b/toolkit/components/extensions/schemas/idle.json @@ -0,0 +1,70 @@ +// 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 file. + +[ + { + "namespace": "idle", + "description": "Use the <code>browser.idle</code> API to detect when the machine's idle state changes.", + "permissions": ["idle"], + "types": [ + { + "id": "IdleState", + "type": "string", + "enum": ["active", "idle"] + } + ], + "functions": [ + { + "name": "queryState", + "type": "function", + "description": "Returns \"idle\" if the user has not generated any input for a specified number of seconds, or \"active\" otherwise.", + "async": "callback", + "parameters": [ + { + "name": "detectionIntervalInSeconds", + "type": "integer", + "minimum": 15, + "description": "The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected." + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "newState", + "$ref": "IdleState" + } + ] + } + ] + }, + { + "name": "setDetectionInterval", + "type": "function", + "description": "Sets the interval, in seconds, used to determine when the system is in an idle state for onStateChanged events. The default interval is 60 seconds.", + "parameters": [ + { + "name": "intervalInSeconds", + "type": "integer", + "minimum": 15, + "description": "Threshold, in seconds, used to determine when the system is in an idle state." + } + ] + } + ], + "events": [ + { + "name": "onStateChanged", + "type": "function", + "description": "Fired when the system changes to an active or idle state. The event fires with \"idle\" if the the user has not generated any input for a specified number of seconds, and \"active\" when the user generates input on an idle system.", + "parameters": [ + { + "name": "newState", + "$ref": "IdleState" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/jar.mn b/toolkit/components/extensions/schemas/jar.mn new file mode 100644 index 0000000000..59e2332ebe --- /dev/null +++ b/toolkit/components/extensions/schemas/jar.mn @@ -0,0 +1,54 @@ +# 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/. + +toolkit.jar: +% content extensions %content/extensions/ + content/extensions/schemas/activity_log.json + content/extensions/schemas/alarms.json + content/extensions/schemas/browser_action.json + content/extensions/schemas/browser_settings.json + content/extensions/schemas/browsing_data.json +#ifndef ANDROID + content/extensions/schemas/captive_portal.json +#endif + content/extensions/schemas/clipboard.json + content/extensions/schemas/content_scripts.json + content/extensions/schemas/contextual_identities.json + content/extensions/schemas/cookies.json + content/extensions/schemas/declarative_net_request.json + content/extensions/schemas/dns.json + content/extensions/schemas/downloads.json + content/extensions/schemas/events.json + content/extensions/schemas/experiments.json + content/extensions/schemas/extension.json + content/extensions/schemas/extension_types.json + content/extensions/schemas/extension_protocol_handlers.json +#ifndef ANDROID + content/extensions/schemas/geckoProfiler.json +#endif + content/extensions/schemas/i18n.json +#ifndef ANDROID + content/extensions/schemas/identity.json +#endif + content/extensions/schemas/idle.json + content/extensions/schemas/management.json + content/extensions/schemas/manifest.json + content/extensions/schemas/native_manifest.json + content/extensions/schemas/network_status.json + content/extensions/schemas/notifications.json + content/extensions/schemas/page_action.json + content/extensions/schemas/permissions.json + content/extensions/schemas/proxy.json + content/extensions/schemas/privacy.json + content/extensions/schemas/runtime.json + content/extensions/schemas/scripting.json + content/extensions/schemas/storage.json + content/extensions/schemas/telemetry.json + content/extensions/schemas/test.json + content/extensions/schemas/theme.json + content/extensions/schemas/types.json + content/extensions/schemas/user_scripts.json + content/extensions/schemas/user_scripts_content.json + content/extensions/schemas/web_navigation.json + content/extensions/schemas/web_request.json diff --git a/toolkit/components/extensions/schemas/management.json b/toolkit/components/extensions/schemas/management.json new file mode 100644 index 0000000000..861273cab2 --- /dev/null +++ b/toolkit/components/extensions/schemas/management.json @@ -0,0 +1,368 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["management"] + } + ] + } + ] + }, + { + "namespace": "management", + "description": "The <code>browser.management</code> API provides ways to manage the list of extensions that are installed and running.", + "types": [ + { + "id": "IconInfo", + "description": "Information about an icon belonging to an extension.", + "type": "object", + "properties": { + "size": { + "type": "integer", + "description": "A number representing the width and height of the icon. Likely values include (but are not limited to) 128, 48, 24, and 16." + }, + "url": { + "type": "string", + "description": "The URL for this icon image. To display a grayscale version of the icon (to indicate that an extension is disabled, for example), append <code>?grayscale=true</code> to the URL." + } + } + }, + { + "id": "ExtensionDisabledReason", + "description": "A reason the item is disabled.", + "type": "string", + "enum": ["unknown", "permissions_increase"] + }, + { + "id": "ExtensionType", + "description": "The type of this extension, 'extension' or 'theme'.", + "type": "string", + "enum": ["extension", "theme"] + }, + { + "id": "ExtensionInstallType", + "description": "How the extension was installed. One of<br><var>development</var>: The extension was loaded unpacked in developer mode,<br><var>normal</var>: The extension was installed normally via an .xpi file,<br><var>sideload</var>: The extension was installed by other software on the machine,<br><var>other</var>: The extension was installed by other means.", + "type": "string", + "enum": ["development", "normal", "sideload", "other"] + }, + { + "id": "ExtensionInfo", + "description": "Information about an installed extension.", + "type": "object", + "properties": { + "id": { + "description": "The extension's unique identifier.", + "type": "string" + }, + "name": { + "description": "The name of this extension.", + "type": "string" + }, + "shortName": { + "description": "A short version of the name of this extension.", + "type": "string", + "optional": true + }, + "description": { + "description": "The description of this extension.", + "type": "string" + }, + "version": { + "description": "The <a href='manifest/version'>version</a> of this extension.", + "type": "string" + }, + "versionName": { + "description": "The <a href='manifest/version#version_name'>version name</a> of this extension if the manifest specified one.", + "type": "string", + "optional": true + }, + "mayDisable": { + "description": "Whether this extension can be disabled or uninstalled by the user.", + "type": "boolean" + }, + "enabled": { + "description": "Whether it is currently enabled or disabled.", + "type": "boolean" + }, + "disabledReason": { + "description": "A reason the item is disabled.", + "$ref": "ExtensionDisabledReason", + "optional": true + }, + "type": { + "description": "The type of this extension, 'extension' or 'theme'.", + "$ref": "ExtensionType" + }, + "homepageUrl": { + "description": "The URL of the homepage of this extension.", + "type": "string", + "optional": true + }, + "updateUrl": { + "description": "The update URL of this extension.", + "type": "string", + "optional": true + }, + "optionsUrl": { + "description": "The url for the item's options page, if it has one.", + "type": "string" + }, + "icons": { + "description": "A list of icon information. Note that this just reflects what was declared in the manifest, and the actual image at that url may be larger or smaller than what was declared, so you might consider using explicit width and height attributes on img tags referencing these images. See the <a href='manifest/icons'>manifest documentation on icons</a> for more details.", + "type": "array", + "optional": true, + "items": { + "$ref": "IconInfo" + } + }, + "permissions": { + "description": "Returns a list of API based permissions.", + "type": "array", + "optional": true, + "items": { + "type": "string" + } + }, + "hostPermissions": { + "description": "Returns a list of host based permissions.", + "type": "array", + "optional": true, + "items": { + "type": "string" + } + }, + "installType": { + "description": "How the extension was installed.", + "$ref": "ExtensionInstallType" + } + } + } + ], + "functions": [ + { + "name": "getAll", + "type": "function", + "permissions": ["management"], + "description": "Returns a list of information about installed extensions.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "type": "array", + "name": "result", + "items": { + "$ref": "ExtensionInfo" + } + } + ] + } + ] + }, + { + "name": "get", + "type": "function", + "permissions": ["management"], + "description": "Returns information about the installed extension that has the given ID.", + "async": "callback", + "parameters": [ + { + "name": "id", + "$ref": "manifest.ExtensionID", + "description": "The ID from an item of $(ref:management.ExtensionInfo)." + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "ExtensionInfo" + } + ] + } + ] + }, + { + "name": "install", + "type": "function", + "requireUserInput": true, + "permissions": ["management"], + "description": "Installs and enables a theme extension from the given url.", + "async": "callback", + "parameters": [ + { + "name": "options", + "type": "object", + "properties": { + "url": { + "$ref": "manifest.HttpURL", + "description": "URL pointing to the XPI file on addons.mozilla.org or similar." + }, + "hash": { + "type": "string", + "optional": true, + "pattern": "^(sha256|sha512):[0-9a-fA-F]{64,128}$", + "description": "A hash of the XPI file, using sha256 or stronger." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [ + { + "name": "result", + "type": "object", + "properties": { + "id": { + "$ref": "manifest.ExtensionID" + } + } + } + ] + } + ] + }, + { + "name": "getSelf", + "type": "function", + "description": "Returns information about the calling extension. Note: This function can be used without requesting the 'management' permission in the manifest.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [ + { + "name": "result", + "$ref": "ExtensionInfo" + } + ] + } + ] + }, + { + "name": "uninstallSelf", + "type": "function", + "description": "Uninstalls the calling extension. Note: This function can be used without requesting the 'management' permission in the manifest.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "options", + "optional": true, + "properties": { + "showConfirmDialog": { + "type": "boolean", + "optional": true, + "description": "Whether or not a confirm-uninstall dialog should prompt the user. Defaults to false." + }, + "dialogMessage": { + "type": "string", + "optional": true, + "description": "The message to display to a user when being asked to confirm removal of the extension." + } + } + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "setEnabled", + "type": "function", + "permissions": ["management"], + "description": "Enables or disables the given add-on.", + "async": "callback", + "parameters": [ + { + "name": "id", + "type": "string", + "description": "ID of the add-on to enable/disable." + }, + { + "name": "enabled", + "type": "boolean", + "description": "Whether to enable or disable the add-on." + }, + { + "name": "callback", + "type": "function", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onDisabled", + "type": "function", + "permissions": ["management"], + "description": "Fired when an addon has been disabled.", + "parameters": [ + { + "name": "info", + "$ref": "ExtensionInfo" + } + ] + }, + { + "name": "onEnabled", + "type": "function", + "permissions": ["management"], + "description": "Fired when an addon has been enabled.", + "parameters": [ + { + "name": "info", + "$ref": "ExtensionInfo" + } + ] + }, + { + "name": "onInstalled", + "type": "function", + "permissions": ["management"], + "description": "Fired when an addon has been installed.", + "parameters": [ + { + "name": "info", + "$ref": "ExtensionInfo" + } + ] + }, + { + "name": "onUninstalled", + "type": "function", + "permissions": ["management"], + "description": "Fired when an addon has been uninstalled.", + "parameters": [ + { + "name": "info", + "$ref": "ExtensionInfo" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/manifest.json b/toolkit/components/extensions/schemas/manifest.json new file mode 100644 index 0000000000..14f78ba564 --- /dev/null +++ b/toolkit/components/extensions/schemas/manifest.json @@ -0,0 +1,782 @@ +[ + { + "namespace": "manifest", + "permissions": [], + "types": [ + { + "id": "ManifestBase", + "type": "object", + "description": "Common properties for all manifest.json files", + "properties": { + "manifest_version": { + "type": "integer", + "minimum": 2, + "maximum": 3, + "postprocess": "manifestVersionCheck" + }, + + "applications": { + "$ref": "DeprecatedApplications", + "description": "The applications property is deprecated, please use 'browser_specific_settings'", + "optional": true, + "max_manifest_version": 2 + }, + + "browser_specific_settings": { + "$ref": "BrowserSpecificSettings", + "optional": true + }, + + "name": { + "type": "string", + "optional": false, + "preprocess": "localize" + }, + + "short_name": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + + "description": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + + "author": { + "type": "string", + "optional": true, + "preprocess": "localize", + "onError": "warn" + }, + + "version": { + "type": "string", + "optional": false, + "format": "versionString" + }, + + "homepage_url": { + "type": "string", + "format": "url", + "optional": true, + "preprocess": "localize" + }, + + "install_origins": { + "type": "array", + "optional": true, + "items": { + "type": "string", + "format": "origin" + } + }, + + "developer": { + "type": "object", + "optional": true, + "properties": { + "name": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + "url": { + "type": "string", + "format": "url", + "optional": true, + "preprocess": "localize", + "onError": "warn" + } + } + } + } + }, + { + "id": "WebExtensionManifest", + "type": "object", + "description": "Represents a WebExtension manifest.json file", + + "$import": "ManifestBase", + "properties": { + "minimum_chrome_version": { + "type": "string", + "optional": true + }, + + "minimum_opera_version": { + "type": "string", + "optional": true + }, + + "icons": { + "type": "object", + "optional": true, + "patternProperties": { + "^[1-9]\\d*$": { "$ref": "ExtensionFileUrl" } + } + }, + + "incognito": { + "type": "string", + "enum": ["not_allowed", "spanning"], + "default": "spanning", + "optional": true + }, + + "background": { + "choices": [ + { + "type": "object", + "properties": { + "page": { "$ref": "ExtensionURL" }, + "persistent": { + "optional": true, + "type": "boolean", + "max_manifest_version": 2, + "default": true + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + }, + { + "type": "object", + "properties": { + "scripts": { + "type": "array", + "items": { "$ref": "ExtensionURL" } + }, + "type": { + "optional": true, + "type": "string", + "enum": ["module", "classic"] + }, + "persistent": { + "optional": true, + "type": "boolean", + "max_manifest_version": 2, + "default": true + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + }, + { + "type": "object", + "properties": { + "service_worker": { "$ref": "ExtensionURL" } + }, + "postprocess": "requireBackgroundServiceWorkerEnabled" + } + ], + "optional": true + }, + + "options_ui": { + "type": "object", + + "optional": true, + + "properties": { + "page": { "$ref": "ExtensionURL" }, + "browser_style": { + "type": "boolean", + "optional": true, + "description": "Defaults to true in Manifest V2; Deprecated in Manifest V3." + }, + "chrome_style": { + "type": "boolean", + "optional": true, + "max_manifest_version": 2, + "description": "chrome_style is ignored in Firefox. Its replacement (browser_style) has been deprecated." + }, + "open_in_tab": { + "type": "boolean", + "optional": true + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + }, + + "content_scripts": { + "type": "array", + "optional": true, + "items": { "$ref": "ContentScript" } + }, + + "content_security_policy": { + "optional": true, + "onError": "warn", + "choices": [ + { + "max_manifest_version": 2, + "type": "string", + "format": "contentSecurityPolicy" + }, + { + "min_manifest_version": 3, + "type": "object", + "additionalProperties": { + "$ref": "UnrecognizedProperty" + }, + "properties": { + "extension_pages": { + "type": "string", + "optional": true, + "format": "contentSecurityPolicy", + "description": "The Content Security Policy used for extension pages." + } + } + } + ] + }, + + "permissions": { + "default": [], + "optional": true, + "choices": [ + { + "max_manifest_version": 2, + "type": "array", + "items": { + "$ref": "PermissionOrOrigin", + "onError": "warn" + } + }, + { + "min_manifest_version": 3, + "type": "array", + "items": { + "$ref": "Permission", + "onError": "warn" + } + } + ] + }, + + "granted_host_permissions": { + "type": "boolean", + "optional": true, + "default": false + }, + + "host_permissions": { + "min_manifest_version": 3, + "type": "array", + "items": { + "$ref": "MatchPattern", + "onError": "warn" + }, + "optional": true, + "default": [] + }, + + "optional_permissions": { + "type": "array", + "items": { + "$ref": "OptionalPermissionOrOrigin", + "onError": "warn" + }, + "optional": true, + "default": [] + }, + + "web_accessible_resources": { + "optional": true, + "choices": [ + { + "max_manifest_version": 2, + "type": "array", + "items": { "type": "string" } + }, + { + "min_manifest_version": 3, + "type": "array", + "postprocess": "webAccessibleMatching", + "items": { + "type": "object", + "properties": { + "resources": { + "type": "array", + "items": { "type": "string" } + }, + "matches": { + "optional": true, + "type": "array", + "items": { "$ref": "MatchPattern" } + }, + "extension_ids": { + "optional": true, + "type": "array", + "items": { + "choices": [ + { "$ref": "ExtensionID" }, + { "type": "string", "enum": ["*"] } + ] + } + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + } + } + ] + }, + + "hidden": { + "type": "boolean", + "optional": true, + "default": false + } + }, + + "additionalProperties": { "$ref": "UnrecognizedProperty" } + }, + { + "id": "WebExtensionLangpackManifest", + "type": "object", + "description": "Represents a WebExtension language pack manifest.json file", + + "$import": "ManifestBase", + "properties": { + "langpack_id": { + "type": "string", + "pattern": "^[a-zA-Z][a-zA-Z-]+$" + }, + + "languages": { + "type": "object", + "patternProperties": { + "^[a-z]{2}[a-zA-Z-]*$": { + "type": "object", + "properties": { + "chrome_resources": { + "type": "object", + "patternProperties": { + "^[a-zA-Z-.]+$": { + "choices": [ + { + "$ref": "ExtensionURL" + }, + { + "type": "object", + "patternProperties": { + "^[a-z]+$": { + "$ref": "ExtensionURL" + } + } + } + ] + } + } + }, + "version": { + "type": "string" + } + } + } + } + }, + "sources": { + "type": "object", + "optional": true, + "patternProperties": { + "^[a-z]+$": { + "type": "object", + "properties": { + "base_path": { + "$ref": "ExtensionURL" + }, + "paths": { + "type": "array", + "items": { + "type": "string", + "format": "strictRelativeUrl" + }, + "optional": true + } + } + } + } + } + } + }, + { + "id": "WebExtensionDictionaryManifest", + "type": "object", + "description": "Represents a WebExtension dictionary manifest.json file", + + "$import": "ManifestBase", + "properties": { + "dictionaries": { + "type": "object", + "patternProperties": { + "^[a-z]{2}[a-zA-Z-]*$": { + "type": "string", + "format": "strictRelativeUrl", + "pattern": "\\.dic$" + } + } + } + } + }, + { + "id": "WebExtensionSitePermissionsManifest", + "type": "object", + "description": "Represents a WebExtension site permissions manifest.json file", + + "$import": "ManifestBase", + "properties": { + "site_permissions": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "SitePermission" + } + }, + "install_origins": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "format": "origin" + } + } + } + }, + { + "id": "ThemeIcons", + "type": "object", + "properties": { + "light": { + "$ref": "ExtensionURL", + "description": "A light icon to use for dark themes" + }, + "dark": { + "$ref": "ExtensionURL", + "description": "The dark icon to use for light themes" + }, + "size": { + "type": "integer", + "description": "The size of the icons" + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + }, + { + "id": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["idle"] + } + ] + }, + { + "id": "OptionalPermission", + "choices": [ + { "$ref": "OptionalPermissionNoPrompt" }, + { + "type": "string", + "enum": [ + "clipboardRead", + "clipboardWrite", + "geolocation", + "notifications" + ] + } + ] + }, + { + "id": "OptionalPermissionOrOrigin", + "choices": [ + { "$ref": "OptionalPermission" }, + { "$ref": "MatchPattern" } + ] + }, + { + "id": "PermissionPrivileged", + "choices": [ + { + "type": "string", + "enum": ["mozillaAddons"] + } + ] + }, + { + "id": "PermissionNoPrompt", + "choices": [ + { "$ref": "OptionalPermissionNoPrompt" }, + { "$ref": "PermissionPrivileged" }, + { + "type": "string", + "enum": ["alarms", "storage", "unlimitedStorage"] + } + ] + }, + { + "id": "Permission", + "choices": [ + { "$ref": "PermissionNoPrompt" }, + { "$ref": "OptionalPermission" } + ] + }, + { + "id": "PermissionOrOrigin", + "choices": [{ "$ref": "Permission" }, { "$ref": "MatchPattern" }] + }, + { + "id": "SitePermission", + "choices": [ + { + "type": "string", + "enum": ["midi", "midi-sysex"] + } + ] + }, + { + "id": "HttpURL", + "type": "string", + "format": "url", + "pattern": "^https?://.*$" + }, + { + "id": "ExtensionURL", + "type": "string", + "format": "strictRelativeUrl" + }, + { + "id": "ExtensionFileUrl", + "type": "string", + "format": "strictRelativeUrl", + "pattern": "\\S", + "preprocess": "localize" + }, + { + "id": "ImageDataOrExtensionURL", + "type": "string", + "format": "imageDataOrStrictRelativeUrl" + }, + { + "id": "ExtensionID", + "choices": [ + { + "type": "string", + "pattern": "(?i)^\\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\\}$" + }, + { + "type": "string", + "pattern": "(?i)^[a-z0-9-._]*@[a-z0-9-._]+$" + } + ] + }, + { + "id": "FirefoxSpecificProperties", + "type": "object", + "properties": { + "id": { + "$ref": "ExtensionID", + "optional": true + }, + + "update_url": { + "type": "string", + "format": "url", + "optional": true + }, + + "strict_min_version": { + "type": "string", + "optional": true + }, + + "strict_max_version": { + "type": "string", + "optional": true + } + } + }, + { + "id": "GeckoAndroidSpecificProperties", + "type": "object", + "properties": { + "strict_min_version": { + "type": "string", + "optional": true + }, + "strict_max_version": { + "type": "string", + "optional": true + } + }, + "additionalProperties": { "type": "any" } + }, + { + "id": "DeprecatedApplications", + "type": "object", + "properties": { + "gecko": { + "$ref": "FirefoxSpecificProperties", + "optional": true + }, + "gecko_android": { + "$ref": "GeckoAndroidSpecificProperties", + "optional": true, + "unsupported": true + } + }, + "additionalProperties": { "type": "any" } + }, + { + "id": "BrowserSpecificSettings", + "type": "object", + "properties": { + "gecko": { + "$ref": "FirefoxSpecificProperties", + "optional": true + }, + "gecko_android": { + "$ref": "GeckoAndroidSpecificProperties", + "optional": true + } + }, + "additionalProperties": { "type": "any" } + }, + { + "id": "MatchPattern", + "choices": [ + { + "type": "string", + "enum": ["<all_urls>"] + }, + { + "$ref": "MatchPatternRestricted" + }, + { + "$ref": "MatchPatternUnestricted" + } + ] + }, + { + "id": "MatchPatternRestricted", + "description": "Same as MatchPattern above, but excludes <all_urls>", + "choices": [ + { + "type": "string", + "pattern": "^(https?|wss?|file|ftp|\\*)://(\\*|\\*\\.[^*/]+|[^*/]+)/.*$" + }, + { + "type": "string", + "pattern": "^file:///.*$" + } + ] + }, + { + "id": "MatchPatternUnestricted", + "description": "Mostly unrestricted match patterns for privileged add-ons. This should technically be rejected for unprivileged add-ons, but, reasons. The MatchPattern class will still refuse privileged schemes for those extensions.", + "choices": [ + { + "type": "string", + "pattern": "^resource://(\\*|\\*\\.[^*/]+|[^*/]+)/.*$|^about:" + } + ] + }, + { + "id": "ContentScript", + "type": "object", + "description": "Details of the script or CSS to inject. Either the code or the file property must be set, but both may not be set at the same time. Based on InjectDetails, but using underscore rather than camel case naming conventions.", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "matches": { + "type": "array", + "optional": false, + "minItems": 1, + "items": { "$ref": "MatchPattern" } + }, + "exclude_matches": { + "type": "array", + "optional": true, + "minItems": 1, + "items": { "$ref": "MatchPattern" } + }, + "include_globs": { + "type": "array", + "optional": true, + "items": { "type": "string" } + }, + "exclude_globs": { + "type": "array", + "optional": true, + "items": { "type": "string" } + }, + "css": { + "type": "array", + "optional": true, + "description": "The list of CSS files to inject", + "items": { "$ref": "ExtensionURL" } + }, + "js": { + "type": "array", + "optional": true, + "description": "The list of JS files to inject", + "items": { "$ref": "ExtensionURL" } + }, + "all_frames": { + "type": "boolean", + "optional": true, + "description": "If allFrames is <code>true</code>, implies that the JavaScript or CSS should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame." + }, + "match_about_blank": { + "type": "boolean", + "optional": true, + "description": "If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>." + }, + "run_at": { + "$ref": "extensionTypes.RunAt", + "optional": true, + "default": "document_idle", + "description": "The soonest that the JavaScript or CSS will be injected into the tab. Defaults to \"document_idle\"." + } + } + }, + { + "id": "IconPath", + "choices": [ + { + "type": "object", + "patternProperties": { + "^[1-9]\\d*$": { "$ref": "ExtensionFileUrl" } + }, + "additionalProperties": false + }, + { "$ref": "ExtensionFileUrl" } + ] + }, + { + "id": "IconImageData", + "choices": [ + { + "type": "object", + "patternProperties": { + "^[1-9]\\d*$": { "$ref": "ImageData" } + }, + "additionalProperties": false + }, + { "$ref": "ImageData" } + ] + }, + { + "id": "ImageData", + "type": "object", + "isInstanceOf": "ImageData", + "postprocess": "convertImageDataToURL" + }, + { + "id": "UnrecognizedProperty", + "type": "any", + "deprecated": "An unexpected property was found in the WebExtension manifest." + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/moz.build b/toolkit/components/extensions/schemas/moz.build new file mode 100644 index 0000000000..d988c0ff9b --- /dev/null +++ b/toolkit/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/toolkit/components/extensions/schemas/native_manifest.json b/toolkit/components/extensions/schemas/native_manifest.json new file mode 100644 index 0000000000..b08262e59b --- /dev/null +++ b/toolkit/components/extensions/schemas/native_manifest.json @@ -0,0 +1,60 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "id": "NativeManifest", + "description": "Represents a native manifest file", + "choices": [ + { + "type": "object", + "properties": { + "name": { + "type": "string", + "pattern": "^\\w+(\\.\\w+)*$" + }, + "description": { + "type": "string" + }, + "path": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["pkcs11", "stdio"] + }, + "allowed_extensions": { + "type": "array", + "minItems": 1, + "items": { + "$ref": "manifest.ExtensionID" + } + } + } + }, + { + "type": "object", + "properties": { + "name": { + "$ref": "manifest.ExtensionID" + }, + "description": { + "type": "string" + }, + "data": { + "type": "object", + "additionalProperties": { + "type": "any" + } + }, + "type": { + "type": "string", + "enum": ["storage"] + } + } + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/network_status.json b/toolkit/components/extensions/schemas/network_status.json new file mode 100644 index 0000000000..bf2c9cb494 --- /dev/null +++ b/toolkit/components/extensions/schemas/network_status.json @@ -0,0 +1,66 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionPrivileged", + "choices": [ + { + "type": "string", + "enum": ["networkStatus"] + } + ] + } + ] + }, + { + "namespace": "networkStatus", + "description": "This API provides the ability to determine the status of and detect changes in the network connection. This API can only be used in privileged extensions.", + "permissions": ["networkStatus"], + "types": [ + { + "id": "NetworkLinkInfo", + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": ["unknown", "up", "down"], + "description": "Status of the network link, if \"unknown\" then link is usually assumed to be \"up\"" + }, + "type": { + "type": "string", + "enum": ["unknown", "ethernet", "usb", "wifi", "wimax", "mobile"], + "description": "If known, the type of network connection that is avialable." + }, + "id": { + "type": "string", + "optional": true, + "description": "If known, the network id or name." + } + } + } + ], + "functions": [ + { + "name": "getLinkInfo", + "type": "function", + "description": "Returns the $(ref:NetworkLinkInfo} of the current network connection.", + "async": true, + "parameters": [] + } + ], + "events": [ + { + "name": "onConnectionChanged", + "type": "function", + "description": "Fired when the network connection state changes.", + "parameters": [ + { + "name": "details", + "$ref": "NetworkLinkInfo" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/notifications.json b/toolkit/components/extensions/schemas/notifications.json new file mode 100644 index 0000000000..30ba8a2765 --- /dev/null +++ b/toolkit/components/extensions/schemas/notifications.json @@ -0,0 +1,420 @@ +// 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 file. + +[ + { + "namespace": "notifications", + "permissions": ["notifications"], + "types": [ + { + "id": "TemplateType", + "type": "string", + "enum": ["basic", "image", "list", "progress"] + }, + { + "id": "PermissionLevel", + "type": "string", + "enum": ["granted", "denied"] + }, + { + "id": "NotificationItem", + "type": "object", + "properties": { + "title": { + "description": "Title of one item of a list notification.", + "type": "string" + }, + "message": { + "description": "Additional details about this item.", + "type": "string" + } + } + }, + { + "id": "CreateNotificationOptions", + "type": "object", + "properties": { + "type": { + "description": "Which type of notification to display.", + "$ref": "TemplateType" + }, + "iconUrl": { + "optional": true, + "description": "A URL to the sender's avatar, app icon, or a thumbnail for image notifications.", + "type": "string" + }, + "appIconMaskUrl": { + "optional": true, + "description": "A URL to the app icon mask.", + "type": "string" + }, + "title": { + "description": "Title of the notification (e.g. sender name for email).", + "type": "string" + }, + "message": { + "description": "Main notification content.", + "type": "string" + }, + "contextMessage": { + "optional": true, + "description": "Alternate notification content with a lower-weight font.", + "type": "string" + }, + "priority": { + "optional": true, + "description": "Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default.", + "type": "integer", + "minimum": -2, + "maximum": 2 + }, + "eventTime": { + "optional": true, + "description": "A timestamp associated with the notification, in milliseconds past the epoch.", + "type": "number" + }, + "buttons": { + "unsupported": true, + "optional": true, + "description": "Text and icons for up to two notification action buttons.", + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "iconUrl": { + "optional": true, + "type": "string" + } + } + } + }, + "imageUrl": { + "optional": true, + "description": "A URL to the image thumbnail for image-type notifications.", + "type": "string" + }, + "items": { + "optional": true, + "description": "Items for multi-item notifications.", + "type": "array", + "items": { "$ref": "NotificationItem" } + }, + "progress": { + "optional": true, + "description": "Current progress ranges from 0 to 100.", + "type": "integer", + "minimum": 0, + "maximum": 100 + }, + "isClickable": { + "optional": true, + "description": "Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.", + "type": "boolean" + } + } + }, + { + "id": "UpdateNotificationOptions", + "type": "object", + "properties": { + "type": { + "optional": true, + "description": "Which type of notification to display.", + "$ref": "TemplateType" + }, + "iconUrl": { + "optional": true, + "description": "A URL to the sender's avatar, app icon, or a thumbnail for image notifications.", + "type": "string" + }, + "appIconMaskUrl": { + "optional": true, + "description": "A URL to the app icon mask.", + "type": "string" + }, + "title": { + "optional": true, + "description": "Title of the notification (e.g. sender name for email).", + "type": "string" + }, + "message": { + "optional": true, + "description": "Main notification content.", + "type": "string" + }, + "contextMessage": { + "optional": true, + "description": "Alternate notification content with a lower-weight font.", + "type": "string" + }, + "priority": { + "optional": true, + "description": "Priority ranges from -2 to 2. -2 is lowest priority. 2 is highest. Zero is default.", + "type": "integer", + "minimum": -2, + "maximum": 2 + }, + "eventTime": { + "optional": true, + "description": "A timestamp associated with the notification, in milliseconds past the epoch.", + "type": "number" + }, + "buttons": { + "unsupported": true, + "optional": true, + "description": "Text and icons for up to two notification action buttons.", + "type": "array", + "items": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "iconUrl": { + "optional": true, + "type": "string" + } + } + } + }, + "imageUrl": { + "optional": true, + "description": "A URL to the image thumbnail for image-type notifications.", + "type": "string" + }, + "items": { + "optional": true, + "description": "Items for multi-item notifications.", + "type": "array", + "items": { "$ref": "NotificationItem" } + }, + "progress": { + "optional": true, + "description": "Current progress ranges from 0 to 100.", + "type": "integer", + "minimum": 0, + "maximum": 100 + }, + "isClickable": { + "optional": true, + "description": "Whether to show UI indicating that the app will visibly respond to clicks on the body of a notification.", + "type": "boolean" + } + } + } + ], + "functions": [ + { + "name": "create", + "type": "function", + "description": "Creates and displays a notification.", + "async": "callback", + "parameters": [ + { + "optional": true, + "type": "string", + "name": "notificationId", + "description": "Identifier of the notification. If it is empty, this method generates an id. If it matches an existing notification, this method first clears that notification before proceeding with the create operation." + }, + { + "$ref": "CreateNotificationOptions", + "name": "options", + "description": "Contents of the notification." + }, + { + "optional": true, + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "notificationId", + "type": "string", + "description": "The notification id (either supplied or generated) that represents the created notification." + } + ] + } + ] + }, + { + "name": "update", + "unsupported": true, + "type": "function", + "description": "Updates an existing notification.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "notificationId", + "description": "The id of the notification to be updated." + }, + { + "$ref": "UpdateNotificationOptions", + "name": "options", + "description": "Contents of the notification to update to." + }, + { + "optional": true, + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "wasUpdated", + "type": "boolean", + "description": "Indicates whether a matching notification existed." + } + ] + } + ] + }, + { + "name": "clear", + "type": "function", + "description": "Clears an existing notification.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "notificationId", + "description": "The id of the notification to be updated." + }, + { + "optional": true, + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "wasCleared", + "type": "boolean", + "description": "Indicates whether a matching notification existed." + } + ] + } + ] + }, + { + "name": "getAll", + "type": "function", + "description": "Retrieves all the notifications.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "notifications", + "type": "object", + "additionalProperties": { "$ref": "CreateNotificationOptions" }, + "description": "The set of notifications currently in the system." + } + ] + } + ] + }, + { + "name": "getPermissionLevel", + "unsupported": true, + "type": "function", + "description": "Retrieves whether the user has enabled notifications from this app or extension.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "level", + "$ref": "PermissionLevel", + "description": "The current permission level." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onClosed", + "type": "function", + "description": "Fired when the notification closed, either by the system or by user action.", + "parameters": [ + { + "type": "string", + "name": "notificationId", + "description": "The notificationId of the closed notification." + }, + { + "type": "boolean", + "name": "byUser", + "description": "True if the notification was closed by the user." + } + ] + }, + { + "name": "onClicked", + "type": "function", + "description": "Fired when the user clicked in a non-button area of the notification.", + "parameters": [ + { + "type": "string", + "name": "notificationId", + "description": "The notificationId of the clicked notification." + } + ] + }, + { + "name": "onButtonClicked", + "type": "function", + "description": "Fired when the user pressed a button in the notification.", + "parameters": [ + { + "type": "string", + "name": "notificationId", + "description": "The notificationId of the clicked notification." + }, + { + "type": "number", + "name": "buttonIndex", + "description": "The index of the button clicked by the user." + } + ] + }, + { + "name": "onPermissionLevelChanged", + "unsupported": true, + "type": "function", + "description": "Fired when the user changes the permission level.", + "parameters": [ + { + "$ref": "PermissionLevel", + "name": "level", + "description": "The new permission level." + } + ] + }, + { + "name": "onShowSettings", + "unsupported": true, + "type": "function", + "description": "Fired when the user clicked on a link for the app's notification settings.", + "parameters": [] + }, + { + "name": "onShown", + "type": "function", + "description": "Fired when the notification is shown.", + "parameters": [ + { + "type": "string", + "name": "notificationId", + "description": "The notificationId of the shown notification." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/page_action.json b/toolkit/components/extensions/schemas/page_action.json new file mode 100644 index 0000000000..85b76bc57f --- /dev/null +++ b/toolkit/components/extensions/schemas/page_action.json @@ -0,0 +1,333 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "page_action": { + "type": "object", + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "default_title": { + "type": "string", + "optional": true, + "preprocess": "localize" + }, + "default_icon": { + "$ref": "IconPath", + "optional": true + }, + "default_popup": { + "type": "string", + "format": "relativeUrl", + "optional": true, + "preprocess": "localize" + }, + "browser_style": { + "type": "boolean", + "optional": true, + "description": "Deprecated in Manifest V3." + }, + "show_matches": { + "type": "array", + "optional": true, + "minItems": 1, + "items": { "$ref": "MatchPattern" } + }, + "hide_matches": { + "type": "array", + "optional": true, + "minItems": 1, + "items": { "$ref": "MatchPatternRestricted" } + }, + "pinned": { + "type": "boolean", + "optional": true, + "default": true + } + }, + "optional": true + } + } + } + ] + }, + { + "namespace": "pageAction", + "description": "Use the <code>browser.pageAction</code> API to put icons inside the address bar. Page actions represent actions that can be taken on the current page, but that aren't applicable to all pages.", + "permissions": ["manifest:page_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)." + }, + { + "id": "OnClickData", + "type": "object", + "description": "Information sent when a page action is clicked.", + "properties": { + "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." + } + } + } + ], + "functions": [ + { + "name": "show", + "type": "function", + "async": "callback", + "description": "Shows the page action. The page action is shown whenever the tab is selected.", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "description": "The id of the tab for which you want to modify the page action." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "hide", + "type": "function", + "async": "callback", + "description": "Hides the page action.", + "parameters": [ + { + "type": "integer", + "name": "tabId", + "minimum": 0, + "description": "The id of the tab for which you want to modify the page action." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "isShown", + "type": "function", + "description": "Checks whether the page action is shown.", + "async": true, + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "description": "Specify the tab to get the shownness from." + } + } + } + ] + }, + { + "name": "setTitle", + "type": "function", + "description": "Sets the title of the page action. This is displayed in a tooltip over the page action.", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The id of the tab for which you want to modify the page action." + }, + "title": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "The tooltip string." + } + } + } + ] + }, + { + "name": "getTitle", + "type": "function", + "description": "Gets the title of the page action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "description": "Specify the tab to get the title from." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "setIcon", + "type": "function", + "description": "Sets the icon for the page 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 <b>path</b> or the <b>imageData</b> property must be specified.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The id of the tab for which you want to modify the page action." + }, + "imageData": { + "choices": [ + { "$ref": "ImageDataType" }, + { + "type": "object", + "patternProperties": { + "^[1-9]\\d*$": { "$ref": "ImageDataType" } + } + } + ], + "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", + "patternProperties": { + "^[1-9]\\d*$": { "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}'" + } + } + }, + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "setPopup", + "type": "function", + "async": true, + "description": "Sets the html document to be opened as a popup when the user clicks on the page action's icon.", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The id of the tab for which you want to modify the page action." + }, + "popup": { + "choices": [{ "type": "string" }, { "type": "null" }], + "description": "The html file to show in a popup. If set to the empty string (''), no popup is shown." + } + } + } + ] + }, + { + "name": "getPopup", + "type": "function", + "description": "Gets the html document set as the popup for this page action.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "properties": { + "tabId": { + "type": "integer", + "description": "Specify the tab to get the popup from." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "result", + "type": "string" + } + ] + } + ] + }, + { + "name": "openPopup", + "type": "function", + "requireUserInput": true, + "description": "Opens the extension page action in the active window.", + "async": true, + "parameters": [] + } + ], + "events": [ + { + "name": "onClicked", + "type": "function", + "description": "Fired when a page action icon is clicked. This event will not fire if the page action has a popup.", + "parameters": [ + { + "name": "tab", + "$ref": "tabs.Tab" + }, + { + "name": "info", + "$ref": "OnClickData", + "optional": true + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/permissions.json b/toolkit/components/extensions/schemas/permissions.json new file mode 100644 index 0000000000..eb66fa7c64 --- /dev/null +++ b/toolkit/components/extensions/schemas/permissions.json @@ -0,0 +1,150 @@ +[ + { + "namespace": "permissions", + "types": [ + { + "id": "Permissions", + "type": "object", + "properties": { + "permissions": { + "type": "array", + "items": { "$ref": "manifest.OptionalPermission" }, + "optional": true, + "default": [] + }, + "origins": { + "type": "array", + "items": { "$ref": "manifest.MatchPattern" }, + "optional": true, + "default": [] + } + } + }, + { + "id": "AnyPermissions", + "type": "object", + "properties": { + "permissions": { + "type": "array", + "items": { "$ref": "manifest.Permission" }, + "optional": true, + "default": [] + }, + "origins": { + "type": "array", + "items": { "$ref": "manifest.MatchPattern" }, + "optional": true, + "default": [] + } + } + } + ], + "functions": [ + { + "name": "getAll", + "type": "function", + "async": "callback", + "description": "Get a list of all the extension's permissions.", + "parameters": [ + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "permissions", + "$ref": "AnyPermissions" + } + ] + } + ] + }, + { + "name": "contains", + "type": "function", + "async": "callback", + "description": "Check if the extension has the given permissions.", + "parameters": [ + { + "name": "permissions", + "$ref": "AnyPermissions" + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "result", + "type": "boolean" + } + ] + } + ] + }, + { + "name": "request", + "type": "function", + "allowedContexts": ["content"], + "async": "callback", + "requireUserInput": true, + "description": "Request the given permissions.", + "parameters": [ + { + "name": "permissions", + "$ref": "Permissions" + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "granted", + "type": "boolean" + } + ] + } + ] + }, + { + "name": "remove", + "type": "function", + "async": "callback", + "description": "Relinquish the given permissions.", + "parameters": [ + { + "name": "permissions", + "$ref": "Permissions" + }, + { + "name": "callback", + "type": "function", + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onAdded", + "type": "function", + "description": "Fired when the extension acquires new permissions.", + "parameters": [ + { + "name": "permissions", + "$ref": "Permissions" + } + ] + }, + { + "name": "onRemoved", + "type": "function", + "description": "Fired when permissions are removed from the extension.", + "parameters": [ + { + "name": "permissions", + "$ref": "Permissions" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/privacy.json b/toolkit/components/extensions/schemas/privacy.json new file mode 100644 index 0000000000..26dfee98fa --- /dev/null +++ b/toolkit/components/extensions/schemas/privacy.json @@ -0,0 +1,181 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["privacy"] + } + ] + } + ] + }, + { + "namespace": "privacy", + "permissions": ["privacy"] + }, + { + "namespace": "privacy.network", + "description": "Use the <code>browser.privacy</code> API to control usage of the features in the browser that can affect a user's privacy.", + "permissions": ["privacy"], + "types": [ + { + "id": "IPHandlingPolicy", + "type": "string", + "enum": [ + "default", + "default_public_and_private_interfaces", + "default_public_interface_only", + "disable_non_proxied_udp", + "proxy_only" + ], + "description": "The IP handling policy of WebRTC." + }, + { + "id": "tlsVersionRestrictionConfig", + "type": "object", + "description": "An object which describes TLS minimum and maximum versions.", + "properties": { + "minimum": { + "type": "string", + "enum": ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3", "unknown"], + "optional": true, + "description": "The minimum TLS version supported." + }, + "maximum": { + "type": "string", + "enum": ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3", "unknown"], + "optional": true, + "description": "The maximum TLS version supported." + } + } + }, + { + "id": "HTTPSOnlyModeOption", + "type": "string", + "enum": ["always", "private_browsing", "never"], + "description": "The mode for https-only mode." + } + ], + "properties": { + "networkPredictionEnabled": { + "$ref": "types.Setting", + "description": "If enabled, the browser attempts to speed up your web browsing experience by pre-resolving DNS entries, prerendering sites (<code><link rel='prefetch' ...></code>), and preemptively opening TCP and SSL connections to servers. This preference's value is a boolean, defaulting to <code>true</code>." + }, + "peerConnectionEnabled": { + "$ref": "types.Setting", + "description": "Allow users to enable and disable RTCPeerConnections (aka WebRTC)." + }, + "webRTCIPHandlingPolicy": { + "$ref": "types.Setting", + "description": "Allow users to specify the media performance/privacy tradeoffs which impacts how WebRTC traffic will be routed and how much local address information is exposed. This preference's value is of type IPHandlingPolicy, defaulting to <code>default</code>." + }, + "tlsVersionRestriction": { + "$ref": "types.Setting", + "description": "This property controls the minimum and maximum TLS versions. This setting's value is an object of $(ref:tlsVersionRestrictionConfig)." + }, + "httpsOnlyMode": { + "$ref": "types.Setting", + "description": "Allow users to query the mode for 'HTTPS-Only Mode'. This setting's value is of type HTTPSOnlyModeOption, defaulting to <code>never</code>." + }, + "globalPrivacyControl": { + "$ref": "types.Setting", + "description": "Allow users to query the status of 'Global Privacy Control'. This setting's value is of type boolean, defaulting to <code>false</code>." + } + } + }, + { + "namespace": "privacy.services", + "description": "Use the <code>browser.privacy</code> API to control usage of the features in the browser that can affect a user's privacy.", + "permissions": ["privacy"], + "properties": { + "passwordSavingEnabled": { + "$ref": "types.Setting", + "description": "If enabled, the password manager will ask if you want to save passwords. This preference's value is a boolean, defaulting to <code>true</code>." + } + } + }, + { + "namespace": "privacy.websites", + "description": "Use the <code>browser.privacy</code> API to control usage of the features in the browser that can affect a user's privacy.", + "permissions": ["privacy"], + "types": [ + { + "id": "TrackingProtectionModeOption", + "type": "string", + "enum": ["always", "never", "private_browsing"], + "description": "The mode for tracking protection." + }, + { + "id": "CookieConfig", + "type": "object", + "description": "The settings for cookies.", + "properties": { + "behavior": { + "type": "string", + "optional": true, + "enum": [ + "allow_all", + "reject_all", + "reject_third_party", + "allow_visited", + "reject_trackers", + "reject_trackers_and_partition_foreign" + ], + "description": "The type of cookies to allow." + }, + "nonPersistentCookies": { + "type": "boolean", + "optional": true, + "default": false, + "description": "Whether to create all cookies as nonPersistent (i.e., session) cookies.", + "deprecated": "This property has no effect anymore and its value is always <code>false<code>." + } + } + } + ], + "properties": { + "thirdPartyCookiesAllowed": { + "$ref": "types.Setting", + "description": "If disabled, the browser blocks third-party sites from setting cookies. The value of this preference is of type boolean, and the default value is <code>true</code>.", + "unsupported": true + }, + "hyperlinkAuditingEnabled": { + "$ref": "types.Setting", + "description": "If enabled, the browser sends auditing pings when requested by a website (<code><a ping></code>). The value of this preference is of type boolean, and the default value is <code>true</code>." + }, + "referrersEnabled": { + "$ref": "types.Setting", + "description": "If enabled, the browser sends <code>referer</code> headers with your requests. Yes, the name of this preference doesn't match the misspelled header. No, we're not going to change it. The value of this preference is of type boolean, and the default value is <code>true</code>." + }, + "resistFingerprinting": { + "$ref": "types.Setting", + "description": "If enabled, the browser attempts to appear similar to other users by reporting generic information to websites. This can prevent websites from uniquely identifying users. Examples of data that is spoofed include number of CPU cores, precision of JavaScript timers, the local timezone, and disabling features such as GamePad support, and the WebSpeech and Navigator APIs. The value of this preference is of type boolean, and the default value is <code>false</code>." + }, + "firstPartyIsolate": { + "$ref": "types.Setting", + "description": "If enabled, the browser will associate all data (including cookies, HSTS data, cached images, and more) for any third party domains with the domain in the address bar. This prevents third party trackers from using directly stored information to identify you across different websites, but may break websites where you login with a third party account (such as a Facebook or Google login.) The value of this preference is of type boolean, and the default value is <code>false</code>." + }, + "protectedContentEnabled": { + "$ref": "types.Setting", + "description": "<strong>Available on Windows and ChromeOS only</strong>: If enabled, the browser provides a unique ID to plugins in order to run protected content. The value of this preference is of type boolean, and the default value is <code>true</code>.", + "unsupported": true + }, + "trackingProtectionMode": { + "$ref": "types.Setting", + "description": "Allow users to specify the mode for tracking protection. This setting's value is of type TrackingProtectionModeOption, defaulting to <code>private_browsing_only</code>." + }, + "cookieConfig": { + "$ref": "types.Setting", + "description": "Allow users to specify the default settings for allowing cookies, as well as whether all cookies should be created as non-persistent cookies. This setting's value is of type CookieConfig." + } + } + } +] diff --git a/toolkit/components/extensions/schemas/proxy.json b/toolkit/components/extensions/schemas/proxy.json new file mode 100644 index 0000000000..78617c2137 --- /dev/null +++ b/toolkit/components/extensions/schemas/proxy.json @@ -0,0 +1,210 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["proxy"] + } + ] + } + ] + }, + { + "namespace": "proxy", + "description": "Provides access to global proxy settings for Firefox and proxy event listeners to handle dynamic proxy implementations.", + "permissions": ["proxy"], + "types": [ + { + "id": "ProxyConfig", + "type": "object", + "description": "An object which describes proxy settings.", + "properties": { + "proxyType": { + "type": "string", + "optional": true, + "enum": ["none", "autoDetect", "system", "manual", "autoConfig"], + "description": "The type of proxy to use." + }, + "http": { + "type": "string", + "optional": true, + "description": "The address of the http proxy, can include a port." + }, + "httpProxyAll": { + "type": "boolean", + "optional": true, + "description": "Use the http proxy server for all protocols." + }, + "ftp": { + "type": "string", + "optional": true, + "deprecated": true, + "description": "The address of the ftp proxy, can include a port. Deprecated since Firefox 88." + }, + "ssl": { + "type": "string", + "optional": true, + "description": "The address of the ssl proxy, can include a port." + }, + "socks": { + "type": "string", + "optional": true, + "description": "The address of the socks proxy, can include a port." + }, + "socksVersion": { + "type": "integer", + "optional": true, + "description": "The version of the socks proxy.", + "minimum": 4, + "maximum": 5 + }, + "passthrough": { + "type": "string", + "optional": true, + "description": "A list of hosts which should not be proxied." + }, + "autoConfigUrl": { + "type": "string", + "optional": true, + "description": "A URL to use to configure the proxy." + }, + "autoLogin": { + "type": "boolean", + "optional": true, + "description": "Do not prompt for authentication if password is saved." + }, + "proxyDNS": { + "type": "boolean", + "optional": true, + "description": "Proxy DNS when using SOCKS v5." + }, + "respectBeConservative": { + "type": "boolean", + "optional": true, + "default": true, + "description": " If true (the default value), do not use newer TLS protocol features that might have interoperability problems on the Internet. This is intended only for use with critical infrastructure like the updates, and is only available to privileged addons." + } + } + } + ], + "properties": { + "settings": { + "$ref": "types.Setting", + "description": "Configures proxy settings. This setting's value is an object of type ProxyConfig." + } + }, + "events": [ + { + "name": "onRequest", + "type": "function", + "description": "Fired when proxy data is needed for a request.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "webRequest.ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "fromCache": { + "type": "boolean", + "description": "Indicates if this response was fetched from disk cache." + }, + "requestHeaders": { + "$ref": "webRequest.HttpHeaders", + "optional": true, + "description": "The HTTP request headers that are going to be sent out with this request." + }, + "urlClassification": { + "$ref": "webRequest.UrlClassification", + "description": "Url classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "webRequest.RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "type": "string", + "enum": ["requestHeaders"] + } + } + ] + }, + { + "name": "onError", + "type": "function", + "description": "Notifies about errors caused by the invalid use of the proxy API.", + "parameters": [ + { + "name": "error", + "type": "object" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/runtime.json b/toolkit/components/extensions/schemas/runtime.json new file mode 100644 index 0000000000..ea4dbaa97a --- /dev/null +++ b/toolkit/components/extensions/schemas/runtime.json @@ -0,0 +1,683 @@ +// Copyright 2014 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["nativeMessaging"] + } + ] + } + ] + }, + { + "namespace": "runtime", + "allowedContexts": ["content", "devtools"], + "description": "Use the <code>browser.runtime</code> API to retrieve the background page, return details about the manifest, and listen for and respond to events in the app or extension lifecycle. You can also use this API to convert the relative path of URLs to fully-qualified URLs.", + "types": [ + { + "id": "Port", + "type": "object", + "allowedContexts": ["content", "devtools"], + "description": "An object which allows two way communication with other pages.", + "properties": { + "name": { "type": "string" }, + "disconnect": { "type": "function" }, + "onDisconnect": { "$ref": "events.Event" }, + "onMessage": { "$ref": "events.Event" }, + "postMessage": { "type": "function" }, + "sender": { + "$ref": "MessageSender", + "optional": true, + "description": "This property will <b>only</b> be present on ports passed to onConnect/onConnectExternal listeners." + } + }, + "additionalProperties": { "type": "any" } + }, + { + "id": "MessageSender", + "type": "object", + "allowedContexts": ["content", "devtools"], + "description": "An object containing information about the script context that sent a message or request.", + "properties": { + "tab": { + "$ref": "tabs.Tab", + "optional": true, + "description": "The $(ref:tabs.Tab) which opened the connection, if any. This property will <strong>only</strong> be present when the connection was opened from a tab (including content scripts), and <strong>only</strong> if the receiver is an extension, not an app." + }, + "frameId": { + "type": "integer", + "optional": true, + "description": "The $(topic:frame_ids)[frame] that opened the connection. 0 for top-level frames, positive for child frames. This will only be set when <code>tab</code> is set." + }, + "id": { + "type": "string", + "optional": true, + "description": "The ID of the extension or app that opened the connection, if any." + }, + "url": { + "type": "string", + "optional": true, + "description": "The URL of the page or frame that opened the connection. If the sender is in an iframe, it will be iframe's URL not the URL of the page which hosts it." + }, + "tlsChannelId": { + "unsupported": true, + "type": "string", + "optional": true, + "description": "The TLS channel ID of the page or frame that opened the connection, if requested by the extension or app, and if available." + } + } + }, + { + "id": "PlatformOs", + "type": "string", + "allowedContexts": ["content", "devtools"], + "description": "The operating system the browser is running on.", + "enum": ["mac", "win", "android", "cros", "linux", "openbsd"] + }, + { + "id": "PlatformArch", + "type": "string", + "enum": [ + "aarch64", + "arm", + "ppc64", + "s390x", + "sparc64", + "x86-32", + "x86-64", + "noarch" + ], + "allowedContexts": ["content", "devtools"], + "description": "The machine's processor architecture." + }, + { + "id": "PlatformInfo", + "type": "object", + "allowedContexts": ["content", "devtools"], + "description": "An object containing information about the current platform.", + "properties": { + "os": { + "$ref": "PlatformOs", + "description": "The operating system the browser is running on." + }, + "arch": { + "$ref": "PlatformArch", + "description": "The machine's processor architecture." + }, + "nacl_arch": { + "unsupported": true, + "description": "The native client architecture. This may be different from arch on some platforms.", + "$ref": "PlatformNaclArch" + } + } + }, + { + "id": "BrowserInfo", + "type": "object", + "description": "An object containing information about the current browser.", + "properties": { + "name": { + "type": "string", + "description": "The name of the browser, for example 'Firefox'." + }, + "vendor": { + "type": "string", + "description": "The name of the browser vendor, for example 'Mozilla'." + }, + "version": { + "type": "string", + "description": "The browser's version, for example '42.0.0' or '0.8.1pre'." + }, + "buildID": { + "type": "string", + "description": "The browser's build ID/date, for example '20160101'." + } + } + }, + { + "id": "RequestUpdateCheckStatus", + "type": "string", + "enum": ["throttled", "no_update", "update_available"], + "allowedContexts": ["content", "devtools"], + "description": "Result of the update check." + }, + { + "id": "OnInstalledReason", + "type": "string", + "enum": ["install", "update", "browser_update"], + "allowedContexts": ["content", "devtools"], + "description": "The reason that this event is being dispatched." + }, + { + "id": "OnRestartRequiredReason", + "type": "string", + "allowedContexts": ["content", "devtools"], + "description": "The reason that the event is being dispatched. 'app_update' is used when the restart is needed because the application is updated to a newer version. 'os_update' is used when the restart is needed because the browser/OS is updated to a newer version. 'periodic' is used when the system runs for more than the permitted uptime set in the enterprise policy.", + "enum": ["app_update", "os_update", "periodic"] + } + ], + "properties": { + "lastError": { + "type": "object", + "optional": true, + "allowedContexts": ["content", "devtools"], + "description": "This will be defined during an API method callback if there was an error", + "properties": { + "message": { + "optional": true, + "type": "string", + "description": "Details about the error which occurred." + } + }, + "additionalProperties": { + "type": "any" + } + }, + "id": { + "type": "string", + "allowedContexts": ["content", "devtools"], + "description": "The ID of the extension/app." + } + }, + "functions": [ + { + "name": "getBackgroundPage", + "type": "function", + "description": "Retrieves the JavaScript 'window' object for the background page running inside the current extension/app. If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "backgroundPage", + "optional": true, + "type": "object", + "isInstanceOf": "Window", + "additionalProperties": { "type": "any" }, + "description": "The JavaScript 'window' object for the background page." + } + ] + } + ] + }, + { + "name": "openOptionsPage", + "type": "function", + "description": "<p>Open your Extension's options page, if possible.</p><p>The precise behavior may depend on your manifest's <code>$(topic:optionsV2)[options_ui]</code> or <code>$(topic:options)[options_page]</code> key, or what the browser happens to support at the time.</p><p>If your Extension does not declare an options page, or the browser failed to create one for some other reason, the callback will set $(ref:lastError).</p>", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [], + "optional": true + } + ] + }, + { + "name": "getManifest", + "allowedContexts": ["content", "devtools"], + "description": "Returns details about the app or extension from the manifest. The object returned is a serialization of the full $(topic:manifest)[manifest file].", + "type": "function", + "parameters": [], + "returns": { + "type": "object", + "properties": {}, + "additionalProperties": { "type": "any" }, + "description": "The manifest details." + } + }, + { + "name": "getURL", + "type": "function", + "allowedContexts": ["content", "devtools"], + "description": "Converts a relative path within an app/extension install directory to a fully-qualified URL.", + "parameters": [ + { + "type": "string", + "name": "path", + "description": "A path to a resource within an app/extension expressed relative to its install directory." + } + ], + "returns": { + "type": "string", + "description": "The fully-qualified URL to the resource." + } + }, + { + "name": "getFrameId", + "type": "function", + "allowedContexts": ["content", "devtools"], + "description": "Get the frameId of any window global or frame element.", + "parameters": [ + { + "type": "any", + "name": "target", + "description": "A WindowProxy or a Browsing Context container element (IFrame, Frame, Embed, Object) for the target frame." + } + ], + "allowCrossOriginArguments": true, + "returns": { + "type": "number", + "description": "The frameId of the target frame, or -1 if it doesn't exist." + } + }, + { + "name": "setUninstallURL", + "type": "function", + "description": "Sets the URL to be visited upon uninstallation. This may be used to clean up server-side data, do analytics, and implement surveys. Maximum 255 characters.", + "async": "callback", + "parameters": [ + { + "type": "string", + "name": "url", + "optional": true, + "maxLength": 255, + "description": "URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme. Set an empty string to not open a new tab upon uninstallation." + }, + { + "type": "function", + "name": "callback", + "optional": true, + "description": "Called when the uninstall URL is set. If the given URL is invalid, $(ref:runtime.lastError) will be set.", + "parameters": [] + } + ] + }, + { + "name": "reload", + "description": "Reloads the app or extension.", + "type": "function", + "parameters": [] + }, + { + "name": "requestUpdateCheck", + "unsupported": true, + "type": "function", + "description": "Requests an update check for this app/extension.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "status", + "$ref": "RequestUpdateCheckStatus", + "description": "Result of the update check." + }, + { + "name": "details", + "type": "object", + "optional": true, + "properties": { + "version": { + "type": "string", + "description": "The version of the available update." + } + }, + "description": "If an update is available, this contains more information about the available update." + } + ] + } + ] + }, + { + "name": "restart", + "unsupported": true, + "description": "Restart the device when the app runs in kiosk mode. Otherwise, it's no-op.", + "type": "function", + "parameters": [] + }, + { + "name": "connect", + "type": "function", + "allowedContexts": ["content", "devtools"], + "description": "Attempts to connect to connect listeners within an extension/app (such as the background page), or other extensions/apps. This is useful for content scripts connecting to their extension processes, inter-app/extension communication, and $(topic:manifest/externally_connectable)[web messaging]. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via $(ref:tabs.connect).", + "parameters": [ + { + "type": "string", + "name": "extensionId", + "optional": true, + "description": "The ID of the extension or app to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for $(topic:manifest/externally_connectable)[web messaging]." + }, + { + "type": "object", + "name": "connectInfo", + "properties": { + "name": { + "type": "string", + "optional": true, + "description": "Will be passed into onConnect for processes that are listening for the connection event." + }, + "includeTlsChannelId": { + "type": "boolean", + "optional": true, + "description": "Whether the TLS channel ID will be passed into onConnectExternal for processes that are listening for the connection event." + } + }, + "optional": true + } + ], + "returns": { + "$ref": "Port", + "description": "Port through which messages can be sent and received. The port's $(ref:runtime.Port onDisconnect) event is fired if the extension/app does not exist. " + } + }, + { + "name": "connectNative", + "type": "function", + "description": "Connects to a native application in the host machine.", + "allowedContexts": ["content"], + "permissions": ["nativeMessaging"], + "parameters": [ + { + "type": "string", + "pattern": "^\\w+(\\.\\w+)*$", + "name": "application", + "description": "The name of the registered application to connect to." + } + ], + "returns": { + "$ref": "Port", + "description": "Port through which messages can be sent and received with the application" + } + }, + { + "name": "sendMessage", + "type": "function", + "allowAmbiguousOptionalArguments": true, + "allowedContexts": ["content", "devtools"], + "description": "Sends a single message to event listeners within your extension/app or a different extension/app. Similar to $(ref:runtime.connect) but only sends a single message, with an optional response. If sending to your extension, the $(ref:runtime.onMessage) event will be fired in each page, or $(ref:runtime.onMessageExternal), if a different extension. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use $(ref:tabs.sendMessage).", + "async": "responseCallback", + "parameters": [ + { + "type": "string", + "name": "extensionId", + "optional": true, + "description": "The ID of the extension/app to send the message to. If omitted, the message will be sent to your own extension/app. Required if sending messages from a web page for $(topic:manifest/externally_connectable)[web messaging]." + }, + { "type": "any", "name": "message" }, + { + "type": "object", + "name": "options", + "properties": { + "includeTlsChannelId": { + "type": "boolean", + "optional": true, + "unsupported": true, + "description": "Whether the TLS channel ID will be passed into onMessageExternal for processes that are listening for the connection event." + } + }, + "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 extension, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message." + } + ] + } + ] + }, + { + "name": "sendNativeMessage", + "type": "function", + "description": "Send a single message to a native application.", + "allowedContexts": ["content"], + "permissions": ["nativeMessaging"], + "async": "responseCallback", + "parameters": [ + { + "name": "application", + "description": "The name of the native messaging host.", + "type": "string", + "pattern": "^\\w+(\\.\\w+)*$" + }, + { + "name": "message", + "description": "The message that will be passed to the native messaging host.", + "type": "any" + }, + { + "type": "function", + "name": "responseCallback", + "optional": true, + "parameters": [ + { + "name": "response", + "type": "any", + "description": "The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and $(ref:runtime.lastError) will be set to the error message." + } + ] + } + ] + }, + { + "name": "getBrowserInfo", + "type": "function", + "description": "Returns information about the current browser.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "description": "Called with results", + "parameters": [ + { + "name": "browserInfo", + "$ref": "BrowserInfo" + } + ] + } + ] + }, + { + "name": "getPlatformInfo", + "type": "function", + "description": "Returns information about the current platform.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "description": "Called with results", + "parameters": [ + { + "name": "platformInfo", + "$ref": "PlatformInfo" + } + ] + } + ] + }, + { + "name": "getPackageDirectoryEntry", + "unsupported": true, + "type": "function", + "description": "Returns a DirectoryEntry for the package directory.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "directoryEntry", + "type": "object", + "additionalProperties": { "type": "any" }, + "isInstanceOf": "DirectoryEntry" + } + ] + } + ] + } + ], + "events": [ + { + "name": "onStartup", + "type": "function", + "description": "Fired when a profile that has this extension installed first starts up. This event is not fired for incognito profiles." + }, + { + "name": "onInstalled", + "type": "function", + "description": "Fired when the extension is first installed, when the extension is updated to a new version, and when the browser is updated to a new version.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "reason": { + "$ref": "OnInstalledReason", + "description": "The reason that this event is being dispatched." + }, + "previousVersion": { + "type": "string", + "optional": true, + "description": "Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'." + }, + "temporary": { + "type": "boolean", + "description": "Indicates whether the addon is installed as a temporary extension." + }, + "id": { + "type": "string", + "optional": true, + "unsupported": true, + "description": "Indicates the ID of the imported shared module extension which updated. This is present only if 'reason' is 'shared_module_update'." + } + } + } + ] + }, + { + "name": "onSuspend", + "type": "function", + "description": "Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up. Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded. " + }, + { + "name": "onSuspendCanceled", + "type": "function", + "description": "Sent after onSuspend to indicate that the app won't be unloaded after all." + }, + { + "name": "onUpdateAvailable", + "type": "function", + "description": "Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call $(ref:runtime.reload). If your extension is using a persistent background page, the background page of course never gets unloaded, so unless you call $(ref:runtime.reload) manually in response to this event the update will not get installed until the next time the browser itself restarts. If no handlers are listening for this event, and your extension has a persistent background page, it behaves as if $(ref:runtime.reload) is called in response to this event.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "version": { + "type": "string", + "description": "The version number of the available update." + } + }, + "additionalProperties": { "type": "any" }, + "description": "The manifest details of the available update." + } + ] + }, + { + "name": "onBrowserUpdateAvailable", + "unsupported": true, + "type": "function", + "description": "Fired when an update for the browser is available, but isn't installed immediately because a browser restart is required.", + "deprecated": "Please use $(ref:runtime.onRestartRequired).", + "parameters": [] + }, + { + "name": "onConnect", + "type": "function", + "allowedContexts": ["content", "devtools"], + "description": "Fired when a connection is made from either an extension process or a content script.", + "parameters": [{ "$ref": "Port", "name": "port" }] + }, + { + "name": "onConnectExternal", + "type": "function", + "description": "Fired when a connection is made from another extension.", + "parameters": [{ "$ref": "Port", "name": "port" }] + }, + { + "name": "onMessage", + "type": "function", + "allowedContexts": ["content", "devtools"], + "description": "Fired when a message is sent from either an extension process or a content script.", + "parameters": [ + { + "name": "message", + "type": "any", + "optional": true, + "description": "The message sent by the calling script." + }, + { "name": "sender", "$ref": "MessageSender" }, + { + "name": "sendResponse", + "type": "function", + "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called)." + } + ], + "returns": { + "type": "boolean", + "optional": true, + "description": "Return true from the event listener if you wish to call <code>sendResponse</code> after the event listener returns." + } + }, + { + "name": "onMessageExternal", + "type": "function", + "description": "Fired when a message is sent from another extension/app. Cannot be used in a content script.", + "parameters": [ + { + "name": "message", + "type": "any", + "optional": true, + "description": "The message sent by the calling script." + }, + { "name": "sender", "$ref": "MessageSender" }, + { + "name": "sendResponse", + "type": "function", + "description": "Function to call (at most once) when you have a response. The argument should be any JSON-ifiable object. If you have more than one <code>onMessage</code> listener in the same document, then only one may send a response. This function becomes invalid when the event listener returns, unless you return true from the event listener to indicate you wish to send a response asynchronously (this will keep the message channel open to the other end until <code>sendResponse</code> is called)." + } + ], + "returns": { + "type": "boolean", + "optional": true, + "description": "Return true from the event listener if you wish to call <code>sendResponse</code> after the event listener returns." + } + }, + { + "name": "onRestartRequired", + "unsupported": true, + "type": "function", + "description": "Fired when an app or the device that it runs on needs to be restarted. The app should close all its windows at its earliest convenient time to let the restart to happen. If the app does nothing, a restart will be enforced after a 24-hour grace period has passed. Currently, this event is only fired for Chrome OS kiosk apps.", + "parameters": [ + { + "$ref": "OnRestartRequiredReason", + "name": "reason", + "description": "The reason that the event is being dispatched." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/scripting.json b/toolkit/components/extensions/schemas/scripting.json new file mode 100644 index 0000000000..fef83251b4 --- /dev/null +++ b/toolkit/components/extensions/schemas/scripting.json @@ -0,0 +1,365 @@ +/* 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/. */ + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["scripting"] + } + ] + } + ] + }, + { + "namespace": "scripting", + "description": "Use the scripting API to execute script in different contexts.", + "permissions": ["scripting"], + "types": [ + { + "id": "ScriptInjection", + "type": "object", + "description": "Details of a script injection", + "properties": { + "args": { + "type": "array", + "optional": true, + "description": "The arguments to curry into a provided function. This is only valid if the <code>func</code> parameter is specified. These arguments must be JSON-serializable.", + "items": { "type": "any" } + }, + "files": { + "type": "array", + "optional": true, + "description": "The path of the JS files to inject, relative to the extension's root directory. Exactly one of <code>files</code> and <code>func</code> must be specified.", + "minItems": 1, + "items": { "type": "string" } + }, + "func": { + "type": "function", + "optional": true, + "description": "A JavaScript function to inject. This function will be serialized, and then deserialized for injection. This means that any bound parameters and execution context will be lost. Exactly one of <code>files</code> and <code>func</code> must be specified." + }, + "target": { + "$ref": "InjectionTarget", + "description": "Details specifying the target into which to inject the script." + }, + "world": { + "$ref": "ExecutionWorld", + "optional": true + }, + "injectImmediately": { + "type": "boolean", + "optional": true, + "description": "Whether the injection should be triggered in the target as soon as possible (but not necessarily prior to page load)." + } + } + }, + { + "id": "InjectionResult", + "type": "object", + "description": "Result of a script injection.", + "properties": { + "frameId": { + "type": "integer", + "description": "The frame ID associated with the injection." + }, + "result": { + "type": "any", + "optional": true, + "description": "The result of the script execution." + }, + "error": { + "type": "any", + "optional": true, + "description": "The error property is set when the script execution failed. The value is typically an (Error) object with a message property, but could be any value (including primitives and undefined) if the script threw or rejected with such a value." + } + } + }, + { + "id": "InjectionTarget", + "type": "object", + "properties": { + "frameIds": { + "type": "array", + "optional": true, + "description": "The IDs of specific frames to inject into.", + "items": { "type": "number" } + }, + "allFrames": { + "type": "boolean", + "optional": true, + "description": "Whether the script should inject into all frames within the tab. Defaults to false. This must not be true if <code>frameIds</code> is specified." + }, + "tabId": { + "type": "number", + "description": "The ID of the tab into which to inject." + } + } + }, + { + "id": "CSSInjection", + "type": "object", + "properties": { + "css": { + "type": "string", + "optional": true, + "description": "A string containing the CSS to inject. Exactly one of <code>files</code> and <code>css</code> must be specified." + }, + "files": { + "type": "array", + "optional": true, + "description": "The path of the CSS files to inject, relative to the extension's root directory. Exactly one of <code>files</code> and <code>css</code> must be specified.", + "minItems": 1, + "items": { "type": "string" } + }, + "origin": { + "type": "string", + "optional": true, + "enum": ["USER", "AUTHOR"], + "default": "AUTHOR", + "description": "The style origin for the injection. Defaults to <code>'AUTHOR'</code>." + }, + "target": { + "$ref": "InjectionTarget", + "description": "Details specifying the target into which to inject the CSS." + } + } + }, + { + "id": "ContentScriptFilter", + "type": "object", + "properties": { + "ids": { + "type": "array", + "optional": true, + "description": "The IDs of specific scripts to retrieve with <code>getRegisteredContentScripts()</code> or to unregister with <code>unregisterContentScripts()</code>.", + "items": { "type": "string" } + } + } + }, + { + "id": "ExecutionWorld", + "type": "string", + "enum": ["ISOLATED"], + "description": "The JavaScript world for a script to execute within. We currently only support the <code>'ISOLATED'</code> world." + }, + { + "id": "RegisteredContentScript", + "type": "object", + "properties": { + "allFrames": { + "type": "boolean", + "optional": true, + "description": "If specified true, it will inject into all frames, even if the frame is not the top-most frame in the tab. Each frame is checked independently for URL requirements; it will not inject into child frames if the URL requirements are not met. Defaults to false, meaning that only the top frame is matched." + }, + "excludeMatches": { + "type": "array", + "optional": true, + "description": "Excludes pages that this content script would otherwise be injected into.", + "items": { "type": "string" } + }, + "id": { + "type": "string", + "description": "The id of the content script, specified in the API call." + }, + "js": { + "type": "array", + "optional": true, + "description": "The list of JavaScript files to be injected into matching pages. These are injected in the order they appear in this array.", + "items": { "$ref": "manifest.ExtensionURL" } + }, + "matches": { + "type": "array", + "optional": true, + "description": "Specifies which pages this content script will be injected into. Must be specified for <code>registerContentScripts()</code>.", + "items": { "type": "string" } + }, + "runAt": { + "$ref": "extensionTypes.RunAt", + "optional": true, + "description": "Specifies when JavaScript files are injected into the web page. The preferred and default value is <code>document_idle</code>." + }, + "persistAcrossSessions": { + "type": "boolean", + "optional": true, + "default": true, + "description": "Specifies if this content script will persist into future sessions. Defaults to true." + }, + "css": { + "type": "array", + "optional": true, + "description": "The list of CSS files to be injected into matching pages. These are injected in the order they appear in this array.", + "items": { "$ref": "manifest.ExtensionURL" } + } + } + } + ], + "functions": [ + { + "name": "executeScript", + "type": "function", + "description": "Injects a script into a target context. The script will be run at <code>document_idle</code>.", + "async": "callback", + "parameters": [ + { + "name": "injection", + "$ref": "ScriptInjection", + "description": "The details of the script which to inject." + }, + { + "name": "callback", + "type": "function", + "description": "Invoked upon completion of the injection. The resulting array contains the result of execution for each frame where the injection succeeded.", + "parameters": [ + { + "name": "results", + "type": "array", + "items": { "$ref": "InjectionResult" } + } + ] + } + ] + }, + { + "name": "insertCSS", + "type": "function", + "description": "Inserts a CSS stylesheet into a target context. If multiple frames are specified, unsuccessful injections are ignored.", + "async": "callback", + "parameters": [ + { + "name": "injection", + "$ref": "CSSInjection", + "description": "The details of the styles to insert." + }, + { + "name": "callback", + "type": "function", + "description": "Invoked upon completion of the injection.", + "parameters": [] + } + ] + }, + { + "name": "removeCSS", + "type": "function", + "description": "Removes a CSS stylesheet that was previously inserted by this extension from a target context.", + "async": "callback", + "parameters": [ + { + "name": "injection", + "$ref": "CSSInjection", + "description": "The details of the styles to remove. Note that the <code>css</code>, <code>files</code>, and <code>origin</code> properties must exactly match the stylesheet inserted through <code>insertCSS</code>. Attempting to remove a non-existent stylesheet is a no-op." + }, + { + "name": "callback", + "type": "function", + "description": "Invoked upon completion of the injection.", + "parameters": [] + } + ] + }, + { + "name": "registerContentScripts", + "type": "function", + "description": "Registers one or more content scripts for this extension.", + "async": "callback", + "parameters": [ + { + "name": "scripts", + "type": "array", + "description": "Contains a list of scripts to be registered. If there are errors during script parsing/file validation, or if the IDs specified already exist, then no scripts are registered.", + "items": { "$ref": "RegisteredContentScript" } + }, + { + "name": "callback", + "type": "function", + "description": "Invoked upon completion of the registration.", + "parameters": [] + } + ] + }, + { + "name": "getRegisteredContentScripts", + "type": "function", + "description": "Returns all dynamically registered content scripts for this extension that match the given filter.", + "async": "callback", + "parameters": [ + { + "name": "filter", + "$ref": "ContentScriptFilter", + "optional": true, + "description": "An object to filter the extension's dynamically registered scripts." + }, + { + "name": "callback", + "type": "function", + "description": "The resulting array contains the registered content scripts.", + "parameters": [ + { + "name": "scripts", + "type": "array", + "items": { "$ref": "RegisteredContentScript" } + } + ] + } + ] + }, + { + "name": "unregisterContentScripts", + "type": "function", + "description": "Unregisters one or more content scripts for this extension.", + "async": "callback", + "parameters": [ + { + "name": "filter", + "$ref": "ContentScriptFilter", + "optional": true, + "description": "If specified, only unregisters dynamic content scripts which match the filter. Otherwise, all of the extension's dynamic content scripts are unregistered." + }, + { + "name": "callback", + "type": "function", + "description": "Invoked upon completion of the unregistration.", + "parameters": [] + } + ] + }, + { + "name": "updateContentScripts", + "type": "function", + "description": "Updates one or more content scripts for this extension.", + "async": "callback", + "parameters": [ + { + "name": "scripts", + "type": "array", + "description": "Contains a list of scripts to be updated. If there are errors during script parsing/file validation, or if the IDs specified do not already exist, then no scripts are updated.", + "items": { + "type": "object", + "$import": "RegisteredContentScript", + "properties": { + "persistAcrossSessions": { + "type": "boolean", + "optional": true, + "description": "Specifies if this content script will persist into future sessions." + } + } + } + }, + { + "name": "callback", + "type": "function", + "description": "Invoked when scripts have been updated.", + "parameters": [] + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/storage.json b/toolkit/components/extensions/schemas/storage.json new file mode 100644 index 0000000000..986f1eea96 --- /dev/null +++ b/toolkit/components/extensions/schemas/storage.json @@ -0,0 +1,398 @@ +// Copyright 2014 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 file. + +[ + { + "namespace": "storage", + "allowedContexts": ["content", "devtools"], + "defaultContexts": ["content", "devtools"], + "description": "Use the <code>browser.storage</code> API to store, retrieve, and track changes to user data.", + "permissions": ["storage"], + "types": [ + { + "id": "StorageChange", + "type": "object", + "properties": { + "oldValue": { + "type": "any", + "description": "The old value of the item, if there was an old value.", + "optional": true + }, + "newValue": { + "type": "any", + "description": "The new value of the item, if there is a new value.", + "optional": true + } + } + }, + { + "id": "StorageArea", + "type": "object", + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets one or more items from storage.", + "async": "callback", + "parameters": [ + { + "name": "keys", + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } }, + { + "type": "object", + "description": "Storage items to return in the callback, where the values are replaced with those from storage if they exist.", + "additionalProperties": { "type": "any" } + } + ], + "description": "A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in <code>null</code> to get the entire contents of storage.", + "optional": true + }, + { + "name": "callback", + "type": "function", + "description": "Callback with storage items, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [ + { + "name": "items", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "Object with items in their key-value mappings." + } + ] + } + ] + }, + { + "name": "getBytesInUse", + "unsupported": true, + "type": "function", + "description": "Gets the amount of space (in bytes) being used by one or more items.", + "async": "callback", + "parameters": [ + { + "name": "keys", + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } } + ], + "description": "A single key or list of keys to get the total usage for. An empty list will return 0. Pass in <code>null</code> to get the total usage of all of storage.", + "optional": true + }, + { + "name": "callback", + "type": "function", + "description": "Callback with the amount of space being used by storage, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [ + { + "name": "bytesInUse", + "type": "integer", + "description": "Amount of space being used in storage, in bytes." + } + ] + } + ] + }, + { + "name": "set", + "type": "function", + "description": "Sets multiple items.", + "async": "callback", + "parameters": [ + { + "name": "items", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "<p>An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.</p><p>Primitive values such as numbers will serialize as expected. Values with a <code>typeof</code> <code>\"object\"</code> and <code>\"function\"</code> will typically serialize to <code>{}</code>, with the exception of <code>Array</code> (serializes as expected), <code>Date</code>, and <code>Regex</code> (serialize using their <code>String</code> representation).</p>" + }, + { + "name": "callback", + "type": "function", + "description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [], + "optional": true + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes one or more items from storage.", + "async": "callback", + "parameters": [ + { + "name": "keys", + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } } + ], + "description": "A single key or a list of keys for items to remove." + }, + { + "name": "callback", + "type": "function", + "description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [], + "optional": true + } + ] + }, + { + "name": "clear", + "type": "function", + "description": "Removes all items from storage.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [], + "optional": true + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "type": "function", + "description": "Fired when one or more items change.", + "parameters": [ + { + "name": "changes", + "type": "object", + "additionalProperties": { "$ref": "StorageChange" }, + "description": "Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item." + } + ] + } + ] + }, + { + "id": "StorageAreaSync", + "type": "object", + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets one or more items from storage.", + "async": "callback", + "parameters": [ + { + "name": "keys", + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } }, + { + "type": "object", + "description": "Storage items to return in the callback, where the values are replaced with those from storage if they exist.", + "additionalProperties": { "type": "any" } + } + ], + "description": "A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in <code>null</code> to get the entire contents of storage.", + "optional": true + }, + { + "name": "callback", + "type": "function", + "description": "Callback with storage items, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [ + { + "name": "items", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "Object with items in their key-value mappings." + } + ] + } + ] + }, + { + "name": "getBytesInUse", + "type": "function", + "description": "Gets the amount of space (in bytes) being used by one or more items.", + "async": "callback", + "parameters": [ + { + "name": "keys", + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } } + ], + "description": "A single key or list of keys to get the total usage for. An empty list will return 0. Pass in <code>null</code> to get the total usage of all of storage.", + "optional": true + }, + { + "name": "callback", + "type": "function", + "description": "Callback with the amount of space being used by storage, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [ + { + "name": "bytesInUse", + "type": "integer", + "description": "Amount of space being used in storage, in bytes." + } + ] + } + ] + }, + { + "name": "set", + "type": "function", + "description": "Sets multiple items.", + "async": "callback", + "parameters": [ + { + "name": "items", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "<p>An object which gives each key/value pair to update storage with. Any other key/value pairs in storage will not be affected.</p><p>Primitive values such as numbers will serialize as expected. Values with a <code>typeof</code> <code>\"object\"</code> and <code>\"function\"</code> will typically serialize to <code>{}</code>, with the exception of <code>Array</code> (serializes as expected), <code>Date</code>, and <code>Regex</code> (serialize using their <code>String</code> representation).</p>" + }, + { + "name": "callback", + "type": "function", + "description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [], + "optional": true + } + ] + }, + { + "name": "remove", + "type": "function", + "description": "Removes one or more items from storage.", + "async": "callback", + "parameters": [ + { + "name": "keys", + "choices": [ + { "type": "string" }, + { "type": "array", "items": { "type": "string" } } + ], + "description": "A single key or a list of keys for items to remove." + }, + { + "name": "callback", + "type": "function", + "description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [], + "optional": true + } + ] + }, + { + "name": "clear", + "type": "function", + "description": "Removes all items from storage.", + "async": "callback", + "parameters": [ + { + "name": "callback", + "type": "function", + "description": "Callback on success, or on failure (in which case $(ref:runtime.lastError) will be set).", + "parameters": [], + "optional": true + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "type": "function", + "description": "Fired when one or more items change.", + "parameters": [ + { + "name": "changes", + "type": "object", + "additionalProperties": { "$ref": "StorageChange" }, + "description": "Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item." + } + ] + } + ] + } + ], + "events": [ + { + "name": "onChanged", + "type": "function", + "description": "Fired when one or more items change.", + "parameters": [ + { + "name": "changes", + "type": "object", + "additionalProperties": { "$ref": "StorageChange" }, + "description": "Object mapping each key that changed to its corresponding $(ref:storage.StorageChange) for that item." + }, + { + "name": "areaName", + "type": "string", + "description": "The name of the storage area (<code>\"sync\"</code>, <code>\"local\"</code> or <code>\"managed\"</code>) the changes are for." + } + ] + } + ], + "properties": { + "sync": { + "$ref": "StorageAreaSync", + "description": "Items in the <code>sync</code> storage area are synced by the browser.", + "properties": { + "QUOTA_BYTES": { + "value": 102400, + "description": "The maximum total amount (in bytes) of data that can be stored in sync storage, as measured by the JSON stringification of every value plus every key's length. Updates that would cause this limit to be exceeded fail immediately and set $(ref:runtime.lastError)." + }, + "QUOTA_BYTES_PER_ITEM": { + "value": 8192, + "description": "The maximum size (in bytes) of each individual item in sync storage, as measured by the JSON stringification of its value plus its key length. Updates containing items larger than this limit will fail immediately and set $(ref:runtime.lastError)." + }, + "MAX_ITEMS": { + "value": 512, + "description": "The maximum number of items that can be stored in sync storage. Updates that would cause this limit to be exceeded will fail immediately and set $(ref:runtime.lastError)." + }, + "MAX_WRITE_OPERATIONS_PER_HOUR": { + "value": 1800, + "description": "<p>The maximum number of <code>set</code>, <code>remove</code>, or <code>clear</code> operations that can be performed each hour. This is 1 every 2 seconds, a lower ceiling than the short term higher writes-per-minute limit.</p><p>Updates that would cause this limit to be exceeded fail immediately and set $(ref:runtime.lastError).</p>" + }, + "MAX_WRITE_OPERATIONS_PER_MINUTE": { + "value": 120, + "description": "<p>The maximum number of <code>set</code>, <code>remove</code>, or <code>clear</code> operations that can be performed each minute. This is 2 per second, providing higher throughput than writes-per-hour over a shorter period of time.</p><p>Updates that would cause this limit to be exceeded fail immediately and set $(ref:runtime.lastError).</p>" + }, + "MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE": { + "value": 1000000, + "deprecated": "The storage.sync API no longer has a sustained write operation quota.", + "description": "" + } + } + }, + "local": { + "$ref": "StorageArea", + "description": "Items in the <code>local</code> storage area are local to each machine.", + "properties": { + "QUOTA_BYTES": { + "value": 5242880, + "description": "The maximum amount (in bytes) of data that can be stored in local storage, as measured by the JSON stringification of every value plus every key's length. This value will be ignored if the extension has the <code>unlimitedStorage</code> permission. Updates that would cause this limit to be exceeded fail immediately and set $(ref:runtime.lastError)." + } + } + }, + "managed": { + "$ref": "StorageArea", + "description": "Items in the <code>managed</code> storage area are set by administrators or native applications, and are read-only for the extension; trying to modify this namespace results in an error.", + "properties": { + "QUOTA_BYTES": { + "value": 5242880, + "description": "The maximum size (in bytes) of the managed storage JSON manifest file. Files larger than this limit will fail to load." + } + } + }, + "session": { + "allowedContexts": ["devtools"], + "$ref": "StorageArea", + "description": "Items in the <code>session</code> storage area are kept in memory, and only until the either browser or extension is closed or reloaded." + } + } + } +] diff --git a/toolkit/components/extensions/schemas/telemetry.json b/toolkit/components/extensions/schemas/telemetry.json new file mode 100644 index 0000000000..da8587f7e7 --- /dev/null +++ b/toolkit/components/extensions/schemas/telemetry.json @@ -0,0 +1,469 @@ +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "telemetry": { + "type": "object", + "optional": true, + "additionalProperties": { "$ref": "UnrecognizedProperty" }, + "properties": { + "ping_type": { + "type": "string" + }, + "schemaNamespace": { + "type": "string" + }, + "public_key": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "key": { + "type": "object", + "properties": { + "crv": { + "type": "string", + "optional": "false" + }, + "kty": { + "type": "string", + "optional": "false" + }, + "x": { + "type": "string", + "optional": "false" + }, + "y": { + "type": "string", + "optional": "false" + } + } + } + } + }, + "study_name": { + "type": "string", + "optional": true + }, + "pioneer_id": { + "type": "boolean", + "optional": true, + "default": false + } + } + } + } + }, + { + "$extend": "PermissionPrivileged", + "choices": [ + { + "type": "string", + "enum": ["telemetry"] + } + ] + } + ] + }, + { + "namespace": "telemetry", + "description": "Use the <code>browser.telemetry</code> API to send telemetry data to the Mozilla Telemetry service. Restricted to Mozilla privileged webextensions.", + "types": [ + { + "id": "ScalarType", + "type": "string", + "enum": ["count", "string", "boolean"], + "description": "Type of scalar: 'count' for numeric values, 'string' for string values, 'boolean' for boolean values. Maps to <code>nsITelemetry.SCALAR_TYPE_*</code>." + }, + { + "id": "ScalarData", + "type": "object", + "description": "Represents registration data for a Telemetry scalar.", + "properties": { + "kind": { + "$ref": "ScalarType" + }, + "keyed": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if this is a keyed scalar." + }, + "record_on_release": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if this data should be recorded on release." + }, + "expired": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if this scalar entry is expired. This allows recording it without error, but it will be discarded." + } + } + }, + { + "id": "EventData", + "type": "object", + "description": "Represents registration data for a Telemetry event.", + "properties": { + "methods": { + "type": "array", + "items": { "type": "string" }, + "description": "List of methods for this event entry." + }, + "objects": { + "type": "array", + "items": { "type": "string" }, + "description": "List of objects for this event entry." + }, + "extra_keys": { + "type": "array", + "items": { "type": "string" }, + "description": "List of allowed extra keys for this event entry." + }, + "record_on_release": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if this data should be recorded on release." + }, + "expired": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if this event entry is expired. This allows recording it without error, but it will be discarded." + } + } + } + ], + "permissions": ["telemetry"], + "functions": [ + { + "name": "submitPing", + "type": "function", + "description": "Submits a custom ping to the Telemetry back-end. See <code>submitExternalPing</code> inside TelemetryController.sys.mjs for more details.", + "async": true, + "parameters": [ + { + "name": "type", + "type": "string", + "pattern": "^[a-z0-9][a-z0-9-]+[a-z0-9]$", + "description": "The type of the ping." + }, + { + "name": "message", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "The data payload for the ping." + }, + { + "description": "Options object.", + "name": "options", + "type": "object", + "properties": { + "addClientId": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if the ping should contain the client id." + }, + "addEnvironment": { + "type": "boolean", + "optional": true, + "default": false, + "description": "True if the ping should contain the environment data." + }, + "overrideEnvironment": { + "type": "object", + "additionalProperties": { "type": "any" }, + "optional": true, + "default": false, + "description": "Set to override the environment data." + }, + "usePingSender": { + "type": "boolean", + "optional": true, + "default": false, + "description": "If true, send the ping using the PingSender." + } + } + } + ] + }, + { + "name": "submitEncryptedPing", + "type": "function", + "description": "Submits a custom ping to the Telemetry back-end, with an encrypted payload. Requires a telemetry entry in the manifest to be used.", + "parameters": [ + { + "name": "message", + "type": "object", + "additionalProperties": { "type": "any" }, + "description": "The data payload for the ping, which will be encrypted." + }, + { + "description": "Options object.", + "name": "options", + "type": "object", + "properties": { + "schemaName": { + "type": "string", + "optional": false, + "description": "Schema name used for payload." + }, + "schemaVersion": { + "type": "integer", + "optional": false, + "description": "Schema version used for payload." + } + } + } + ], + "async": true + }, + { + "name": "canUpload", + "type": "function", + "description": "Checks if Telemetry upload is enabled.", + "parameters": [], + "async": true + }, + { + "name": "scalarAdd", + "type": "function", + "description": "Adds the value to the given scalar.", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string", + "description": "The scalar name." + }, + { + "name": "value", + "type": "integer", + "minimum": 1, + "description": "The numeric value to add to the scalar. Only unsigned integers supported." + } + ] + }, + { + "name": "scalarSet", + "type": "function", + "description": "Sets the named scalar to the given value. Throws if the value type doesn't match the scalar type.", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string", + "description": "The scalar name" + }, + { + "name": "value", + "description": "The value to set the scalar to", + "choices": [ + { "type": "string" }, + { "type": "boolean" }, + { "type": "integer" }, + { "type": "object", "additionalProperties": { "type": "any" } } + ] + } + ] + }, + { + "name": "scalarSetMaximum", + "type": "function", + "description": "Sets the scalar to the maximum of the current and the passed value", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string", + "description": "The scalar name." + }, + { + "name": "value", + "type": "integer", + "minimum": 0, + "description": "The numeric value to set the scalar to. Only unsigned integers supported." + } + ] + }, + { + "name": "keyedScalarAdd", + "type": "function", + "description": "Adds the value to the given keyed scalar.", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string", + "description": "The scalar name" + }, + { + "name": "key", + "type": "string", + "description": "The key name" + }, + { + "name": "value", + "type": "integer", + "minimum": 1, + "description": "The numeric value to add to the scalar. Only unsigned integers supported." + } + ] + }, + { + "name": "keyedScalarSet", + "type": "function", + "description": "Sets the keyed scalar to the given value. Throws if the value type doesn't match the scalar type.", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string", + "description": "The scalar name." + }, + { + "name": "key", + "type": "string", + "description": "The key name." + }, + { + "name": "value", + "description": "The value to set the scalar to.", + "choices": [ + { "type": "string" }, + { "type": "boolean" }, + { "type": "integer" }, + { "type": "object", "additionalProperties": { "type": "any" } } + ] + } + ] + }, + { + "name": "keyedScalarSetMaximum", + "type": "function", + "description": "Sets the keyed scalar to the maximum of the current and the passed value", + "async": true, + "parameters": [ + { + "name": "name", + "type": "string", + "description": "The scalar name." + }, + { + "name": "key", + "type": "string", + "description": "The key name." + }, + { + "name": "value", + "type": "integer", + "minimum": 0, + "description": "The numeric value to set the scalar to. Only unsigned integers supported." + } + ] + }, + { + "name": "recordEvent", + "type": "function", + "description": "Record an event in Telemetry. Throws when trying to record an unknown event.", + "async": true, + "parameters": [ + { + "name": "category", + "type": "string", + "description": "The category name." + }, + { + "name": "method", + "type": "string", + "description": "The method name." + }, + { + "name": "object", + "type": "string", + "description": "The object name." + }, + { + "name": "value", + "type": "string", + "optional": true, + "description": "An optional string value to record." + }, + { + "name": "extra", + "type": "object", + "optional": true, + "description": "An optional object of the form (string -> string). It should only contain registered extra keys.", + "additionalProperties": { "type": "string" } + } + ] + }, + + { + "name": "registerScalars", + "type": "function", + "description": "Register new scalars to record them from addons. See nsITelemetry.idl for more details.", + "async": true, + "parameters": [ + { + "name": "category", + "type": "string", + "description": "The unique category the scalars are registered in." + }, + { + "name": "data", + "type": "object", + "additionalProperties": { "$ref": "ScalarData" }, + "description": "An object that contains registration data for multiple scalars. Each property name is the scalar name, and the corresponding property value is an object of ScalarData type." + } + ] + }, + { + "name": "registerEvents", + "type": "function", + "description": "Register new events to record them from addons. See nsITelemetry.idl for more details.", + "async": true, + "parameters": [ + { + "name": "category", + "type": "string", + "description": "The unique category the events are registered in." + }, + { + "name": "data", + "type": "object", + "additionalProperties": { "$ref": "EventData" }, + "description": "An object that contains registration data for 1+ events. Each property name is the category name, and the corresponding property value is an object of EventData type." + } + ] + }, + { + "name": "setEventRecordingEnabled", + "type": "function", + "description": "Enable recording of events in a category. Events default to recording disabled. This allows to toggle recording for all events in the specified category.", + "async": true, + "parameters": [ + { + "name": "category", + "type": "string", + "description": "The category name." + }, + { + "name": "enabled", + "type": "boolean", + "description": "Whether recording is enabled for events in that category." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/test.json b/toolkit/components/extensions/schemas/test.json new file mode 100644 index 0000000000..a26daaa178 --- /dev/null +++ b/toolkit/components/extensions/schemas/test.json @@ -0,0 +1,210 @@ +// Copyright 2014 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 file. + +[ + { + "namespace": "test", + "allowedContexts": ["content", "devtools"], + "defaultContexts": ["content", "devtools"], + "description": "none", + "functions": [ + { + "name": "withHandlingUserInput", + "type": "function", + "description": "Calls the callback function wrapped with user input set. This is only used for internal unit testing.", + "parameters": [{ "type": "function", "name": "callback" }] + }, + { + "name": "notifyFail", + "type": "function", + "description": "Notifies the browser process that test code running in the extension failed. This is only used for internal unit testing.", + "parameters": [{ "type": "string", "name": "message" }] + }, + { + "name": "notifyPass", + "type": "function", + "description": "Notifies the browser process that test code running in the extension passed. This is only used for internal unit testing.", + "parameters": [ + { "type": "string", "name": "message", "optional": true } + ] + }, + { + "name": "log", + "type": "function", + "description": "Logs a message during internal unit testing.", + "parameters": [{ "type": "string", "name": "message" }] + }, + { + "name": "sendMessage", + "type": "function", + "description": "Sends a string message to the browser process, generating a Notification that C++ test code can wait for.", + "allowAmbiguousOptionalArguments": true, + "parameters": [ + { "type": "any", "name": "arg1", "optional": true }, + { "type": "any", "name": "arg2", "optional": true } + ] + }, + { + "name": "fail", + "type": "function", + "parameters": [{ "type": "any", "name": "message", "optional": true }] + }, + { + "name": "succeed", + "type": "function", + "parameters": [{ "type": "any", "name": "message", "optional": true }] + }, + { + "name": "assertTrue", + "type": "function", + "allowAmbiguousOptionalArguments": true, + "parameters": [ + { "name": "test", "type": "any", "optional": true }, + { "type": "string", "name": "message", "optional": true } + ] + }, + { + "name": "assertFalse", + "type": "function", + "allowAmbiguousOptionalArguments": true, + "parameters": [ + { "name": "test", "type": "any", "optional": true }, + { "type": "string", "name": "message", "optional": true } + ] + }, + { + "name": "assertBool", + "type": "function", + "unsupported": true, + "parameters": [ + { + "name": "test", + "choices": [{ "type": "string" }, { "type": "boolean" }] + }, + { "type": "boolean", "name": "expected" }, + { "type": "string", "name": "message", "optional": true } + ] + }, + { + "name": "assertDeepEq", + "type": "function", + "allowAmbiguousOptionalArguments": true, + "parameters": [ + { "type": "any", "name": "expected" }, + { "type": "any", "name": "actual" }, + { "type": "string", "name": "message", "optional": true } + ] + }, + { + "name": "assertEq", + "type": "function", + "allowAmbiguousOptionalArguments": true, + "parameters": [ + { "type": "any", "name": "expected", "optional": true }, + { "type": "any", "name": "actual", "optional": true }, + { "type": "string", "name": "message", "optional": true } + ] + }, + { + "name": "assertNoLastError", + "type": "function", + "unsupported": true, + "parameters": [] + }, + { + "name": "assertLastError", + "type": "function", + "unsupported": true, + "parameters": [{ "type": "string", "name": "expectedError" }] + }, + { + "name": "assertRejects", + "type": "function", + "async": true, + "parameters": [ + { + "name": "promise", + "$ref": "Promise" + }, + { + "name": "expectedError", + "$ref": "ExpectedError" + }, + { + "name": "message", + "type": "string", + "optional": true + } + ] + }, + { + "name": "assertThrows", + "type": "function", + "parameters": [ + { + "name": "func", + "type": "function" + }, + { + "name": "expectedError", + "$ref": "ExpectedError" + }, + { + "name": "message", + "type": "string", + "optional": true + } + ] + } + ], + "types": [ + { + "id": "ExpectedError", + "choices": [ + { "type": "string" }, + { + "type": "object", + "isInstanceOf": "RegExp", + "additionalProperties": true + }, + { "type": "function" } + ] + }, + { + "id": "Promise", + "choices": [ + { + "type": "object", + "properties": { + "then": { "type": "function" } + }, + "additionalProperties": true + }, + { + "type": "object", + "isInstanceOf": "Promise", + "additionalProperties": true + } + ] + } + ], + "events": [ + { + "name": "onMessage", + "type": "function", + "description": "Used to test sending messages to extensions.", + "parameters": [ + { + "type": "string", + "name": "message" + }, + { + "type": "any", + "name": "argument" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/theme.json b/toolkit/components/extensions/schemas/theme.json new file mode 100644 index 0000000000..3bf7a313e2 --- /dev/null +++ b/toolkit/components/extensions/schemas/theme.json @@ -0,0 +1,461 @@ +// 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/. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "PermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": ["theme"] + } + ] + }, + { + "id": "ThemeColor", + "choices": [ + { + "type": "string" + }, + { + "type": "array", + "minItems": 3, + "maxItems": 3, + "items": { + "type": "integer", + "minimum": 0, + "maximum": 255 + } + }, + { + "type": "array", + "minItems": 4, + "maxItems": 4, + "items": { + "type": "number" + } + } + ] + }, + { + "id": "ThemeExperiment", + "type": "object", + "properties": { + "stylesheet": { + "optional": true, + "$ref": "ExtensionURL" + }, + "images": { + "type": "object", + "optional": true, + "additionalProperties": { + "type": "string" + } + }, + "colors": { + "type": "object", + "optional": true, + "additionalProperties": { + "type": "string" + } + }, + "properties": { + "type": "object", + "optional": true, + "additionalProperties": { + "type": "string" + } + } + } + }, + { + "id": "ThemeType", + "type": "object", + "properties": { + "images": { + "type": "object", + "optional": true, + "properties": { + "additional_backgrounds": { + "type": "array", + "items": { "$ref": "ImageDataOrExtensionURL" }, + "maxItems": 15, + "optional": true + }, + "headerURL": { + "$ref": "ImageDataOrExtensionURL", + "optional": true, + "deprecated": "Unsupported images property, use 'theme.images.theme_frame', this alias is ignored in Firefox >= 70." + }, + "theme_frame": { + "$ref": "ImageDataOrExtensionURL", + "optional": true + } + }, + "additionalProperties": { "$ref": "ImageDataOrExtensionURL" } + }, + "colors": { + "type": "object", + "optional": true, + "properties": { + "tab_selected": { + "$ref": "ThemeColor", + "optional": true + }, + "accentcolor": { + "$ref": "ThemeColor", + "optional": true, + "deprecated": "Unsupported colors property, use 'theme.colors.frame', this alias is ignored in Firefox >= 70." + }, + "frame": { + "$ref": "ThemeColor", + "optional": true + }, + "frame_inactive": { + "$ref": "ThemeColor", + "optional": true + }, + "textcolor": { + "$ref": "ThemeColor", + "optional": true, + "deprecated": "Unsupported color property, use 'theme.colors.tab_background_text', this alias is ignored in Firefox >= 70." + }, + "tab_background_text": { + "$ref": "ThemeColor", + "optional": true + }, + "tab_background_separator": { + "$ref": "ThemeColor", + "optional": true + }, + "tab_loading": { + "$ref": "ThemeColor", + "optional": true + }, + "tab_text": { + "$ref": "ThemeColor", + "optional": true + }, + "tab_line": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_text": { + "$ref": "ThemeColor", + "optional": true, + "description": "This color property is an alias of 'bookmark_text'." + }, + "bookmark_text": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_text": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_border": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_separator": { + "$ref": "ThemeColor", + "optional": true, + "deprecated": "This color property is ignored in Firefox >= 89." + }, + "toolbar_top_separator": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_bottom_separator": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_vertical_separator": { + "$ref": "ThemeColor", + "optional": true + }, + "icons": { + "$ref": "ThemeColor", + "optional": true + }, + "icons_attention": { + "$ref": "ThemeColor", + "optional": true + }, + "button_background_hover": { + "$ref": "ThemeColor", + "optional": true + }, + "button_background_active": { + "$ref": "ThemeColor", + "optional": true + }, + "popup": { + "$ref": "ThemeColor", + "optional": true + }, + "popup_text": { + "$ref": "ThemeColor", + "optional": true + }, + "popup_border": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_focus": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_text_focus": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_border_focus": { + "$ref": "ThemeColor", + "optional": true + }, + "popup_highlight": { + "$ref": "ThemeColor", + "optional": true + }, + "popup_highlight_text": { + "$ref": "ThemeColor", + "optional": true + }, + "ntp_background": { + "$ref": "ThemeColor", + "optional": true + }, + "ntp_card_background": { + "$ref": "ThemeColor", + "optional": true + }, + "ntp_text": { + "$ref": "ThemeColor", + "optional": true + }, + "sidebar": { + "$ref": "ThemeColor", + "optional": true + }, + "sidebar_border": { + "$ref": "ThemeColor", + "optional": true + }, + "sidebar_text": { + "$ref": "ThemeColor", + "optional": true + }, + "sidebar_highlight": { + "$ref": "ThemeColor", + "optional": true + }, + "sidebar_highlight_text": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_highlight": { + "$ref": "ThemeColor", + "optional": true + }, + "toolbar_field_highlight_text": { + "$ref": "ThemeColor", + "optional": true + } + }, + "additionalProperties": { "$ref": "ThemeColor" } + }, + "properties": { + "type": "object", + "optional": true, + "properties": { + "additional_backgrounds_alignment": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "bottom", + "center", + "left", + "right", + "top", + "center bottom", + "center center", + "center top", + "left bottom", + "left center", + "left top", + "right bottom", + "right center", + "right top" + ] + }, + "maxItems": 15, + "optional": true + }, + "additional_backgrounds_tiling": { + "type": "array", + "items": { + "type": "string", + "enum": ["no-repeat", "repeat", "repeat-x", "repeat-y"] + }, + "maxItems": 15, + "optional": true + }, + "color_scheme": { + "optional": true, + "type": "string", + "enum": ["auto", "light", "dark", "system"] + }, + "content_color_scheme": { + "optional": true, + "type": "string", + "enum": ["auto", "light", "dark", "system"] + } + }, + "additionalProperties": { "type": "string" } + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + }, + { + "id": "ThemeManifest", + "type": "object", + "description": "Contents of manifest.json for a static theme", + "$import": "manifest.ManifestBase", + "properties": { + "theme": { + "$ref": "ThemeType" + }, + "dark_theme": { + "$ref": "ThemeType", + "optional": true + }, + "default_locale": { + "type": "string", + "optional": true + }, + "theme_experiment": { + "$ref": "ThemeExperiment", + "optional": true + }, + "icons": { + "type": "object", + "optional": true, + "patternProperties": { + "^[1-9]\\d*$": { "type": "string" } + } + } + } + }, + { + "$extend": "WebExtensionManifest", + "properties": { + "theme_experiment": { + "$ref": "ThemeExperiment", + "optional": true + } + } + } + ] + }, + { + "namespace": "theme", + "description": "The theme API allows customizing of visual elements of the browser.", + "types": [ + { + "id": "ThemeUpdateInfo", + "type": "object", + "description": "Info provided in the onUpdated listener.", + "properties": { + "theme": { + "type": "object", + "description": "The new theme after update" + }, + "windowId": { + "type": "integer", + "description": "The id of the window the theme has been applied to", + "optional": true + } + } + } + ], + "events": [ + { + "name": "onUpdated", + "type": "function", + "description": "Fired when a new theme has been applied", + "parameters": [ + { + "$ref": "ThemeUpdateInfo", + "name": "updateInfo", + "description": "Details of the theme update" + } + ] + } + ], + "functions": [ + { + "name": "getCurrent", + "type": "function", + "async": true, + "description": "Returns the current theme for the specified window or the last focused window.", + "parameters": [ + { + "type": "integer", + "name": "windowId", + "optional": true, + "description": "The window for which we want the theme." + } + ] + }, + { + "name": "update", + "type": "function", + "async": true, + "description": "Make complete updates to the theme. Resolves when the update has completed.", + "permissions": ["theme"], + "parameters": [ + { + "type": "integer", + "name": "windowId", + "optional": true, + "description": "The id of the window to update. No id updates all windows." + }, + { + "name": "details", + "$ref": "manifest.ThemeType", + "description": "The properties of the theme to update." + } + ] + }, + { + "name": "reset", + "type": "function", + "async": true, + "description": "Removes the updates made to the theme.", + "permissions": ["theme"], + "parameters": [ + { + "type": "integer", + "name": "windowId", + "optional": true, + "description": "The id of the window to reset. No id resets all windows." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/types.json b/toolkit/components/extensions/schemas/types.json new file mode 100644 index 0000000000..a4aea5d6ac --- /dev/null +++ b/toolkit/components/extensions/schemas/types.json @@ -0,0 +1,172 @@ +// 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 file. + +[ + { + "namespace": "types", + "description": "Contains types used by other schemas.", + "types": [ + { + "id": "SettingScope", + "type": "string", + "enum": [ + "regular", + "regular_only", + "incognito_persistent", + "incognito_session_only" + ], + "description": "The scope of the Setting. One of<ul><li><var>regular</var>: setting for the regular profile (which is inherited by the incognito profile if not overridden elsewhere),</li><li><var>regular_only</var>: setting for the regular profile only (not inherited by the incognito profile),</li><li><var>incognito_persistent</var>: setting for the incognito profile that survives browser restarts (overrides regular preferences),</li><li><var>incognito_session_only</var>: setting for the incognito profile that can only be set during an incognito session and is deleted when the incognito session ends (overrides regular and incognito_persistent preferences).</li></ul> Only <var>regular</var> is supported by Firefox at this time." + }, + { + "id": "LevelOfControl", + "type": "string", + "enum": [ + "not_controllable", + "controlled_by_other_extensions", + "controllable_by_this_extension", + "controlled_by_this_extension" + ], + "description": "One of<ul><li><var>not_controllable</var>: cannot be controlled by any extension</li><li><var>controlled_by_other_extensions</var>: controlled by extensions with higher precedence</li><li><var>controllable_by_this_extension</var>: can be controlled by this extension</li><li><var>controlled_by_this_extension</var>: controlled by this extension</li></ul>" + }, + { + "id": "Setting", + "type": "object", + "functions": [ + { + "name": "get", + "type": "function", + "description": "Gets the value of a setting.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "description": "Which setting to consider.", + "properties": { + "incognito": { + "type": "boolean", + "optional": true, + "description": "Whether to return the value that applies to the incognito session (default false)." + } + } + }, + { + "name": "callback", + "type": "function", + "parameters": [ + { + "name": "details", + "type": "object", + "description": "Details of the currently effective value.", + "properties": { + "value": { + "description": "The value of the setting.", + "type": "any" + }, + "levelOfControl": { + "$ref": "types.LevelOfControl", + "description": "The level of control of the setting." + }, + "incognitoSpecific": { + "description": "Whether the effective value is specific to the incognito session.<br/>This property will <em>only</em> be present if the <var>incognito</var> property in the <var>details</var> parameter of <code>get()</code> was true.", + "type": "boolean", + "optional": true + } + } + } + ] + } + ] + }, + { + "name": "set", + "type": "function", + "description": "Sets the value of a setting.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "description": "Which setting to change.", + "properties": { + "value": { + "description": "The value of the setting. <br/>Note that every setting has a specific value type, which is described together with the setting. An extension should <em>not</em> set a value of a different type.", + "type": "any" + }, + "scope": { + "$ref": "types.SettingScope", + "optional": true, + "description": "Where to set the setting (default: regular)." + } + } + }, + { + "name": "callback", + "type": "function", + "description": "Called at the completion of the set operation.", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "clear", + "type": "function", + "description": "Clears the setting, restoring any default value.", + "async": "callback", + "parameters": [ + { + "name": "details", + "type": "object", + "description": "Which setting to clear.", + "properties": { + "scope": { + "$ref": "types.SettingScope", + "optional": true, + "description": "Where to clear the setting (default: regular)." + } + } + }, + { + "name": "callback", + "type": "function", + "description": "Called at the completion of the clear operation.", + "optional": true, + "parameters": [] + } + ] + } + ], + "events": [ + { + "name": "onChange", + "type": "function", + "description": "Fired after the setting changes.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "value": { + "description": "The value of the setting after the change.", + "type": "any" + }, + "levelOfControl": { + "$ref": "types.LevelOfControl", + "description": "The level of control of the setting." + }, + "incognitoSpecific": { + "description": "Whether the value that has changed is specific to the incognito session.<br/>This property will <em>only</em> be present if the user has enabled the extension in incognito mode.", + "type": "boolean", + "optional": true + } + } + } + ] + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/user_scripts.json b/toolkit/components/extensions/schemas/user_scripts.json new file mode 100644 index 0000000000..a5120cb372 --- /dev/null +++ b/toolkit/components/extensions/schemas/user_scripts.json @@ -0,0 +1,136 @@ +/* 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/. */ + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "WebExtensionManifest", + "properties": { + "user_scripts": { + "type": "object", + "max_manifest_version": 2, + "optional": true, + "properties": { + "api_script": { + "optional": true, + "$ref": "manifest.ExtensionURL" + } + }, + "additionalProperties": { "$ref": "UnrecognizedProperty" } + } + } + } + ] + }, + { + "namespace": "userScripts", + "max_manifest_version": 2, + "permissions": ["manifest:user_scripts"], + "types": [ + { + "id": "UserScriptOptions", + "type": "object", + "description": "Details of a user script", + "properties": { + "js": { + "type": "array", + "optional": false, + "description": "The list of JS files to inject", + "minItems": 1, + "items": { "$ref": "extensionTypes.ExtensionFileOrCode" } + }, + "scriptMetadata": { + "description": "An opaque user script metadata value", + "$ref": "extensionTypes.PlainJSONValue", + "optional": true + }, + "matches": { + "type": "array", + "optional": false, + "minItems": 1, + "items": { "$ref": "manifest.MatchPattern" } + }, + "excludeMatches": { + "type": "array", + "optional": true, + "minItems": 1, + "items": { "$ref": "manifest.MatchPattern" } + }, + "includeGlobs": { + "type": "array", + "optional": true, + "items": { "type": "string" } + }, + "excludeGlobs": { + "type": "array", + "optional": true, + "items": { "type": "string" } + }, + "allFrames": { + "type": "boolean", + "default": false, + "optional": true, + "description": "If allFrames is <code>true</code>, implies that the JavaScript should be injected into all frames of current page. By default, it's <code>false</code> and is only injected into the top frame." + }, + "matchAboutBlank": { + "type": "boolean", + "default": false, + "optional": true, + "description": "If matchAboutBlank is true, then the code is also injected in about:blank and about:srcdoc frames if your extension has access to its parent document. Code cannot be inserted in top-level about:-frames. By default it is <code>false</code>." + }, + "runAt": { + "$ref": "extensionTypes.RunAt", + "default": "document_idle", + "optional": true, + "description": "The soonest that the JavaScript will be injected into the tab. Defaults to \"document_idle\"." + }, + "cookieStoreId": { + "choices": [ + { + "type": "array", + "minItems": 1, + "items": { "type": "string" } + }, + { + "type": "string" + } + ], + "optional": true, + "description": "limit the set of matched tabs to those that belong to the given cookie store id" + } + } + }, + { + "id": "RegisteredUserScript", + "type": "object", + "description": "An object that represents a user script registered programmatically", + "functions": [ + { + "name": "unregister", + "type": "function", + "description": "Unregister a user script registered programmatically", + "async": true, + "parameters": [] + } + ] + } + ], + "functions": [ + { + "name": "register", + "type": "function", + "description": "Register a user script programmatically given its $(ref:userScripts.UserScriptOptions), and resolves to a $(ref:userScripts.RegisteredUserScript) instance", + "async": true, + "parameters": [ + { + "name": "userScriptOptions", + "$ref": "UserScriptOptions" + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/user_scripts_content.json b/toolkit/components/extensions/schemas/user_scripts_content.json new file mode 100644 index 0000000000..252336c423 --- /dev/null +++ b/toolkit/components/extensions/schemas/user_scripts_content.json @@ -0,0 +1,62 @@ +/* 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/. */ + +[ + { + "namespace": "userScripts", + "max_manifest_version": 2, + "permissions": ["manifest:user_scripts"], + "allowedContexts": ["content"], + "events": [ + { + "name": "onBeforeScript", + "permissions": ["manifest:user_scripts.api_script"], + "allowedContexts": ["content", "content_only"], + "type": "function", + "description": "Event called when a new userScript global has been created", + "parameters": [ + { + "type": "object", + "name": "userScript", + "properties": { + "metadata": { + "type": "any", + "description": "The userScript metadata (as set in userScripts.register)" + }, + "global": { + "type": "any", + "description": "The userScript global" + }, + "defineGlobals": { + "type": "function", + "description": "Exports all the properties of a given plain object as userScript globals", + "parameters": [ + { + "type": "object", + "name": "sourceObject", + "description": "A plain object whose properties are exported as userScript globals" + } + ] + }, + "export": { + "type": "function", + "description": "Convert a given value to make it accessible to the userScript code", + "parameters": [ + { + "type": "any", + "name": "value", + "description": "A value to convert into an object accessible to the userScript" + } + ], + "returns": { + "type": "any" + } + } + } + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/web_navigation.json b/toolkit/components/extensions/schemas/web_navigation.json new file mode 100644 index 0000000000..083abc1f55 --- /dev/null +++ b/toolkit/components/extensions/schemas/web_navigation.json @@ -0,0 +1,583 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermission", + "choices": [ + { + "type": "string", + "enum": ["webNavigation"] + } + ] + } + ] + }, + { + "namespace": "webNavigation", + "description": "Use the <code>browser.webNavigation</code> API to receive notifications about the status of navigation requests in-flight.", + "permissions": ["webNavigation"], + "types": [ + { + "id": "TransitionType", + "type": "string", + "enum": [ + "link", + "typed", + "auto_bookmark", + "auto_subframe", + "manual_subframe", + "generated", + "start_page", + "form_submit", + "reload", + "keyword", + "keyword_generated" + ], + "description": "Cause of the navigation. The same transition types as defined in the history API are used. These are the same transition types as defined in the $(topic:transition_types)[history API] except with <code>\"start_page\"</code> in place of <code>\"auto_toplevel\"</code> (for backwards compatibility)." + }, + { + "id": "TransitionQualifier", + "type": "string", + "enum": [ + "client_redirect", + "server_redirect", + "forward_back", + "from_address_bar" + ] + }, + { + "id": "EventUrlFilters", + "type": "object", + "properties": { + "url": { + "type": "array", + "minItems": 1, + "items": { "$ref": "events.UrlFilter" } + } + } + } + ], + "functions": [ + { + "name": "getFrame", + "type": "function", + "description": "Retrieves information about the given frame. A frame refers to an <iframe> or a <frame> of a web page and is identified by a tab ID and a frame ID.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Information about the frame to retrieve information about.", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the tab in which the frame is." + }, + "processId": { + "optional": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the frame in the given tab." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "optional": true, + "description": "Information about the requested frame, null if the specified frame ID and/or tab ID are invalid.", + "properties": { + "errorOccurred": { + "optional": true, + "type": "boolean", + "description": "True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired." + }, + "url": { + "type": "string", + "description": "The URL currently associated with this frame, if the frame identified by the frameId existed at one point in the given tab. The fact that an URL is associated with a given frameId does not imply that the corresponding frame still exists." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the frame is." + }, + "frameId": { + "type": "integer", + "description": "The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame. Set to -1 of no parent frame exists." + } + } + } + ] + } + ] + }, + { + "name": "getAllFrames", + "type": "function", + "description": "Retrieves information about all frames of a given tab.", + "async": "callback", + "parameters": [ + { + "type": "object", + "name": "details", + "description": "Information about the tab to retrieve all frames from.", + "properties": { + "tabId": { + "type": "integer", + "minimum": 0, + "description": "The ID of the tab." + } + } + }, + { + "type": "function", + "name": "callback", + "parameters": [ + { + "name": "details", + "type": "array", + "description": "A list of frames in the given tab, null if the specified tab ID is invalid.", + "optional": true, + "items": { + "type": "object", + "properties": { + "errorOccurred": { + "optional": true, + "type": "boolean", + "description": "True if the last navigation in this frame was interrupted by an error, i.e. the onErrorOccurred event fired." + }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the frame is." + }, + "frameId": { + "type": "integer", + "description": "The ID of the frame. 0 indicates that this is the main frame; a positive value indicates the ID of a subframe." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame. Set to -1 of no parent frame exists." + }, + "url": { + "type": "string", + "description": "The URL currently associated with this frame." + } + } + } + } + ] + } + ] + } + ], + "events": [ + { + "name": "onBeforeNavigate", + "type": "function", + "description": "Fired when a navigation is about to occur.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation is about to occur." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique for a given tab and process." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame. Set to -1 of no parent frame exists." + }, + "timeStamp": { + "type": "number", + "description": "The time when the browser was about to start the navigation, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onCommitted", + "type": "function", + "description": "Fired when a navigation is committed. The document (and the resources it refers to, such as images and subframes) might still be downloading, but at least part of the document has been received from the server and the browser has decided to switch to the new document.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation occurs." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab." + }, + "transitionType": { + "unsupported": true, + "$ref": "TransitionType", + "description": "Cause of the navigation." + }, + "transitionQualifiers": { + "unsupported": true, + "type": "array", + "description": "A list of transition qualifiers.", + "items": { "$ref": "TransitionQualifier" } + }, + "timeStamp": { + "type": "number", + "description": "The time when the navigation was committed, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onDOMContentLoaded", + "type": "function", + "description": "Fired when the page's DOM is fully constructed, but the referenced resources may not finish loading.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation occurs." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab." + }, + "timeStamp": { + "type": "number", + "description": "The time when the page's DOM was fully constructed, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onCompleted", + "type": "function", + "description": "Fired when a document, including the resources it refers to, is completely loaded and initialized.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation occurs." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab." + }, + "timeStamp": { + "type": "number", + "description": "The time when the document finished loading, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onErrorOccurred", + "type": "function", + "description": "Fired when an error occurs and the navigation is aborted. This can happen if either a network error occurred, or the user aborted the navigation.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation occurs." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab." + }, + "error": { + "unsupported": true, + "type": "string", + "description": "The error description." + }, + "timeStamp": { + "type": "number", + "description": "The time when the error occurred, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onCreatedNavigationTarget", + "type": "function", + "description": "Fired when a new window, or a new tab in an existing window, is created to host a navigation.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "sourceTabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation is triggered." + }, + "sourceProcessId": { + "type": "integer", + "description": "The ID of the process runs the renderer for the source tab." + }, + "sourceFrameId": { + "type": "integer", + "description": "The ID of the frame with sourceTabId in which the navigation is triggered. 0 indicates the main frame." + }, + "url": { + "type": "string", + "description": "The URL to be opened in the new window." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the url is opened" + }, + "timeStamp": { + "type": "number", + "description": "The time when the browser was about to create a new view, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onReferenceFragmentUpdated", + "type": "function", + "description": "Fired when the reference fragment of a frame was updated. All future events for that frame will use the updated URL.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation occurs." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab." + }, + "transitionType": { + "unsupported": true, + "$ref": "TransitionType", + "description": "Cause of the navigation." + }, + "transitionQualifiers": { + "unsupported": true, + "type": "array", + "description": "A list of transition qualifiers.", + "items": { "$ref": "TransitionQualifier" } + }, + "timeStamp": { + "type": "number", + "description": "The time when the navigation was committed, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + }, + { + "name": "onTabReplaced", + "type": "function", + "description": "Fired when the contents of the tab is replaced by a different (usually previously pre-rendered) tab.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "replacedTabId": { + "type": "integer", + "description": "The ID of the tab that was replaced." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab that replaced the old tab." + }, + "timeStamp": { + "type": "number", + "description": "The time when the replacement happened, in milliseconds since the epoch." + } + } + } + ] + }, + { + "name": "onHistoryStateUpdated", + "type": "function", + "description": "Fired when the frame's history was updated to a new URL. All future events for that frame will use the updated URL.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the navigation occurs." + }, + "url": { "type": "string" }, + "processId": { + "unsupported": true, + "type": "integer", + "description": "The ID of the process runs the renderer for this tab." + }, + "frameId": { + "type": "integer", + "description": "0 indicates the navigation happens in the tab content window; a positive value indicates navigation in a subframe. Frame IDs are unique within a tab." + }, + "transitionType": { + "unsupported": true, + "$ref": "TransitionType", + "description": "Cause of the navigation." + }, + "transitionQualifiers": { + "unsupported": true, + "type": "array", + "description": "A list of transition qualifiers.", + "items": { "$ref": "TransitionQualifier" } + }, + "timeStamp": { + "type": "number", + "description": "The time when the navigation was committed, in milliseconds since the epoch." + } + } + } + ], + "extraParameters": [ + { + "name": "filters", + "optional": true, + "$ref": "EventUrlFilters", + "description": "Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event." + } + ] + } + ] + } +] diff --git a/toolkit/components/extensions/schemas/web_request.json b/toolkit/components/extensions/schemas/web_request.json new file mode 100644 index 0000000000..59b2a306f1 --- /dev/null +++ b/toolkit/components/extensions/schemas/web_request.json @@ -0,0 +1,1479 @@ +// 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 file. + +[ + { + "namespace": "manifest", + "types": [ + { + "$extend": "OptionalPermissionNoPrompt", + "choices": [ + { + "type": "string", + "enum": [ + "webRequest", + "webRequestBlocking", + "webRequestFilterResponse", + "webRequestFilterResponse.serviceWorkerScript" + ] + } + ] + } + ] + }, + { + "namespace": "webRequest", + "description": "Use the <code>browser.webRequest</code> API to observe and analyze traffic and to intercept, block, or modify requests in-flight.", + "permissions": ["webRequest"], + "properties": { + "MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES": { + "value": 20, + "description": "The maximum number of times that <code>handlerBehaviorChanged</code> can be called per 10 minute sustained interval. <code>handlerBehaviorChanged</code> is an expensive function call that shouldn't be called often." + } + }, + "types": [ + { + "id": "ResourceType", + "type": "string", + "enum": [ + "main_frame", + "sub_frame", + "stylesheet", + "script", + "image", + "object", + "object_subrequest", + "xmlhttprequest", + "xslt", + "ping", + "beacon", + "xml_dtd", + "font", + "media", + "websocket", + "csp_report", + "imageset", + "web_manifest", + "speculative", + "other" + ] + }, + { + "id": "OnBeforeRequestOptions", + "type": "string", + "enum": ["blocking", "requestBody"], + "postprocess": "webRequestBlockingPermissionRequired" + }, + { + "id": "OnBeforeSendHeadersOptions", + "type": "string", + "enum": ["requestHeaders", "blocking"], + "postprocess": "webRequestBlockingPermissionRequired" + }, + { + "id": "OnSendHeadersOptions", + "type": "string", + "enum": ["requestHeaders"] + }, + { + "id": "OnHeadersReceivedOptions", + "type": "string", + "enum": ["blocking", "responseHeaders"], + "postprocess": "webRequestBlockingPermissionRequired" + }, + { + "id": "OnAuthRequiredOptions", + "type": "string", + "enum": ["responseHeaders", "blocking", "asyncBlocking"], + "postprocess": "webRequestBlockingPermissionRequired" + }, + { + "id": "OnResponseStartedOptions", + "type": "string", + "enum": ["responseHeaders"] + }, + { + "id": "OnBeforeRedirectOptions", + "type": "string", + "enum": ["responseHeaders"] + }, + { + "id": "OnCompletedOptions", + "type": "string", + "enum": ["responseHeaders"] + }, + { + "id": "RequestFilter", + "type": "object", + "description": "An object describing filters to apply to webRequest events.", + "properties": { + "urls": { + "type": "array", + "description": "A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out.", + "items": { "type": "string" }, + "minItems": 1 + }, + "types": { + "type": "array", + "optional": true, + "description": "A list of request types. Requests that cannot match any of the types will be filtered out.", + "items": { "$ref": "ResourceType", "onError": "warn" }, + "minItems": 1 + }, + "tabId": { "type": "integer", "optional": true }, + "windowId": { "type": "integer", "optional": true }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "If provided, requests that do not match the incognito state will be filtered out." + } + } + }, + { + "id": "HttpHeaders", + "type": "array", + "description": "An array of HTTP headers. Each header is represented as a dictionary containing the keys <code>name</code> and either <code>value</code> or <code>binaryValue</code>.", + "items": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Name of the HTTP header." + }, + "value": { + "type": "string", + "optional": true, + "description": "Value of the HTTP header if it can be represented by UTF-8." + }, + "binaryValue": { + "type": "array", + "optional": true, + "description": "Value of the HTTP header if it cannot be represented by UTF-8, stored as individual byte values (0..255).", + "items": { "type": "integer" } + } + } + } + }, + { + "id": "BlockingResponse", + "type": "object", + "description": "Returns value for event handlers that have the 'blocking' extraInfoSpec applied. Allows the event handler to modify network requests.", + "properties": { + "cancel": { + "type": "boolean", + "optional": true, + "description": "If true, the request is cancelled. Used in onBeforeRequest, this prevents the request from being sent." + }, + "redirectUrl": { + "type": "string", + "optional": true, + "description": "Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, the original request is prevented from being sent/completed and is instead redirected to the given URL. Redirections to non-HTTP schemes such as data: are allowed. Redirects initiated by a redirect action use the original request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, then the redirect will be issued using the GET method." + }, + "upgradeToSecure": { + "type": "boolean", + "optional": true, + "description": "Only used as a response to the onBeforeRequest event. If set, the original request is prevented from being sent/completed and is instead upgraded to a secure request. If any extension returns <code>redirectUrl</code> during onBeforeRequest, <code>upgradeToSecure</code> will have no affect." + }, + "requestHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead." + }, + "responseHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "Only used as a response to the onHeadersReceived event. If set, the server is assumed to have responded with these response headers instead. Only return <code>responseHeaders</code> if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify <code>responseHeaders</code> for each request)." + }, + "authCredentials": { + "type": "object", + "description": "Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials.", + "optional": true, + "properties": { + "username": { "type": "string" }, + "password": { "type": "string" } + } + } + } + }, + { + "id": "CertificateInfo", + "type": "object", + "description": "Contains the certificate properties of the request if it is a secure request.", + "properties": { + "subject": { + "type": "string" + }, + "issuer": { + "type": "string" + }, + "validity": { + "type": "object", + "description": "Contains start and end timestamps.", + "properties": { + "start": { "type": "integer" }, + "end": { "type": "integer" } + } + }, + "fingerprint": { + "type": "object", + "properties": { + "sha1": { "type": "string" }, + "sha256": { "type": "string" } + } + }, + "serialNumber": { + "type": "string" + }, + "isBuiltInRoot": { + "type": "boolean" + }, + "subjectPublicKeyInfoDigest": { + "type": "object", + "properties": { + "sha256": { "type": "string" } + } + }, + "rawDER": { + "optional": true, + "type": "array", + "items": { + "type": "integer" + } + } + } + }, + { + "id": "CertificateTransparencyStatus", + "type": "string", + "enum": [ + "not_applicable", + "policy_compliant", + "policy_not_enough_scts", + "policy_not_diverse_scts" + ] + }, + { + "id": "TransportWeaknessReasons", + "type": "string", + "enum": ["cipher"] + }, + { + "id": "SecurityInfo", + "type": "object", + "description": "Contains the security properties of the request (ie. SSL/TLS information).", + "properties": { + "state": { + "type": "string", + "enum": ["insecure", "weak", "broken", "secure"] + }, + "errorMessage": { + "type": "string", + "description": "Error message if state is \"broken\"", + "optional": true + }, + "protocolVersion": { + "type": "string", + "description": "Protocol version if state is \"secure\"", + "enum": ["TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3", "unknown"], + "optional": true + }, + "cipherSuite": { + "type": "string", + "description": "The cipher suite used in this request if state is \"secure\".", + "optional": true + }, + "keaGroupName": { + "type": "string", + "description": "The key exchange algorithm used in this request if state is \"secure\".", + "optional": true + }, + "secretKeyLength": { + "type": "number", + "description": "The length (in bits) of the secret key.", + "optional": true + }, + "signatureSchemeName": { + "type": "string", + "description": "The signature scheme used in this request if state is \"secure\".", + "optional": true + }, + "certificates": { + "description": "Certificate data if state is \"secure\". Will only contain one entry unless <code>certificateChain</code> is passed as an option.", + "type": "array", + "items": { "$ref": "CertificateInfo" } + }, + "overridableErrorCategory": { + "description": "The type of certificate error that was overridden for this connection, if any.", + "type": "string", + "enum": [ + "trust_error", + "domain_mismatch", + "expired_or_not_yet_valid" + ], + "optional": true + }, + "isDomainMismatch": { + "description": "The domain name does not match the certificate domain.", + "type": "boolean", + "optional": true, + "deprecated": "Please use $(ref:SecurityInfo.overridableErrorCategory)." + }, + "isNotValidAtThisTime": { + "description": "The certificate is either expired or is not yet valid. See <code>CertificateInfo.validity</code> for start and end dates.", + "type": "boolean", + "optional": true, + "deprecated": "Please use $(ref:SecurityInfo.overridableErrorCategory)." + }, + "isUntrusted": { + "type": "boolean", + "optional": true, + "deprecated": "Please use $(ref:SecurityInfo.overridableErrorCategory)." + }, + "isExtendedValidation": { + "type": "boolean", + "optional": true + }, + "certificateTransparencyStatus": { + "description": "Certificate transparency compliance per RFC 6962. See <code>https://www.certificate-transparency.org/what-is-ct</code> for more information.", + "$ref": "CertificateTransparencyStatus", + "optional": true + }, + "hsts": { + "type": "boolean", + "description": "True if host uses Strict Transport Security and state is \"secure\".", + "optional": true + }, + "hpkp": { + "type": "string", + "description": "True if host uses Public Key Pinning and state is \"secure\".", + "optional": true + }, + "weaknessReasons": { + "type": "array", + "items": { "$ref": "TransportWeaknessReasons" }, + "description": "list of reasons that cause the request to be considered weak, if state is \"weak\"", + "optional": true + }, + "usedEch": { + "type": "boolean", + "description": "True if the TLS connection used Encrypted Client Hello.", + "optional": true + }, + "usedDelegatedCredentials": { + "type": "boolean", + "description": "True if the TLS connection used Delegated Credentials.", + "optional": true + }, + "usedOcsp": { + "type": "boolean", + "description": "True if the TLS connection made OCSP requests.", + "optional": true + }, + "usedPrivateDns": { + "type": "boolean", + "description": "True if the TLS connection used a privacy-preserving DNS transport like DNS-over-HTTPS.", + "optional": true + } + } + }, + { + "id": "UploadData", + "type": "object", + "properties": { + "bytes": { + "type": "any", + "optional": true, + "description": "An ArrayBuffer with a copy of the data." + }, + "file": { + "type": "string", + "optional": true, + "description": "A string with the file's path and name." + } + }, + "description": "Contains data uploaded in a URL request." + }, + { + "id": "UrlClassificationFlags", + "type": "string", + "enum": [ + "fingerprinting", + "fingerprinting_content", + "cryptomining", + "cryptomining_content", + "emailtracking", + "emailtracking_content", + "tracking", + "tracking_ad", + "tracking_analytics", + "tracking_social", + "tracking_content", + "any_basic_tracking", + "any_strict_tracking", + "any_social_tracking" + ], + "description": "Tracking flags that match our internal tracking classification" + }, + { + "id": "UrlClassificationParty", + "type": "array", + "items": { "$ref": "UrlClassificationFlags" }, + "description": "If the request has been classified this is an array of $(ref:UrlClassificationFlags)." + }, + { + "id": "UrlClassification", + "type": "object", + "properties": { + "firstParty": { + "$ref": "UrlClassificationParty", + "description": "Classification flags if the request has been classified and it is first party." + }, + "thirdParty": { + "$ref": "UrlClassificationParty", + "description": "Classification flags if the request has been classified and it or its window hierarchy is third party." + } + } + } + ], + "functions": [ + { + "name": "handlerBehaviorChanged", + "type": "function", + "description": "Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. This function call is expensive. Don't call it often.", + "async": "callback", + "parameters": [ + { + "type": "function", + "name": "callback", + "optional": true, + "parameters": [] + } + ] + }, + { + "name": "filterResponseData", + "permissions": ["webRequestBlocking"], + "type": "function", + "description": "...", + "parameters": [ + { + "name": "requestId", + "type": "string" + } + ], + "returns": { + "type": "object", + "additionalProperties": { "type": "any" }, + "isInstanceOf": "StreamFilter" + } + }, + { + "name": "getSecurityInfo", + "type": "function", + "async": true, + "description": "Retrieves the security information for the request. Returns a promise that will resolve to a SecurityInfo object.", + "parameters": [ + { + "name": "requestId", + "type": "string" + }, + { + "name": "options", + "optional": true, + "type": "object", + "properties": { + "certificateChain": { + "type": "boolean", + "description": "Include the entire certificate chain.", + "optional": true + }, + "rawDER": { + "type": "boolean", + "description": "Include raw certificate data for processing by the extension.", + "optional": true + } + } + } + ] + } + ], + "events": [ + { + "name": "onBeforeRequest", + "type": "function", + "description": "Fired when a request is about to occur.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "requestBody": { + "type": "object", + "optional": true, + "description": "Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.", + "properties": { + "error": { + "type": "string", + "optional": true, + "description": "Errors when obtaining request body data." + }, + "formData": { + "type": "object", + "optional": true, + "description": "If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.", + "properties": {}, + "additionalProperties": { + "type": "array", + "items": { "type": "string" } + } + }, + "raw": { + "type": "array", + "optional": true, + "items": { "$ref": "UploadData" }, + "description": "If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array." + } + } + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnBeforeRequestOptions" + } + } + ], + "returns": { + "$ref": "BlockingResponse", + "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.", + "optional": true + } + }, + { + "name": "onBeforeSendHeaders", + "type": "function", + "description": "Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any HTTP data is sent. ", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "requestHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP request headers that are going to be sent out with this request." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnBeforeSendHeadersOptions" + } + } + ], + "returns": { + "$ref": "BlockingResponse", + "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.", + "optional": true + } + }, + { + "name": "onSendHeaders", + "type": "function", + "description": "Fired just before a request is going to be sent to the server (modifications of previous onBeforeSendHeaders callbacks are visible by the time onSendHeaders is fired).", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "requestHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP request headers that have been sent out with this request." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnSendHeadersOptions" + } + } + ] + }, + { + "name": "onHeadersReceived", + "type": "function", + "description": "Fired when HTTP response headers of a request have been received.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "statusLine": { + "type": "string", + "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line)." + }, + "responseHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP response headers that have been received with this response." + }, + "statusCode": { + "type": "integer", + "description": "Standard HTTP status code returned by the server." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnHeadersReceivedOptions" + } + } + ], + "returns": { + "$ref": "BlockingResponse", + "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.", + "optional": true + } + }, + { + "name": "onAuthRequired", + "type": "function", + "description": "Fired when an authentication failure is received. The listener has three options: it can provide authentication credentials, it can cancel the request and display the error page, or it can take no action on the challenge. If bad user credentials are provided, this may be called multiple times for the same request.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "scheme": { + "type": "string", + "description": "The authentication scheme, e.g. Basic or Digest." + }, + "realm": { + "type": "string", + "description": "The authentication realm provided by the server, if there is one.", + "optional": true + }, + "challenger": { + "type": "object", + "description": "The server requesting authentication.", + "properties": { + "host": { "type": "string" }, + "port": { "type": "integer" } + } + }, + "isProxy": { + "type": "boolean", + "description": "True for Proxy-Authenticate, false for WWW-Authenticate." + }, + "responseHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP response headers that were received along with this response." + }, + "statusLine": { + "type": "string", + "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers." + }, + "statusCode": { + "type": "integer", + "description": "Standard HTTP status code returned by the server." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + }, + { + "type": "function", + "optional": true, + "name": "callback", + "parameters": [{ "name": "response", "$ref": "BlockingResponse" }] + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnAuthRequiredOptions" + } + } + ], + "returns": { + "$ref": "BlockingResponse", + "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.", + "optional": true + } + }, + { + "name": "onResponseStarted", + "type": "function", + "description": "Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "ip": { + "type": "string", + "optional": true, + "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address." + }, + "fromCache": { + "type": "boolean", + "description": "Indicates if this response was fetched from disk cache." + }, + "statusCode": { + "type": "integer", + "description": "Standard HTTP status code returned by the server." + }, + "responseHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP response headers that were received along with this response." + }, + "statusLine": { + "type": "string", + "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnResponseStartedOptions" + } + } + ] + }, + { + "name": "onBeforeRedirect", + "type": "function", + "description": "Fired when a server-initiated redirect is about to occur.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "ip": { + "type": "string", + "optional": true, + "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address." + }, + "fromCache": { + "type": "boolean", + "description": "Indicates if this response was fetched from disk cache." + }, + "statusCode": { + "type": "integer", + "description": "Standard HTTP status code returned by the server." + }, + "redirectUrl": { + "type": "string", + "description": "The new URL." + }, + "responseHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP response headers that were received along with this redirect." + }, + "statusLine": { + "type": "string", + "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnBeforeRedirectOptions" + } + } + ] + }, + { + "name": "onCompleted", + "type": "function", + "description": "Fired when a request is completed.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "ip": { + "type": "string", + "optional": true, + "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address." + }, + "fromCache": { + "type": "boolean", + "description": "Indicates if this response was fetched from disk cache." + }, + "statusCode": { + "type": "integer", + "description": "Standard HTTP status code returned by the server." + }, + "responseHeaders": { + "$ref": "HttpHeaders", + "optional": true, + "description": "The HTTP response headers that were received along with this response." + }, + "statusLine": { + "type": "string", + "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers." + }, + "urlClassification": { + "$ref": "UrlClassification", + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + }, + "requestSize": { + "type": "integer", + "description": "For http requests, the bytes transferred in the request. Only available in onCompleted." + }, + "responseSize": { + "type": "integer", + "description": "For http requests, the bytes received in the request. Only available in onCompleted." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + }, + { + "type": "array", + "optional": true, + "name": "extraInfoSpec", + "description": "Array of extra information that should be passed to the listener function.", + "items": { + "$ref": "OnCompletedOptions" + } + } + ] + }, + { + "name": "onErrorOccurred", + "type": "function", + "description": "Fired when an error occurs.", + "parameters": [ + { + "type": "object", + "name": "details", + "properties": { + "requestId": { + "type": "string", + "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request." + }, + "url": { "type": "string" }, + "method": { + "type": "string", + "description": "Standard HTTP method." + }, + "frameId": { + "type": "integer", + "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab." + }, + "parentFrameId": { + "type": "integer", + "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists." + }, + "incognito": { + "type": "boolean", + "optional": true, + "description": "True for private browsing requests." + }, + "cookieStoreId": { + "type": "string", + "optional": true, + "description": "The cookie store ID of the contextual identity." + }, + "originUrl": { + "type": "string", + "optional": true, + "description": "URL of the resource that triggered this request." + }, + "documentUrl": { + "type": "string", + "optional": true, + "description": "URL of the page into which the requested resource will be loaded." + }, + "tabId": { + "type": "integer", + "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab." + }, + "type": { + "$ref": "ResourceType", + "description": "How the requested resource will be used." + }, + "timeStamp": { + "type": "number", + "description": "The time when this signal is triggered, in milliseconds since the epoch." + }, + "ip": { + "type": "string", + "optional": true, + "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address." + }, + "fromCache": { + "type": "boolean", + "description": "Indicates if this response was fetched from disk cache." + }, + "error": { + "type": "string", + "description": "The error description. This string is <em>not</em> guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content." + }, + "urlClassification": { + "$ref": "UrlClassification", + "optional": true, + "description": "Tracking classification if the request has been classified." + }, + "thirdParty": { + "type": "boolean", + "description": "Indicates if this request and its content window hierarchy is third party." + } + } + } + ], + "extraParameters": [ + { + "$ref": "RequestFilter", + "name": "filter", + "description": "A set of filters that restricts the events that will be sent to this listener." + } + ] + } + ] + } +] |