Skip to content

Commit

Permalink
Merge pull request #1578 from mstriemer/schema-57
Browse files Browse the repository at this point in the history
Firefox 57 schema import (fixes #1577)
  • Loading branch information
EnTeQuAk committed Oct 6, 2017
2 parents 439a67c + 0c9b65e commit c06c075
Show file tree
Hide file tree
Showing 24 changed files with 809 additions and 60 deletions.
1 change: 1 addition & 0 deletions src/schema/firefox-schemas-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const schemaRegexes = [
export const refMap = {
ExtensionURL: 'manifest#/types/ExtensionURL',
HttpURL: 'manifest#/types/HttpURL',
ImageDataOrExtensionURL: 'manifest#/types/ImageDataOrExtensionURL',
};

// Reference some functions on inner so they can be stubbed in tests.
Expand Down
8 changes: 8 additions & 0 deletions src/schema/formats.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,11 @@ export function isSecureUrl(value) {
// URL is absolute, check against secure protocols.
return ['https:', 'wss:'].includes(url.protocol);
}

export function imageDataOrStrictRelativeUrl(value) {
// Do not accept a string which resolves as an absolute URL, or any
// protocol-relative URL, except PNG or JPG data URLs.
return value.startsWith('data:image/png;base64,')
|| value.startsWith('data:image/jpeg;base64,')
|| isStrictRelativeUrl(value);
}
29 changes: 29 additions & 0 deletions src/schema/imported/bookmarks.json
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,15 @@
],
"description": "Indicates the reason why this node is unmodifiable. The <var>managed</var> value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default)."
},
"BookmarkTreeNodeType": {
"type": "string",
"enum": [
"bookmark",
"folder",
"separator"
],
"description": "Indicates the type of a BookmarkTreeNode, which can be one of bookmark, folder or separator."
},
"BookmarkTreeNode": {
"type": "object",
"description": "A node (either a bookmark or a folder) in the bookmark tree. Child nodes are ordered within their parent folder.",
Expand Down Expand Up @@ -600,6 +609,16 @@
}
]
},
"type": {
"allOf": [
{
"$ref": "#/types/BookmarkTreeNodeType"
},
{
"description": "Indicates the type of the BookmarkTreeNode, which can be one of bookmark, folder or separator."
}
]
},
"children": {
"type": "array",
"items": {
Expand Down Expand Up @@ -630,6 +649,16 @@
},
"url": {
"type": "string"
},
"type": {
"allOf": [
{
"$ref": "#/types/BookmarkTreeNodeType"
},
{
"description": "Indicates the type of BookmarkTreeNode to create, which can be one of bookmark, folder or separator."
}
]
}
}
}
Expand Down
34 changes: 12 additions & 22 deletions src/schema/imported/browser_action.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,10 @@
},
{
"type": "object",
"additionalProperties": {
"$ref": "#/types/ImageDataType"
"patternProperties": {
"^[1-9]\\d*$": {
"$ref": "#/types/ImageDataType"
}
}
}
],
Expand All @@ -95,8 +97,10 @@
},
{
"type": "object",
"additionalProperties": {
"type": "string"
"patternProperties": {
"^[1-9]\\d*$": {
"type": "string"
}
}
}
],
Expand Down Expand Up @@ -352,24 +356,10 @@
{
"name": "openPopup",
"type": "function",
"description": "Opens the extension popup window in the active window but does not grant tab permissions.",
"unsupported": true,
"async": "callback",
"parameters": [
{
"type": "function",
"name": "callback",
"parameters": [
{
"name": "popupView",
"type": "object",
"optional": true,
"description": "JavaScript 'window' object for the popup window if it was succesfully opened.",
"additionalProperties": {}
}
]
}
]
"requireUserInput": true,
"description": "Opens the extension popup window in the active window.",
"async": true,
"parameters": []
}
],
"events": [
Expand Down
58 changes: 54 additions & 4 deletions src/schema/imported/browser_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
"browserSettings"
],
"properties": {
"allowPopupsForUserEvents": {
"allOf": [
{
"$ref": "types#/types/Setting"
},
{
"description": "Allows or disallows pop-up windows from opening in response to user events."
}
]
},
"cacheEnabled": {
"allOf": [
{
Expand All @@ -14,10 +24,40 @@
"description": "Enables or disables the browser cache."
}
]
},
"homepageOverride": {
"allOf": [
{
"$ref": "types#/types/Setting"
},
{
"description": "Returns the value of the overridden home page. Read-only."
}
]
},
"imageAnimationBehavior": {
"allOf": [
{
"$ref": "types#/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": {
"allOf": [
{
"$ref": "types#/types/Setting"
},
{
"description": "Returns the value of the overridden new tab page. Read-only."
}
]
}
},
"definitions": {
"Permission": {
"OptionalPermission": {
"anyOf": [
{
"type": "string",
Expand All @@ -29,10 +69,20 @@
}
},
"refs": {
"browserSettings#/definitions/Permission": {
"browserSettings#/definitions/OptionalPermission": {
"namespace": "manifest",
"type": "Permission"
"type": "OptionalPermission"
}
},
"types": {}
"types": {
"ImageAnimationBehavior": {
"type": "string",
"enum": [
"normal",
"none",
"once"
],
"description": "How images should be animated in the browser."
}
}
}
1 change: 0 additions & 1 deletion src/schema/imported/browsing_data.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@
"description": "Clears websites' local storage data.",
"type": "function",
"async": "callback",
"unsupported": true,
"parameters": [
{
"allOf": [
Expand Down
5 changes: 2 additions & 3 deletions src/schema/imported/chrome_settings_overrides.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
"suggest_url": {
"type": "string",
"format": "url",
"preprocess": "localize",
"deprecated": "Unsupported on Firefox at this time."
"preprocess": "localize"
},
"instant_url": {
"type": "string",
Expand Down Expand Up @@ -81,7 +80,7 @@
},
"is_default": {
"type": "boolean",
"deprecated": "Unsupported on Firefox at this time."
"description": "Sets the default engine to a built-in engine only."
}
},
"required": [
Expand Down
36 changes: 36 additions & 0 deletions src/schema/imported/clipboard.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"id": "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."
}
]
}
],
"definitions": {},
"refs": {},
"types": {}
}
94 changes: 92 additions & 2 deletions src/schema/imported/contextual_identities.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,86 @@
]
}
],
"events": [
{
"name": "onUpdated",
"type": "function",
"description": "Fired when a container is updated.",
"parameters": [
{
"type": "object",
"name": "changeInfo",
"properties": {
"contextualIdentity": {
"allOf": [
{
"$ref": "#/types/ContextualIdentity"
},
{
"description": "Contextual identity that has been updated"
}
]
}
},
"required": [
"contextualIdentity"
]
}
]
},
{
"name": "onCreated",
"type": "function",
"description": "Fired when a new container is created.",
"parameters": [
{
"type": "object",
"name": "changeInfo",
"properties": {
"contextualIdentity": {
"allOf": [
{
"$ref": "#/types/ContextualIdentity"
},
{
"description": "Contextual identity that has been created"
}
]
}
},
"required": [
"contextualIdentity"
]
}
]
},
{
"name": "onRemoved",
"type": "function",
"description": "Fired when a container is removed.",
"parameters": [
{
"type": "object",
"name": "changeInfo",
"properties": {
"contextualIdentity": {
"allOf": [
{
"$ref": "#/types/ContextualIdentity"
},
{
"description": "Contextual identity that has been removed"
}
]
}
},
"required": [
"contextualIdentity"
]
}
]
}
],
"definitions": {
"Permission": {
"anyOf": [
Expand Down Expand Up @@ -144,11 +224,19 @@
},
"icon": {
"type": "string",
"description": "The icon of the contextual identity."
"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 of the contextual identity."
"description": "The color name of the contextual identity."
},
"colorCode": {
"type": "string",
"description": "The color hash of the contextual identity."
},
"cookieStoreId": {
"type": "string",
Expand All @@ -158,7 +246,9 @@
"required": [
"name",
"icon",
"iconUrl",
"color",
"colorCode",
"cookieStoreId"
]
}
Expand Down

0 comments on commit c06c075

Please sign in to comment.