Bug 1290600 - Create the schema for the proxy API. r?aswan draft
authorMatthew Wein <mwein@mozilla.com>
Thu, 28 Jul 2016 17:01:50 -0700
changeset 399734 505e8f4cb8853460cdc6f3958bb3c5eab73a0983
parent 394536 cf23addcfa4d9224a7d186481ecfb48194bb37be
child 528046 caa0ecc8e3815b325c79bc0ab66f1401af12dffc
push id25967
push usermwein@mozilla.com
push dateThu, 11 Aug 2016 23:11:00 +0000
reviewersaswan
bugs1290600
milestone50.0a1
Bug 1290600 - Create the schema for the proxy API. r?aswan MozReview-Commit-ID: EZWOdSl3bun
toolkit/components/extensions/extensions-toolkit.manifest
toolkit/components/extensions/schemas/jar.mn
toolkit/components/extensions/schemas/proxy.json
--- a/toolkit/components/extensions/extensions-toolkit.manifest
+++ b/toolkit/components/extensions/extensions-toolkit.manifest
@@ -19,13 +19,14 @@ category webextension-schemas cookies ch
 category webextension-schemas downloads chrome://extensions/content/schemas/downloads.json
 category webextension-schemas events chrome://extensions/content/schemas/events.json
 category webextension-schemas extension chrome://extensions/content/schemas/extension.json
 category webextension-schemas extension_types chrome://extensions/content/schemas/extension_types.json
 category webextension-schemas i18n chrome://extensions/content/schemas/i18n.json
 category webextension-schemas idle chrome://extensions/content/schemas/idle.json
 category webextension-schemas native_host_manifest chrome://extensions/content/schemas/native_host_manifest.json
 category webextension-schemas notifications chrome://extensions/content/schemas/notifications.json
+category webextension-schemas proxy chrome://extensions/content/schemas/proxy.json
 category webextension-schemas runtime chrome://extensions/content/schemas/runtime.json
 category webextension-schemas storage chrome://extensions/content/schemas/storage.json
 category webextension-schemas test chrome://extensions/content/schemas/test.json
 category webextension-schemas web_navigation chrome://extensions/content/schemas/web_navigation.json
 category webextension-schemas web_request chrome://extensions/content/schemas/web_request.json
\ No newline at end of file
--- a/toolkit/components/extensions/schemas/jar.mn
+++ b/toolkit/components/extensions/schemas/jar.mn
@@ -10,13 +10,14 @@ toolkit.jar:
     content/extensions/schemas/events.json
     content/extensions/schemas/extension.json
     content/extensions/schemas/extension_types.json
     content/extensions/schemas/i18n.json
     content/extensions/schemas/idle.json
     content/extensions/schemas/manifest.json
     content/extensions/schemas/native_host_manifest.json
     content/extensions/schemas/notifications.json
+    content/extensions/schemas/proxy.json
     content/extensions/schemas/runtime.json
     content/extensions/schemas/storage.json
     content/extensions/schemas/test.json
     content/extensions/schemas/web_navigation.json
     content/extensions/schemas/web_request.json
