Bug 1878081 - Drop per-file license header comments from schema files, r=willdurand...
[gecko.git] / toolkit / components / extensions / schemas / events.json
blobb8dad2c6a522e9c1b6f91abded5d5b92dceb3941
2   {
3     "namespace": "events",
4     "description": "The <code>chrome.events</code> namespace contains common types used by APIs dispatching events to notify you when something interesting happens.",
5     "types": [
6       {
7         "id": "Rule",
8         "type": "object",
9         "description": "Description of a declarative rule for handling events.",
10         "properties": {
11           "id": {
12             "type": "string",
13             "optional": true,
14             "description": "Optional identifier that allows referencing this rule."
15           },
16           "tags": {
17             "type": "array",
18             "items": { "type": "string" },
19             "optional": true,
20             "description": "Tags can be used to annotate rules and perform operations on sets of rules."
21           },
22           "conditions": {
23             "type": "array",
24             "items": { "type": "any" },
25             "description": "List of conditions that can trigger the actions."
26           },
27           "actions": {
28             "type": "array",
29             "items": { "type": "any" },
30             "description": "List of actions that are triggered if one of the condtions is fulfilled."
31           },
32           "priority": {
33             "type": "integer",
34             "optional": true,
35             "description": "Optional priority of this rule. Defaults to 100."
36           }
37         }
38       },
39       {
40         "id": "Event",
41         "type": "object",
42         "description": "An object which allows the addition and removal of listeners for a Chrome event.",
43         "functions": [
44           {
45             "name": "addListener",
46             "type": "function",
47             "description": "Registers an event listener <em>callback</em> to an event.",
48             "parameters": [
49               {
50                 "name": "callback",
51                 "type": "function",
52                 "description": "Called when an event occurs. The parameters of this function depend on the type of event."
53               }
54             ]
55           },
56           {
57             "name": "removeListener",
58             "type": "function",
59             "description": "Deregisters an event listener <em>callback</em> from an event.",
60             "parameters": [
61               {
62                 "name": "callback",
63                 "type": "function",
64                 "description": "Listener that shall be unregistered."
65               }
66             ]
67           },
68           {
69             "name": "hasListener",
70             "type": "function",
71             "parameters": [
72               {
73                 "name": "callback",
74                 "type": "function",
75                 "description": "Listener whose registration status shall be tested."
76               }
77             ],
78             "returns": {
79               "type": "boolean",
80               "description": "True if <em>callback</em> is registered to the event."
81             }
82           },
83           {
84             "name": "hasListeners",
85             "type": "function",
86             "parameters": [],
87             "returns": {
88               "type": "boolean",
89               "description": "True if any event listeners are registered to the event."
90             }
91           },
92           {
93             "name": "addRules",
94             "unsupported": true,
95             "type": "function",
96             "description": "Registers rules to handle events.",
97             "parameters": [
98               {
99                 "name": "eventName",
100                 "type": "string",
101                 "description": "Name of the event this function affects."
102               },
103               {
104                 "name": "webViewInstanceId",
105                 "type": "integer",
106                 "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call."
107               },
108               {
109                 "name": "rules",
110                 "type": "array",
111                 "items": { "$ref": "Rule" },
112                 "description": "Rules to be registered. These do not replace previously registered rules."
113               },
114               {
115                 "name": "callback",
116                 "optional": true,
117                 "type": "function",
118                 "parameters": [
119                   {
120                     "name": "rules",
121                     "type": "array",
122                     "items": { "$ref": "Rule" },
123                     "description": "Rules that were registered, the optional parameters are filled with values."
124                   }
125                 ],
126                 "description": "Called with registered rules."
127               }
128             ]
129           },
130           {
131             "name": "getRules",
132             "unsupported": true,
133             "type": "function",
134             "description": "Returns currently registered rules.",
135             "parameters": [
136               {
137                 "name": "eventName",
138                 "type": "string",
139                 "description": "Name of the event this function affects."
140               },
141               {
142                 "name": "webViewInstanceId",
143                 "type": "integer",
144                 "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call."
145               },
146               {
147                 "name": "ruleIdentifiers",
148                 "optional": true,
149                 "type": "array",
150                 "items": { "type": "string" },
151                 "description": "If an array is passed, only rules with identifiers contained in this array are returned."
152               },
153               {
154                 "name": "callback",
155                 "type": "function",
156                 "parameters": [
157                   {
158                     "name": "rules",
159                     "type": "array",
160                     "items": { "$ref": "Rule" },
161                     "description": "Rules that were registered, the optional parameters are filled with values."
162                   }
163                 ],
164                 "description": "Called with registered rules."
165               }
166             ]
167           },
168           {
169             "name": "removeRules",
170             "unsupported": true,
171             "type": "function",
172             "description": "Unregisters currently registered rules.",
173             "parameters": [
174               {
175                 "name": "eventName",
176                 "type": "string",
177                 "description": "Name of the event this function affects."
178               },
179               {
180                 "name": "webViewInstanceId",
181                 "type": "integer",
182                 "description": "If provided, this is an integer that uniquely identfies the <webview> associated with this function call."
183               },
184               {
185                 "name": "ruleIdentifiers",
186                 "optional": true,
187                 "type": "array",
188                 "items": { "type": "string" },
189                 "description": "If an array is passed, only rules with identifiers contained in this array are unregistered."
190               },
191               {
192                 "name": "callback",
193                 "optional": true,
194                 "type": "function",
195                 "parameters": [],
196                 "description": "Called when rules were unregistered."
197               }
198             ]
199           }
200         ]
201       },
202       {
203         "id": "UrlFilter",
204         "type": "object",
205         "description": "Filters URLs for various criteria. See <a href='events#filtered'>event filtering</a>. All criteria are case sensitive.",
206         "properties": {
207           "hostContains": {
208             "type": "string",
209             "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.",
210             "optional": true
211           },
212           "hostEquals": {
213             "type": "string",
214             "description": "Matches if the host name of the URL is equal to a specified string.",
215             "optional": true
216           },
217           "hostPrefix": {
218             "type": "string",
219             "description": "Matches if the host name of the URL starts with a specified string.",
220             "optional": true
221           },
222           "hostSuffix": {
223             "type": "string",
224             "description": "Matches if the host name of the URL ends with a specified string.",
225             "optional": true
226           },
227           "pathContains": {
228             "type": "string",
229             "description": "Matches if the path segment of the URL contains a specified string.",
230             "optional": true
231           },
232           "pathEquals": {
233             "type": "string",
234             "description": "Matches if the path segment of the URL is equal to a specified string.",
235             "optional": true
236           },
237           "pathPrefix": {
238             "type": "string",
239             "description": "Matches if the path segment of the URL starts with a specified string.",
240             "optional": true
241           },
242           "pathSuffix": {
243             "type": "string",
244             "description": "Matches if the path segment of the URL ends with a specified string.",
245             "optional": true
246           },
247           "queryContains": {
248             "type": "string",
249             "description": "Matches if the query segment of the URL contains a specified string.",
250             "optional": true
251           },
252           "queryEquals": {
253             "type": "string",
254             "description": "Matches if the query segment of the URL is equal to a specified string.",
255             "optional": true
256           },
257           "queryPrefix": {
258             "type": "string",
259             "description": "Matches if the query segment of the URL starts with a specified string.",
260             "optional": true
261           },
262           "querySuffix": {
263             "type": "string",
264             "description": "Matches if the query segment of the URL ends with a specified string.",
265             "optional": true
266           },
267           "urlContains": {
268             "type": "string",
269             "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.",
270             "optional": true
271           },
272           "urlEquals": {
273             "type": "string",
274             "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.",
275             "optional": true
276           },
277           "urlMatches": {
278             "type": "string",
279             "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>.",
280             "optional": true
281           },
282           "originAndPathMatches": {
283             "type": "string",
284             "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>.",
285             "optional": true
286           },
287           "urlPrefix": {
288             "type": "string",
289             "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.",
290             "optional": true
291           },
292           "urlSuffix": {
293             "type": "string",
294             "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.",
295             "optional": true
296           },
297           "schemes": {
298             "type": "array",
299             "description": "Matches if the scheme of the URL is equal to any of the schemes specified in the array.",
300             "optional": true,
301             "items": { "type": "string" }
302           },
303           "ports": {
304             "type": "array",
305             "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.",
306             "optional": true,
307             "items": {
308               "choices": [
309                 { "type": "integer", "description": "A specific port." },
310                 {
311                   "type": "array",
312                   "minItems": 2,
313                   "maxItems": 2,
314                   "items": { "type": "integer" },
315                   "description": "A pair of integers identiying the start and end (both inclusive) of a port range."
316                 }
317               ]
318             }
319           }
320         }
321       }
322     ]
323   }