Extract SIGPIPE ignoring code to a common place.
[chromium-blink-merge.git] / chrome / common / extensions / api / declarative_web_request.json
blob4f29782f28ebe70d692a2bf9189c4c0769e54922
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6   {
7     "namespace": "declarativeWebRequest",
8     "documentation_permissions_required": ["declarative", "declarativeWebRequest"],
9     "types": [
10       {
11         "id": "HeaderFilter",
12         "type": "object",
13         "description": "Filters request headers for various criteria. Multiple criteria are evaluated as a conjunction.",
14         "properties": {
15           "namePrefix": {
16             "description" : "Matches if the header name starts with the specified string.",
17             "type": "string",
18             "optional": true
19           },
20           "nameSuffix": {
21             "type": "string",
22             "optional": true,
23             "description" : "Matches if the header name ends with the specified string."
24           },
25           "nameContains": {
26             "choices": [
27              {"type": "array", "items": {"type": "string"}},
28              {"type": "string"}
29             ],
30             "optional": true,
31             "description" : "Matches if the header name contains all of the specified strings."
32           },
33           "nameEquals": {
34             "type": "string",
35             "optional": true,
36             "description" : "Matches if the header name is equal to the specified string."
37           },
38           "valuePrefix": {
39             "type": "string",
40             "optional": true,
41             "description" : "Matches if the header value starts with the specified string."
42           },
43           "valueSuffix": {
44             "type": "string",
45             "optional": true,
46             "description" : "Matches if the header value ends with the specified string."
47           },
48           "valueContains": {
49             "choices": [
50              {"type": "array", "items": {"type": "string"}},
51              {"type": "string"}
52             ],
53             "optional": true,
54             "description" : "Matches if the header value contains all of the specified strings."
55           },
56           "valueEquals": {
57             "type": "string",
58             "optional": true,
59             "description" : "Matches if the header value is equal to the specified string."
60           }
61         }
62       },
63       {
64         "id": "RequestMatcher",
65         "type": "object",
66         "description": "Matches network events by various criteria.",
67         "properties": {
68           "url": {
69             "$ref": "events.UrlFilter",
70             "description": "Matches if the condition of the UrlFilter are fulfilled for the URL of the request.",
71             "optional": true
72           },
73           "resourceType": {
74             "type": "array",
75             "optional": true,
76             "description": "Matches if the request type of a request is contained in the list. Requests that cannot match any of the types will be filtered out.",
77             "items": { "type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"] }
78           },
79           "contentType": {
80             "type": "array",
81             "optional": true,
82             "description": "Matches if the MIME media type of a response (from the HTTP Content-Type header) is contained in the list.",
83             "items": { "type": "string" }
84           },
85           "excludeContentType": {
86             "type": "array",
87             "optional": true,
88             "description": "Matches if the MIME media type of a response (from the HTTP Content-Type header) is <em>not</em> contained in the list.",
89             "items": { "type": "string" }
90           },
91           "requestHeaders": {
92             "type": "array",
93             "optional": true,
94             "description": "Matches if some of the request headers is matched by one of the HeaderFilters.",
95             "items": { "$ref": "HeaderFilter" }
96           },
97           "excludeRequestHeaders": {
98             "type": "array",
99             "optional": true,
100             "description": "Matches if none of the request headers is matched by any of the HeaderFilters.",
101             "items": { "$ref": "HeaderFilter" }
102           },
103           "responseHeaders": {
104             "type": "array",
105             "optional": true,
106             "description": "Matches if some of the response headers is matched by one of the HeaderFilters.",
107             "items": { "$ref": "HeaderFilter" }
108           },
109           "excludeResponseHeaders": {
110             "type": "array",
111             "optional": true,
112             "description": "Matches if none of the response headers is matched by any of the HeaderFilters.",
113             "items": { "$ref": "HeaderFilter" }
114           },
115           "thirdPartyForCookies": {
116             "type": "boolean",
117             "optional": true,
118             "description": "If set to true, matches requests that are subject to third-party cookie policies. If set to false, matches all other requests."
119           },
120           "stages": {
121             "type": "array",
122             "items": {
123               "type": "string",
124               "enum": ["onBeforeRequest", "onBeforeSendHeaders", "onHeadersReceived", "onAuthRequired"]
125             },
126             "optional": true,
127             "description": "Contains a list of strings describing stages. Allowed values are 'onBeforeRequest', 'onBeforeSendHeaders', 'onHeadersReceived', 'onAuthRequired'. If this attribute is present, then it limits the applicable stages to those listed. Note that the whole condition is only applicable in stages compatible with all attributes."
128           },
129           "instanceType": {
130             "type": "string", "enum": ["declarativeWebRequest.RequestMatcher"],
131             "nodoc": true
132           }
133         }
134       },
135       {
136         "id": "CancelRequest",
137         "description": "Declarative event action that cancels a network request.",
138         "type": "object",
139         "properties": {
140           "instanceType": {
141             "type": "string", "enum": ["declarativeWebRequest.CancelRequest"],
142             "nodoc": true
143           }
144         }
145       },
146       {
147         "id": "RedirectRequest",
148         "description": "Declarative event action that redirects a network request.",
149         "type": "object",
150         "properties": {
151           "instanceType": {
152             "type": "string", "enum": ["declarativeWebRequest.RedirectRequest"],
153             "nodoc": true
154           },
155           "redirectUrl": { "type": "string", "description": "Destination to where the request is redirected."}
156         }
157       },
158       {
159         "id": "declarativeWebRequest.RedirectToTransparentImage",
160         "description": "Declarative event action that redirects a network request to a transparent image.",
161         "type": "object",
162         "properties": {
163           "instanceType": {
164             "type": "string", "enum": ["declarativeWebRequest.RedirectToTransparentImage"],
165             "nodoc": true
166           }
167         }
168       },
169       {
170         "id": "declarativeWebRequest.RedirectToEmptyDocument",
171         "description": "Declarative event action that redirects a network request to an empty document.",
172         "type": "object",
173         "properties": {
174           "instanceType": {
175             "type": "string", "enum": ["declarativeWebRequest.RedirectToEmptyDocument"],
176             "nodoc": true
177           }
178         }
179       },
180       {
181         "id": "declarativeWebRequest.RedirectByRegEx",
182         "description": "Redirects a request by applying a regular expression on the URL. The regular expressions use the <a href=\"http://code.google.com/p/re2/wiki/Syntax\">RE2 syntax</a>.",
183         "type": "object",
184         "properties": {
185           "instanceType": {
186             "type": "string", "enum": ["declarativeWebRequest.RedirectByRegEx"],
187             "nodoc": true
188           },
189           "from": {
190             "type": "string",
191             "description": "A match pattern that may contain capture groups. Capture groups are referenced in the Perl syntax ($1, $2, ...) instead of the RE2 syntax (\\1, \\2, ...) in order to be closer to JavaScript Regular Expressions."
192           },
193           "to": {
194             "type": "string",
195             "description": "Destination pattern."
196           }
197         }
198       },
199       {
200         "id": "declarativeWebRequest.SetRequestHeader",
201         "description": "Sets the request header of the specified name to the specified value. If a header with the specified name did not exist before, a new one is created. Header name comparison is always case-insensitive. Each request header name occurs only once in each request.",
202         "type": "object",
203         "properties": {
204           "instanceType": {
205             "type": "string", "enum": ["declarativeWebRequest.SetRequestHeader"],
206             "nodoc": true
207           },
208           "name": {
209             "type": "string",
210             "description": "HTTP request header name."
211           },
212           "value": {
213             "type": "string",
214             "description": "HTTP request header value."
215           }
216         }
217       },
218       {
219         "id": "declarativeWebRequest.RemoveRequestHeader",
220         "description": "Removes the request header of the specified name. Do not use SetRequestHeader and RemoveRequestHeader with the same header name on the same request. Each request header name occurs only once in each request.",
221         "type": "object",
222         "properties": {
223           "instanceType": {
224             "type": "string", "enum": ["declarativeWebRequest.RemoveRequestHeader"],
225             "nodoc": true
226           },
227           "name": {
228             "type": "string",
229             "description": "HTTP request header name (case-insensitive)."
230           }
231         }
232       },
233       {
234         "id": "declarativeWebRequest.AddResponseHeader",
235         "description": "Adds the response header to the response of this web request. As multiple response headers may share the same name, you need to first remove and then add a new response header in order to replace one.",
236         "type": "object",
237         "properties": {
238           "instanceType": {
239             "type": "string", "enum": ["declarativeWebRequest.AddResponseHeader"],
240             "nodoc": true
241           },
242           "name": {
243             "type": "string",
244             "description": "HTTP response header name."
245           },
246           "value": {
247             "type": "string",
248             "description": "HTTP response header value."
249           }
250         }
251       },
252       {
253         "id": "declarativeWebRequest.RemoveResponseHeader",
254         "description": "Removes all response headers of the specified names and values.",
255         "type": "object",
256         "properties": {
257           "instanceType": {
258             "type": "string", "enum": ["declarativeWebRequest.RemoveResponseHeader"],
259             "nodoc": true
260           },
261           "name": {
262             "type": "string",
263             "description": "HTTP request header name (case-insensitive)."
264           },
265           "value": {
266             "type": "string",
267             "description": "HTTP request header value (case-insensitive).",
268             "optional": true
269           }
270         }
271       },
272       {
273         "id": "declarativeWebRequest.IgnoreRules",
274         "description": "Masks all rules that match the specified criteria.",
275         "type": "object",
276         "properties": {
277           "instanceType": {
278             "type": "string", "enum": ["declarativeWebRequest.IgnoreRules"],
279             "nodoc": true
280           },
281           "lowerPriorityThan": {
282             "type": "integer",
283             "description": "If set, rules with a lower priority than the specified value are ignored. This boundary is not persisted, it affects only rules and their actions of the same network request stage."
284           }
285         }
286       },
287       {
288         "id": "declarativeWebRequest.RequestCookie",
289         "description": "A filter or specification of a cookie in HTTP Requests.",
290         "type": "object",
291         "properties": {
292           "name": {
293             "type": "string",
294             "description": "Name of a cookie.",
295             "optional": true
296           },
297           "value": {
298             "type": "string",
299             "description": "Value of a cookie, may be padded in double-quotes.",
300             "optional": true
301           }
302         }
303       },
304       {
305         "id": "declarativeWebRequest.ResponseCookie",
306         "description": "A specification of a cookie in HTTP Responses.",
307         "type": "object",
308         "properties": {
309           "name": {
310             "type": "string",
311             "description": "Name of a cookie.",
312             "optional": true
313           },
314           "value": {
315             "type": "string",
316             "description": "Value of a cookie, may be padded in double-quotes.",
317             "optional": true
318           },
319           "expires": {
320             "type": "string",
321             "description": "Value of the Expires cookie attribute.",
322             "optional": true
323           },
324           "maxAge": {
325             "type": "number",
326             "description": "Value of the Max-Age cookie attribute",
327             "optional": true
328           },
329           "domain": {
330             "type": "string",
331             "description": "Value of the Domain cookie attribute.",
332             "optional": true
333           },
334           "path": {
335             "type": "string",
336             "description": "Value of the Path cookie attribute.",
337             "optional": true
338           },
339           "secure": {
340             "type": "string",
341             "description": "Existence of the Secure cookie attribute.",
342             "optional": true
343           },
344           "httpOnly": {
345             "type": "string",
346             "description": "Existence of the HttpOnly cookie attribute.",
347             "optional": true
348           }
349         }
350       },
351       {
352         "id": "declarativeWebRequest.FilterResponseCookie",
353         "description": "A filter of a cookie in HTTP Responses.",
354         "type": "object",
355         "properties": {
356           "name": {
357             "type": "string",
358             "description": "Name of a cookie.",
359             "optional": true
360           },
361           "value": {
362             "type": "string",
363             "description": "Value of a cookie, may be padded in double-quotes.",
364             "optional": true
365           },
366           "expires": {
367             "type": "string",
368             "description": "Value of the Expires cookie attribute.",
369             "optional": true
370           },
371           "maxAge": {
372             "type": "number",
373             "description": "Value of the Max-Age cookie attribute",
374             "optional": true
375           },
376           "domain": {
377             "type": "string",
378             "description": "Value of the Domain cookie attribute.",
379             "optional": true
380           },
381           "path": {
382             "type": "string",
383             "description": "Value of the Path cookie attribute.",
384             "optional": true
385           },
386           "secure": {
387             "type": "string",
388             "description": "Existence of the Secure cookie attribute.",
389             "optional": true
390           },
391           "httpOnly": {
392             "type": "string",
393             "description": "Existence of the HttpOnly cookie attribute.",
394             "optional": true
395           },
396           "ageUpperBound": {
397             "type": "integer",
398             "description": "Inclusive upper bound on the cookie lifetime (specified in seconds after current time). Only cookies whose expiration date-time is in the interval [now, now + ageUpperBound] fulfill this criterion. Session cookies and cookies whose expiration date-time is in the past do not meet the criterion of this filter. The cookie lifetime is calculated from either 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime.",
399             "minimum": 0,
400             "optional": true
401           },
402           "ageLowerBound": {
403             "type": "integer",
404             "description": "Inclusive lower bound on the cookie lifetime (specified in seconds after current time). Only cookies whose expiration date-time is set to 'now + ageLowerBound' or later fulfill this criterion. Session cookies do not meet the criterion of this filter. The cookie lifetime is calculated from either 'max-age' or 'expires' cookie attributes. If both are specified, 'max-age' is used to calculate the cookie lifetime.",
405             "minimum": 0,
406             "optional": true
407           },
408           "sessionCookie": {
409             "type": "boolean",
410             "description": "Filters session cookies. Session cookies have no lifetime specified in any of 'max-age' or 'expires' attributes.",
411             "optional": true
412           }
413         }
414       },
415       {
416         "id": "declarativeWebRequest.AddRequestCookie",
417         "description": "Adds a cookie to the request or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
418         "type": "object",
419         "properties": {
420           "instanceType": {
421             "type": "string", "enum": ["declarativeWebRequest.AddRequestCookie"],
422             "nodoc": true
423           },
424           "cookie": {
425             "$ref": "declarativeWebRequest.RequestCookie",
426             "description": "Cookie to be added to the request. No field may be undefined."
427           }
428         }
429       },
430       {
431         "id": "declarativeWebRequest.AddResponseCookie",
432         "description": "Adds a cookie to the response or overrides a cookie, in case another cookie of the same name exists already. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
433         "type": "object",
434         "properties": {
435           "instanceType": {
436             "type": "string", "enum": ["declarativeWebRequest.AddResponseCookie"],
437             "nodoc": true
438           },
439           "cookie": {
440             "$ref": "declarativeWebRequest.ResponseCookie",
441             "description": "Cookie to be added to the response. The name and value need to be specified."
442           }
443         }
444       },
445       {
446         "id": "declarativeWebRequest.EditRequestCookie",
447         "description": "Edits one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
448         "type": "object",
449         "properties": {
450           "instanceType": {
451             "type": "string", "enum": ["declarativeWebRequest.EditRequestCookie"],
452             "nodoc": true
453           },
454           "filter": {
455             "$ref": "declarativeWebRequest.RequestCookie",
456             "description": "Filter for cookies that will be modified. All empty entries are ignored."
457           },
458           "modification": {
459             "$ref": "declarativeWebRequest.RequestCookie",
460             "description": "Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed."
461           }
462         }
463       },
464       {
465         "id": "declarativeWebRequest.EditResponseCookie",
466         "description": "Edits one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
467         "type": "object",
468         "properties": {
469           "instanceType": {
470             "type": "string", "enum": ["declarativeWebRequest.EditResponseCookie"],
471             "nodoc": true
472           },
473           "filter": {
474             "$ref": "declarativeWebRequest.FilterResponseCookie",
475             "description": "Filter for cookies that will be modified. All empty entries are ignored."
476           },
477           "modification": {
478             "$ref": "declarativeWebRequest.ResponseCookie",
479             "description": "Attributes that shall be overridden in cookies that machted the filter. Attributes that are set to an empty string are removed."
480           }
481         }
482       },
483       {
484         "id": "declarativeWebRequest.RemoveRequestCookie",
485         "description": "Removes one or more cookies of request. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
486         "type": "object",
487         "properties": {
488           "instanceType": {
489             "type": "string", "enum": ["declarativeWebRequest.RemoveRequestCookie"],
490             "nodoc": true
491           },
492           "filter": {
493             "$ref": "declarativeWebRequest.RequestCookie",
494             "description": "Filter for cookies that will be removed. All empty entries are ignored."
495           }
496         }
497       },
498       {
499         "id": "declarativeWebRequest.RemoveResponseCookie",
500         "description": "Removes one or more cookies of response. Note that it is preferred to use the Cookies API because this is computationally less expensive.",
501         "type": "object",
502         "properties": {
503           "instanceType": {
504             "type": "string", "enum": ["declarativeWebRequest.RemoveResponseCookie"],
505             "nodoc": true
506           },
507           "filter": {
508             "$ref": "declarativeWebRequest.FilterResponseCookie",
509             "description": "Filter for cookies that will be removed. All empty entries are ignored."
510           }
511         }
512       }
513     ],
514     "functions": [
515     ],
516     "events": [
517       {
518         "name": "onRequest",
519         "options": {
520           "supportsListeners": false,
521           "supportsRules": true,
522           "conditions": ["declarativeWebRequest.RequestMatcher"],
523           "actions": [
524             "declarativeWebRequest.AddRequestCookie",
525             "declarativeWebRequest.AddResponseCookie",
526             "declarativeWebRequest.AddResponseHeader",
527             "declarativeWebRequest.CancelRequest",
528             "declarativeWebRequest.EditRequestCookie",
529             "declarativeWebRequest.EditResponseCookie",
530             "declarativeWebRequest.RedirectRequest",
531             "declarativeWebRequest.RedirectToTransparentImage",
532             "declarativeWebRequest.RedirectToEmptyDocument",
533             "declarativeWebRequest.RedirectByRegEx",
534             "declarativeWebRequest.RemoveRequestCookie",
535             "declarativeWebRequest.RemoveResponseCookie",
536             "declarativeWebRequest.RemoveRequestHeader",
537             "declarativeWebRequest.RemoveResponseHeader",
538             "declarativeWebRequest.SetRequestHeader",
539             "declarativeWebRequest.IgnoreRules"
540           ]
541         }
542       }
543     ]
544   }