new file mode 100644
--- /dev/null
+++ b/toolkit/components/extensions/schemas/proxy.json
@@ -0,0 +1,200 @@
+// 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": "Permission",
+        "choices": [{
+          "type": "string",
+          "enum": [
+            "proxy"
+          ]
+        }]
+      }
+    ]
+  },
+  {
+    "namespace": "proxy",
+    "description": "Use the <code>browser.proxy</code> API to manage Firefox's proxy settings.",
+    "types": [
+      {
+        "id": "ProxyServer",
+        "type": "object",
+        "description": "An object encapsulating a single proxy server's specification.",
+        "properties": {
+          "scheme": {"type": "string", "optional": true, "enum": ["http", "https", "quic", "socks4", "socks5"], "description": "The scheme (protocol) of the proxy server itself. Defaults to 'http'."},
+          "host": {"type": "string", "description": "The URI of the proxy server. This must be an ASCII hostname (in Punycode format). IDNA is not supported, yet."},
+          "port": {"type": "integer", "optional": true, "description": "The port of the proxy server. Defaults to a port that depends on the scheme."}
+        }
+      },
+      {
+        "id": "ProxyRules",
+        "type": "object",
+        "description": "An object encapsulating the set of proxy rules for all protocols. Use either 'singleProxy' or (a subset of) 'proxyForHttp', 'proxyForHttps', 'proxyForFtp' and 'fallbackProxy'.",
+        "properties": {
+          "singleProxy": {"$ref": "ProxyServer", "optional": true, "description": "The proxy server to be used for all per-URL requests (that is http, https, and ftp)."},
+          "proxyForHttp": {"$ref": "ProxyServer", "optional": true, "description": "The proxy server to be used for HTTP requests."},
+          "proxyForHttps": {"$ref": "ProxyServer", "optional": true, "description": "The proxy server to be used for HTTPS requests."},
+          "proxyForFtp": {"$ref": "ProxyServer", "optional": true, "description": "The proxy server to be used for FTP requests."},
+          "fallbackProxy": {"$ref": "ProxyServer", "optional": true, "description": "The proxy server to be used for everthing else or if any of the specific proxyFor... is not specified."},
+          "bypassList": {"type": "array", "items": {"type": "string"}, "optional": true, "description": "List of servers to connect to without a proxy server."}
+        }
+      },
+      {
+        "id": "PacScript",
+        "type": "object",
+        "description": "An object holding proxy auto-config information. Exactly one of the fields should be non-empty.",
+        "properties": {
+          "url": {"type": "string", "optional": true, "description": "URL of the PAC file to be used."},
+          "data": {"type": "string", "optional": true, "description": "A PAC script."},
+          "mandatory": {"type": "boolean", "optional": true, "description": "If true, an invalid PAC script will prevent the network stack from falling back to direct connections. Defaults to false."}
+        }
+      },
+      {
+        "id": "ProxyConfig",
+        "type": "object",
+        "description": "An object encapsulating a complete proxy configuration.",
+        "properties": {
+          "rules": {"$ref": "ProxyRules", "optional": true, "description": "The proxy rules describing this configuration. Use this for 'fixed_servers' mode."},
+          "pacScript": {"$ref": "PacScript", "optional": true, "description": "The proxy auto-config (PAC) script for this configuration. Use this for 'pac_script' mode."},
+          "mode": {
+            "type": "string",
+            "enum": ["direct", "auto_detect", "pac_script", "fixed_servers", "system"],
+            "description": "'direct' = Never use a proxy<br>'auto_detect' = Auto detect proxy settings<br>'pac_script' = Use specified PAC script<br>'fixed_servers' = Manually specify proxy servers<br>'system' = Use system proxy settings"
+          }
+        }
+      },
+      {
+        "id": "ProxySetting",
+        "type": "object",
+        "functions": [
+          {
+            "name": "get",
+            "unsupported": true,
+            "type": "function",
+            "description": "Gets a value for a proxy setting.",
+            "async": "callback",
+            "parameters": [
+              {
+                "name": "details",
+                "type": "object",
+                "description": "Details about the proxy setting.",
+                "properties": {
+                  "incognito": {
+                    "type": "boolean",
+                    "optional": true,
+                    "description": "Whether to return the value that applies to the incognito session (default false)."
+                  }
+                }
+              },
+              {
+                "name": "callback",
+                "type": "function",
+                "description": "Callback with details regarding the proxy setting.",
+                "parameters": [
+                  {
+                    "name": "details",
+                    "type": "object",
+                    "description": "Details about the proxy setting.",
+                    "properties": {
+                      "value": {
+                        "$ref": "ProxyConfig"
+                      },
+                      "levelOfControl": {
+                        "type": "string",
+                        "enum": [
+                          "not_controllable",
+                          "controlled_by_other_extensions",
+                          "controllable_by_this_extension",
+                          "controlled_by_this_extension"
+                        ]
+                      },
+                      "incognitoSpecific": {
+                        "type": "boolean",
+                        "optional": true,
+                        "description": "Whether the effective value is specific to the incognito session. This property will only be present if the incognito property in the details parameter of get() was true."
+                      }
+                    }
+                  }
+                ]
+              }
+            ]
+          },
+          {
+            "name": "set",
+            "type": "function",
+            "unsupported": true,
+            "description": "Sets a value for a proxy setting.",
+            "async": true,
+            "parameters": [
+              {
+                "name": "value",
+                "$ref": "ProxyConfig"
+              },
+              {
+                "name": "scope",
+                "type": "string",
+                "enum": ["regular", "regular_only", "private_persistent", "private_session_only"],
+                "description": "The scope of the proxy setting"
+              }
+            ]
+          },
+          {
+            "name": "clear",
+            "unsupported": true,
+            "type": "function",
+            "description": "Gets a value for a proxy setting",
+            "async": true,
+            "parameters": [
+              {
+                "name": "scope",
+                "type": "string",
+                "enum": ["regular", "regular_only", "private_persistent", "private_session_only"],
+                "description": "The scope of the proxy setting"
+              }
+            ]
+          }
+        ]
+      }
+    ],
+    "properties": {
+      "settings": {
+        "unsupported": true,
+        "$ref": "ProxySetting",
+        "description": "Proxy settings to be used."
+      }
+    },
+    "events": [
+      {
+        "name": "onProxyError",
+        "type": "function",
+        "unsupported": true,
+        "description": "Notifies about proxy errors.",
+        "parameters": [
+          {
+            "type": "object",
+            "name": "details",
+            "properties": {
+              "fatal": {
+                "type": "boolean",
+                "description": "If true, the error was fatal and the network transaction was aborted. Otherwise, a direct connection is used instead."
+              },
+              "error": {
+                "type": "string",
+                "description": "The error description."
+              },
+              "details": {
+                "type": "string",
+                "description": "Additional details about the error such as a JavaScript runtime error."
+              }
+            }
+          }
+        ]
+      }
+    ]
+  }
+]
\ No newline at end of file