toolkit/components/extensions/schemas/manifest.json
author Shane Caraveo <scaraveo@mozilla.com>
Wed, 07 Jun 2017 12:16:14 -0700
changeset 363090 62e44a82730804257046e8fe9aafd8d53652d6ea
parent 358359 02c060b287ffd5a1dbca8f9ebd4c339f91beebf6
child 365225 6ce22ac573a71d1386a1624371a95ce6dd896174
child 365427 b04ed6a0a52af869867351bc0a10e86033e718e8
permissions -rw-r--r--
Bug 1367478 support websocket ws/wss protocol in matchpattern, r=kmag MozReview-Commit-ID: 6cnRyWRnRzT

[
  {
    "namespace": "manifest",
    "permissions": [],
    "types": [
      {
        "id": "WebExtensionManifest",
        "type": "object",
        "description": "Represents a WebExtension manifest.json file",
        "properties": {
          "manifest_version": {
            "type": "integer",
            "minimum": 2,
            "maximum": 2
          },

          "minimum_chrome_version":{
            "type": "string",
            "optional": true
          },

          "applications": {
            "type": "object",
            "optional": true,
            "properties": {
              "gecko": {
                "$ref": "FirefoxSpecificProperties",
                "optional": true
              }
            }
          },

          "browser_specific_settings": {
            "type": "object",
            "optional": true,
            "properties": {
              "gecko": {
                "$ref": "FirefoxSpecificProperties",
                "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
          },

          "homepage_url": {
            "type": "string",
            "format": "url",
            "optional": true,
            "preprocess": "localize"
          },

          "icons": {
            "type": "object",
            "optional": true,
            "patternProperties": {
              "^[1-9]\\d*$": { "type": "string" }
            }
          },

          "incognito": {
            "type": "string",
            "enum": ["spanning"],
            "optional": true,
            "onError": "warn"
          },

          "background": {
            "choices": [
              {
                "type": "object",
                "properties": {
                  "page": { "$ref": "ExtensionURL" },
                  "persistent": {
                    "optional": true,
                    "$ref": "PersistentBackgroundProperty"
                  }
                },
                "additionalProperties": { "$ref": "UnrecognizedProperty" }
              },
              {
                "type": "object",
                "properties": {
                  "scripts": {
                    "type": "array",
                    "items": { "$ref": "ExtensionURL" }
                  },
                  "persistent": {
                    "optional": true,
                    "$ref": "PersistentBackgroundProperty"
                  }
                },
                "additionalProperties": { "$ref": "UnrecognizedProperty" }
              }
            ],
            "optional": true
          },

          "options_ui": {
            "type": "object",

            "optional": true,

            "properties": {
              "page": { "$ref": "ExtensionURL" },
              "browser_style": {
                "type": "boolean",
                "optional": true
              },
              "chrome_style": {
                "type": "boolean",
                "optional": true
              },
              "open_in_tab": {
                "type": "boolean",
                "optional": true
              }
            },

            "additionalProperties": {
              "type": "any",
              "deprecated": "An unexpected property was found in the WebExtension manifest"
            }
          },

          "content_scripts": {
            "type": "array",
            "optional": true,
            "items": { "$ref": "ContentScript" }
          },

          "content_security_policy": {
            "type": "string",
            "optional": true,
            "format": "contentSecurityPolicy",
            "onError": "warn"
          },

          "permissions": {
            "type": "array",
            "default": [],
            "items": {
              "choices": [
                { "$ref": "Permission" },
                {
                  "type": "string",
                  "deprecated": "Unknown permission ${value}"
                }
              ]
            },
            "optional": true
          },

          "optional_permissions": {
            "type": "array",
            "items": {
              "choices": [
                { "$ref": "OptionalPermission" },
                {
                  "type": "string",
                  "deprecated": "Unknown optional permission ${value}"
                }
              ]
            },
            "optional": true,
            "default": []
          },

          "web_accessible_resources": {
            "type": "array",
            "items": { "type": "string" },
            "optional": true
          },

          "developer": {
            "type": "object",
            "optional": true,
            "properties": {
              "name": {
                "type": "string",
                "optional": true,
                "preprocess": "localize"
              },
              "url": {
                "type": "string",
                "optional": true,
                "preprocess": "localize"
              }
            }
          }

        },

        "additionalProperties": { "$ref": "UnrecognizedProperty" }
      },
      {
        "id": "OptionalPermission",
        "choices": [
          {
            "type": "string",
            "enum": [
              "clipboardRead",
              "clipboardWrite",
              "geolocation",
              "idle",
              "notifications"
            ]
          },
          { "$ref": "MatchPattern" }
        ]
      },
      {
        "id": "Permission",
        "choices": [
          { "$ref": "OptionalPermission" },
          {
            "type": "string",
            "enum": [
              "alarms",
              "storage"
            ]
          }
        ]
      },
      {
        "id": "HttpURL",
        "type": "string",
        "format": "url",
        "pattern": "^https?://.*$"
      },
      {
        "id": "ExtensionURL",
        "type": "string",
        "format": "strictRelativeUrl"
      },
      {
        "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": "MatchPattern",
        "choices": [
          {
            "type": "string",
            "enum": ["<all_urls>"]
          },
          {
            "type": "string",
            "pattern": "^(https?|wss?|file|ftp|\\*)://(\\*|\\*\\.[^*/]+|[^*/]+)/.*$"
          },
          {
            "type": "string",
            "pattern": "^file:///.*$"
          }
        ]
      },
      {
        "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 CSS 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": "ExtensionURL" }
            },
            "additionalProperties": false
          },
          { "$ref": "ExtensionURL" }
        ]
      },
      {
        "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."
      },
      {
        "id": "PersistentBackgroundProperty",
        "type": "boolean",
        "deprecated": "Event pages are not currently supported. This will run as a persistent background page."
      }
    ]
  }
]