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.
7 "namespace": "webRequest",
8 "description": "Use the <code>chrome.webRequest</code> API to observe and analyze traffic and to intercept, block, or modify requests in-flight.",
10 "MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES": {
12 "description": "The maximum number of times that <code>handlerBehaviorChanged</code> can be called per 10 minute sustained interval. <code>handlerBehaviorChanged</code> is an expensive function call that shouldn't be called often."
17 "id": "RequestFilter",
19 "description": "An object describing filters to apply to webRequest events.",
23 "description": "A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out.",
24 "items": { "type": "string" }
29 "description": "A list of request types. Requests that cannot match any of the types will be filtered out.",
30 "items": { "type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"] }
32 "tabId": { "type": "integer", "optional": true },
33 "windowId": { "type": "integer", "optional": true }
40 "description": "An array of HTTP headers. Each header is represented as a dictionary containing the keys <code>name</code> and either <code>value</code> or <code>binaryValue</code>.",
44 "name": {"type": "string", "description": "Name of the HTTP header."},
45 "value": {"type": "string", "optional": true, "description": "Value of the HTTP header if it can be represented by UTF-8."},
49 "description": "Value of the HTTP header if it cannot be represented by UTF-8, stored as individual byte values (0..255).",
50 "items": {"type": "integer"}
56 "id": "BlockingResponse",
59 "description": "Returns value for event handlers that have the 'blocking' extraInfoSpec applied. Allows the event handler to modify network requests.",
64 "description": "If true, the request is cancelled. Used in onBeforeRequest, this prevents the request from being sent."
69 "description": "Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, the original request is prevented from being sent/completed and is instead redirected to the given URL. Redirections to non-HTTP schemes such as data: are allowed. Redirects initiated by a redirect action use the original request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, then the redirect will be issued using the GET method."
72 "$ref": "HttpHeaders",
74 "description": "Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead."
77 "$ref": "HttpHeaders",
79 "description": "Only used as a response to the onHeadersReceived event. If set, the server is assumed to have responded with these response headers instead. Only return <code>responseHeaders</code> if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify <code>responseHeaders</code> for each request)."
83 "description": "Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials.",
86 "username": {"type": "string"},
87 "password": {"type": "string"}
99 "description": "An ArrayBuffer with a copy of the data."
104 "description": "A string with the file's path and name."
107 "description": "Contains data uploaded in a URL request."
112 "name": "handlerBehaviorChanged",
114 "description": "Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. This function call is expensive. Don't call it often.",
116 {"type": "function", "name": "callback", "optional": true, "parameters": []}
122 "name": "onBeforeRequest",
124 "description": "Fired when a request is about to occur.",
130 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
131 "url": {"type": "string"},
132 "method": {"type": "string", "description": "Standard HTTP method."},
133 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
134 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
138 "description": "Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.",
140 "error": {"type": "string", "optional": true, "description": "Errors when obtaining request body data."},
144 "description": "If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.",
146 "additionalProperties": {
148 "items": { "type": "string" }
154 "items": {"$ref": "UploadData"},
155 "description": "If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array."
159 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
160 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
161 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."}
167 "$ref": "RequestFilter",
169 "description": "A set of filters that restricts the events that will be sent to this listener."
174 "name": "extraInfoSpec",
175 "description": "Array of extra information that should be passed to the listener function.",
178 "enum": ["blocking", "requestBody"]
183 "$ref": "BlockingResponse",
184 "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.",
189 "name": "onBeforeSendHeaders",
192 "description": "Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any HTTP data is sent. ",
198 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
199 "url": {"type": "string"},
200 "method": {"type": "string", "description": "Standard HTTP method."},
201 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
202 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
203 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
204 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
205 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
206 "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that are going to be sent out with this request."}
212 "$ref": "RequestFilter",
214 "description": "A set of filters that restricts the events that will be sent to this listener."
219 "name": "extraInfoSpec",
220 "description": "Array of extra information that should be passed to the listener function.",
223 "enum": ["requestHeaders", "blocking"]
228 "$ref": "BlockingResponse",
229 "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.",
234 "name": "onSendHeaders",
237 "description": "Fired just before a request is going to be sent to the server (modifications of previous onBeforeSendHeaders callbacks are visible by the time onSendHeaders is fired).",
243 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
244 "url": {"type": "string"},
245 "method": {"type": "string", "description": "Standard HTTP method."},
246 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
247 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
248 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
249 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
250 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
251 "requestHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP request headers that have been sent out with this request."}
257 "$ref": "RequestFilter",
259 "description": "A set of filters that restricts the events that will be sent to this listener."
264 "name": "extraInfoSpec",
265 "description": "Array of extra information that should be passed to the listener function.",
268 "enum": ["requestHeaders"]
274 "name": "onHeadersReceived",
277 "description": "Fired when HTTP response headers of a request have been received.",
283 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
284 "url": {"type": "string"},
285 "method": {"type": "string", "description": "Standard HTTP method."},
286 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
287 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
288 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
289 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
290 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
291 "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line)."},
292 "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that have been received with this response."}
298 "$ref": "RequestFilter",
300 "description": "A set of filters that restricts the events that will be sent to this listener."
305 "name": "extraInfoSpec",
306 "description": "Array of extra information that should be passed to the listener function.",
309 "enum": ["blocking", "responseHeaders"]
314 "$ref": "BlockingResponse",
315 "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.",
320 "name": "onAuthRequired",
323 "description": "Fired when an authentication failure is received. The listener has three options: it can provide authentication credentials, it can cancel the request and display the error page, or it can take no action on the challenge. If bad user credentials are provided, this may be called multiple times for the same request.",
329 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
330 "url": {"type": "string"},
331 "method": {"type": "string", "description": "Standard HTTP method."},
332 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
333 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
334 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
335 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
336 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
337 "scheme": {"type": "string", "description": "The authentication scheme, e.g. Basic or Digest."},
338 "realm": {"type": "string", "description": "The authentication realm provided by the server, if there is one.", "optional": true},
339 "challenger": {"type": "object", "description": "The server requesting authentication.", "properties": {"host": {"type": "string"}, "port": {"type": "integer"}}},
340 "isProxy": {"type": "boolean", "description": "True for Proxy-Authenticate, false for WWW-Authenticate."},
341 "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."},
342 "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
350 {"name": "response", "$ref": "BlockingResponse"}
356 "$ref": "RequestFilter",
358 "description": "A set of filters that restricts the events that will be sent to this listener."
363 "name": "extraInfoSpec",
364 "description": "Array of extra information that should be passed to the listener function.",
367 "enum": ["responseHeaders", "blocking", "asyncBlocking"]
372 "$ref": "BlockingResponse",
373 "description": "If \"blocking\" is specified in the \"extraInfoSpec\" parameter, the event listener should return an object of this type.",
378 "name": "onResponseStarted",
381 "description": "Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.",
387 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
388 "url": {"type": "string"},
389 "method": {"type": "string", "description": "Standard HTTP method."},
390 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
391 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
392 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
393 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
394 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
395 "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."},
396 "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
397 "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
398 "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."},
399 "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
405 "$ref": "RequestFilter",
407 "description": "A set of filters that restricts the events that will be sent to this listener."
412 "name": "extraInfoSpec",
413 "description": "Array of extra information that should be passed to the listener function.",
416 "enum": ["responseHeaders"]
422 "name": "onBeforeRedirect",
425 "description": "Fired when a server-initiated redirect is about to occur.",
431 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
432 "url": {"type": "string"},
433 "method": {"type": "string", "description": "Standard HTTP method."},
434 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
435 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
436 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
437 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
438 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
439 "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."},
440 "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
441 "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
442 "redirectUrl": {"type": "string", "description": "The new URL."},
443 "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this redirect."},
444 "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
450 "$ref": "RequestFilter",
452 "description": "A set of filters that restricts the events that will be sent to this listener."
457 "name": "extraInfoSpec",
458 "description": "Array of extra information that should be passed to the listener function.",
461 "enum": ["responseHeaders"]
467 "name": "onCompleted",
470 "description": "Fired when a request is completed.",
476 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
477 "url": {"type": "string"},
478 "method": {"type": "string", "description": "Standard HTTP method."},
479 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
480 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
481 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
482 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
483 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
484 "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."},
485 "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
486 "statusCode": {"type": "integer", "description": "Standard HTTP status code returned by the server."},
487 "responseHeaders": {"$ref": "HttpHeaders", "optional": true, "description": "The HTTP response headers that were received along with this response."},
488 "statusLine": {"type": "string", "description": "HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers."}
494 "$ref": "RequestFilter",
496 "description": "A set of filters that restricts the events that will be sent to this listener."
501 "name": "extraInfoSpec",
502 "description": "Array of extra information that should be passed to the listener function.",
505 "enum": ["responseHeaders"]
511 "name": "onErrorOccurred",
513 "description": "Fired when an error occurs.",
519 "requestId": {"type": "string", "description": "The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request."},
520 "url": {"type": "string"},
521 "method": {"type": "string", "description": "Standard HTTP method."},
522 "frameId": {"type": "integer", "description": "The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (<code>type</code> is <code>main_frame</code> or <code>sub_frame</code>), <code>frameId</code> indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab."},
523 "parentFrameId": {"type": "integer", "description": "ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists."},
524 "tabId": {"type": "integer", "description": "The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab."},
525 "type": {"type": "string", "enum": ["main_frame", "sub_frame", "stylesheet", "script", "image", "object", "xmlhttprequest", "other"], "description": "How the requested resource will be used."},
526 "timeStamp": {"type": "number", "description": "The time when this signal is triggered, in milliseconds since the epoch."},
527 "ip": {"type": "string", "optional": true, "description": "The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address."},
528 "fromCache": {"type": "boolean", "description": "Indicates if this response was fetched from disk cache."},
529 "error": {"type": "string", "description": "The error description. This string is <em>not</em> guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content."}
535 "$ref": "RequestFilter",
537 "description": "A set of filters that restricts the events that will be sent to this listener."