@types/chrome 0.0.325 → 0.0.326

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +308 -185
  3. chrome/package.json +2 -2
chrome/README.md CHANGED
@@ -8,7 +8,7 @@ This package contains type definitions for chrome (https://developer.chrome.com/
8
8
  Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome.
9
9
 
10
10
  ### Additional Details
11
- * Last updated: Fri, 30 May 2025 05:36:15 GMT
11
+ * Last updated: Sat, 31 May 2025 08:36:55 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  // Helpers
6
6
  type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
7
+ type SetPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7
8
 
8
9
  ////////////////////
9
10
  // Global object
@@ -13464,24 +13465,8 @@ declare namespace chrome {
13464
13465
  interface WebRequestEvent<T extends (...args: any) => void, U extends string[]>
13465
13466
  extends Omit<chrome.events.Event<T>, "addListener">
13466
13467
  {
13467
- addListener(callback: T, filter: RequestFilter, extraInfoSpec?: U): void;
13468
- }
13469
-
13470
- /** How the requested resource will be used. */
13471
- export type ResourceType =
13472
- | "main_frame"
13473
- | "sub_frame"
13474
- | "stylesheet"
13475
- | "script"
13476
- | "image"
13477
- | "font"
13478
- | "object"
13479
- | "xmlhttprequest"
13480
- | "ping"
13481
- | "csp_report"
13482
- | "media"
13483
- | "websocket"
13484
- | "other";
13468
+ addListener(callback: T, filter: RequestFilter, extraInfoSpec?: U | undefined): void;
13469
+ }
13485
13470
 
13486
13471
  export interface AuthCredentials {
13487
13472
  username: string;
@@ -13490,228 +13475,324 @@ declare namespace chrome {
13490
13475
 
13491
13476
  /** An HTTP Header, represented as an object containing a key and either a value or a binaryValue. */
13492
13477
  export interface HttpHeader {
13478
+ /** Name of the HTTP header. */
13493
13479
  name: string;
13480
+ /** Value of the HTTP header if it can be represented by UTF-8. */
13494
13481
  value?: string | undefined;
13482
+ /** Value of the HTTP header if it cannot be represented by UTF-8, stored as individual byte values (0..255). */
13495
13483
  binaryValue?: ArrayBuffer | undefined;
13496
13484
  }
13497
13485
 
13498
13486
  /** Returns value for event handlers that have the 'blocking' extraInfoSpec applied. Allows the event handler to modify network requests. */
13499
13487
  export interface BlockingResponse {
13500
- /** Optional. If true, the request is cancelled. Used in onBeforeRequest, this prevents the request from being sent. */
13488
+ /** If true, the request is cancelled. This prevents the request from being sent. This can be used as a response to the onBeforeRequest, onBeforeSendHeaders, onHeadersReceived and onAuthRequired events. */
13501
13489
  cancel?: boolean | undefined;
13502
- /**
13503
- * Optional.
13504
- * 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.
13505
- */
13490
+ /** 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. Redirects from URLs with `ws://` and `wss://` schemes are **ignored**. */
13506
13491
  redirectUrl?: string | undefined;
13507
- /**
13508
- * Optional.
13509
- * 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 responseHeaders if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify responseHeaders for each request).
13510
- */
13492
+ /** 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 `responseHeaders` if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify `responseHeaders` for each request). */
13511
13493
  responseHeaders?: HttpHeader[] | undefined;
13512
- /** Optional. Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials. */
13494
+ /** Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials. */
13513
13495
  authCredentials?: AuthCredentials | undefined;
13514
- /**
13515
- * Optional.
13516
- * Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead.
13517
- */
13496
+ /** Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead. */
13518
13497
  requestHeaders?: HttpHeader[] | undefined;
13519
13498
  }
13520
13499
 
13500
+ /**
13501
+ * Contains data passed within form data. For urlencoded form it is stored as string if data is utf-8 string and as ArrayBuffer otherwise. For form-data it is ArrayBuffer. If form-data represents uploading file, it is string with filename, if the filename is provided.
13502
+ * @since Chrome 66
13503
+ */
13504
+ export type FormDataItem = string | ArrayBuffer;
13505
+
13506
+ /** @since Chrome 70 */
13507
+ export enum IgnoredActionType {
13508
+ AUTH_CREDENTIALS = "auth_credentials",
13509
+ REDIRECT = "redirect",
13510
+ REQUEST_HEADERS = "request_headers",
13511
+ RESPONSE_HEADERS = "response_headers",
13512
+ }
13513
+
13514
+ /** @since Chrome 44 */
13515
+ export enum OnAuthRequiredOptions {
13516
+ /** Specifies that the response headers should be included in the event. */
13517
+ RESPONSE_HEADERS = "responseHeaders",
13518
+ /** Specifies the request is blocked until the callback function returns. */
13519
+ BLOCKING = "blocking",
13520
+ /** Specifies that the callback function is handled asynchronously. */
13521
+ ASYNC_BLOCKING = "asyncBlocking",
13522
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13523
+ EXTRA_HEADERS = "extraHeaders",
13524
+ }
13525
+
13526
+ /** @since Chrome 44 */
13527
+ export enum OnBeforeRedirectOptions {
13528
+ /** Specifies that the response headers should be included in the event. */
13529
+ RESPONSE_HEADERS = "responseHeaders",
13530
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13531
+ EXTRA_HEADERS = "extraHeaders",
13532
+ }
13533
+
13534
+ /** @since Chrome 44 */
13535
+ export enum OnBeforeRequestOptions {
13536
+ /** Specifies the request is blocked until the callback function returns. */
13537
+ BLOCKING = "blocking",
13538
+ /** Specifies that the request body should be included in the event. */
13539
+ REQUEST_BODY = "requestBody",
13540
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13541
+ EXTRA_HEADERS = "extraHeaders",
13542
+ }
13543
+
13544
+ /** @since Chrome 44 */
13545
+ export enum OnBeforeSendHeadersOptions {
13546
+ /** Specifies that the request header should be included in the event. */
13547
+ REQUEST_HEADERS = "requestHeaders",
13548
+ /** Specifies the request is blocked until the callback function returns. */
13549
+ BLOCKING = "blocking",
13550
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13551
+ EXTRA_HEADERS = "extraHeaders",
13552
+ }
13553
+
13554
+ /** @since Chrome 44 */
13555
+ export enum OnCompletedOptions {
13556
+ /** Specifies that the response headers should be included in the event. */
13557
+ RESPONSE_HEADERS = "responseHeaders",
13558
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13559
+ EXTRA_HEADERS = "extraHeaders",
13560
+ }
13561
+
13562
+ /** @since Chrome 44 */
13563
+ export enum OnErrorOccurredOptions {
13564
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13565
+ EXTRA_HEADERS = "extraHeaders",
13566
+ }
13567
+
13568
+ /** @since Chrome 44 */
13569
+ export enum OnHeadersReceivedOptions {
13570
+ /** Specifies the request is blocked until the callback function returns. */
13571
+ BLOCKING = "blocking",
13572
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13573
+ EXTRA_HEADERS = "extraHeaders",
13574
+ /** Specifies that the response headers should be included in the event. */
13575
+ RESPONSE_HEADERS = "responseHeaders",
13576
+ }
13577
+
13578
+ /** @since Chrome 44 */
13579
+ export enum OnResponseStartedOptions {
13580
+ /** Specifies that the response headers should be included in the event. */
13581
+ RESPONSE_HEADERS = "responseHeaders",
13582
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13583
+ EXTRA_HEADERS = "extraHeaders",
13584
+ }
13585
+
13586
+ /** @since Chrome 44 */
13587
+ export enum OnSendHeadersOptions {
13588
+ /** Specifies that the request header should be included in the event. */
13589
+ REQUEST_HEADERS = "requestHeaders",
13590
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13591
+ EXTRA_HEADERS = "extraHeaders",
13592
+ }
13593
+
13521
13594
  /** An object describing filters to apply to webRequest events. */
13522
13595
  export interface RequestFilter {
13523
- /** Optional. */
13524
13596
  tabId?: number | undefined;
13525
- /**
13526
- * A list of request types. Requests that cannot match any of the types will be filtered out.
13527
- */
13528
- types?: ResourceType[] | undefined;
13597
+ /** A list of request types. Requests that cannot match any of the types will be filtered out. */
13598
+ types?: `${ResourceType}`[] | undefined;
13529
13599
  /** A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out. */
13530
13600
  urls: string[];
13531
-
13532
- /** Optional. */
13533
13601
  windowId?: number | undefined;
13534
13602
  }
13535
13603
 
13536
- /**
13537
- * Contains data uploaded in a URL request.
13538
- * @since Chrome 23
13539
- */
13604
+ /** @since Chrome 44 */
13605
+ export enum ResourceType {
13606
+ /** Specifies the resource as the main frame. */
13607
+ MAIN_FRAME = "main_frame",
13608
+ /** Specifies the resource as a sub frame. */
13609
+ SUB_FRAME = "sub_frame",
13610
+ /** Specifies the resource as a stylesheet. */
13611
+ STYLESHEET = "stylesheet",
13612
+ /** Specifies the resource as a script. */
13613
+ SCRIPT = "script",
13614
+ /** Specifies the resource as an image. */
13615
+ IMAGE = "image",
13616
+ /** Specifies the resource as a font. */
13617
+ FONT = "font",
13618
+ /** Specifies the resource as an object. */
13619
+ OBJECT = "object",
13620
+ /** Specifies the resource as an XMLHttpRequest. */
13621
+ XMLHTTPREQUEST = "xmlhttprequest",
13622
+ /** Specifies the resource as a ping. */
13623
+ PING = "ping",
13624
+ /** Specifies the resource as a Content Security Policy (CSP) report. */
13625
+ CSP_REPORT = "csp_report",
13626
+ /** Specifies the resource as a media object. */
13627
+ MEDIA = "media",
13628
+ /** Specifies the resource as a WebSocket. */
13629
+ WEBSOCKET = "websocket",
13630
+ /** Specifies the resource as a WebBundle. */
13631
+ WEBBUNDLE = "webbundle",
13632
+ /** Specifies the resource as a type not included in the listed types. */
13633
+ OTHER = "other",
13634
+ }
13635
+
13636
+ /** Contains data uploaded in a URL request. */
13540
13637
  export interface UploadData {
13541
- /** Optional. An ArrayBuffer with a copy of the data. */
13542
- bytes?: ArrayBuffer | undefined;
13543
- /** Optional. A string with the file's path and name. */
13544
- file?: string | undefined;
13638
+ /** An ArrayBuffer with a copy of the data. */
13639
+ bytes?: ArrayBuffer;
13640
+ /** A string with the file's path and name. */
13641
+ file?: string;
13545
13642
  }
13546
13643
 
13547
- export interface WebRequestBody {
13548
- /** Optional. Errors when obtaining request body data. */
13549
- error?: string | undefined;
13644
+ /** The maximum number of times that `handlerBehaviorChanged` can be called per 10 minute sustained interval. `handlerBehaviorChanged` is an expensive function call that shouldn't be called often. */
13645
+ export const MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: 20;
13646
+
13647
+ /** Common properties for all webRequest events (except {@link onActionIgnored}). */
13648
+ export interface WebRequestDetails {
13550
13649
  /**
13551
- * Optional.
13552
- * 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']}.
13650
+ * The UUID of the document making the request.
13651
+ * @since Chrome 106
13553
13652
  */
13554
- formData?: { [key: string]: string[] } | undefined;
13653
+ documentId: string;
13555
13654
  /**
13556
- * Optional.
13557
- * 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.
13655
+ * The lifecycle the document is in.
13656
+ * @since Chrome 106
13558
13657
  */
13559
- raw?: UploadData[] | undefined;
13560
- }
13561
-
13562
- export interface WebAuthChallenger {
13563
- host: string;
13564
- port: number;
13565
- }
13566
-
13567
- export interface ResourceRequest {
13568
- url: string;
13569
- /** 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. */
13570
- requestId: string;
13571
- /** 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 (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
13658
+ documentLifecycle: extensionTypes.DocumentLifecycle;
13659
+ /** 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 (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
13572
13660
  frameId: number;
13573
- /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
13574
- parentFrameId: number;
13575
- /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
13576
- tabId: number;
13577
13661
  /**
13578
- * How the requested resource will be used.
13662
+ * The type of frame the request occurred in.
13663
+ * @since Chrome 106
13579
13664
  */
13580
- type: ResourceType;
13581
- /** The time when this signal is triggered, in milliseconds since the epoch. */
13582
- timeStamp: number;
13583
- /** The origin where the request was initiated. This does not change through redirects. If this is an opaque origin, the string 'null' will be used.
13665
+ frameType: extensionTypes.FrameType;
13666
+ /**
13667
+ * The origin where the request was initiated. This does not change through redirects. If this is an opaque origin, the string 'null' will be used.
13584
13668
  * @since Chrome 63
13585
13669
  */
13586
- initiator?: string | undefined;
13587
- }
13588
-
13589
- export interface WebRequestDetails extends ResourceRequest {
13670
+ initiator?: string;
13590
13671
  /** Standard HTTP method. */
13591
13672
  method: string;
13592
- }
13593
-
13594
- export interface WebRequestHeadersDetails extends WebRequestDetails {
13595
- /** Optional. The HTTP request headers that are going to be sent out with this request. */
13596
- requestHeaders?: HttpHeader[] | undefined;
13597
- documentId: string;
13598
- documentLifecycle: extensionTypes.DocumentLifecycle;
13599
- frameType: extensionTypes.FrameType;
13600
- frameId: number;
13601
- initiator?: string | undefined;
13602
- parentDocumentId?: string | undefined;
13673
+ /**
13674
+ * The UUID of the parent document owning this frame. This is not set if there is no parent.
13675
+ * @since Chrome 106
13676
+ */
13677
+ parentDocumentId?: string;
13678
+ /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
13603
13679
  parentFrameId: number;
13680
+ /** 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. */
13604
13681
  requestId: string;
13682
+ /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
13605
13683
  tabId: number;
13684
+ /** The time when this signal is triggered, in milliseconds since the epoch. */
13606
13685
  timeStamp: number;
13607
- type: ResourceType;
13686
+ /** How the requested resource will be used. */
13687
+ type: `${ResourceType}`;
13608
13688
  url: string;
13609
13689
  }
13610
13690
 
13611
- export interface WebRequestBodyDetails extends WebRequestDetails {
13612
- /**
13613
- * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.
13614
- * @since Chrome 23
13615
- */
13616
- requestBody: WebRequestBody | null;
13617
- }
13618
-
13619
- export interface WebRequestFullDetails extends WebRequestHeadersDetails, WebRequestBodyDetails {}
13620
-
13621
- export interface WebResponseDetails extends ResourceRequest {
13622
- /** 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). */
13623
- statusLine: string;
13691
+ export interface OnAuthRequiredDetails extends WebRequestDetails {
13692
+ /** The server requesting authentication. */
13693
+ challenger: {
13694
+ host: string;
13695
+ port: number;
13696
+ };
13697
+ /** True for Proxy-Authenticate, false for WWW-Authenticate. */
13698
+ isProxy: boolean;
13699
+ /** The authentication realm provided by the server, if there is one. */
13700
+ realm?: string;
13701
+ /** The HTTP response headers that were received along with this response. */
13702
+ responseHeaders?: HttpHeader[];
13703
+ /** The authentication scheme, e.g. Basic or Digest. */
13704
+ scheme: string;
13624
13705
  /**
13625
13706
  * Standard HTTP status code returned by the server.
13626
13707
  * @since Chrome 43
13627
13708
  */
13628
13709
  statusCode: number;
13710
+ /** 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.*/
13711
+ statusLine: string;
13629
13712
  }
13630
13713
 
13631
- export interface WebResponseHeadersDetails extends WebResponseDetails {
13632
- /** Optional. The HTTP response headers that have been received with this response. */
13633
- responseHeaders?: HttpHeader[] | undefined;
13634
- method: string /** standard HTTP method i.e. GET, POST, PUT, etc. */;
13635
- }
13636
-
13637
- export interface WebResponseCacheDetails extends WebResponseHeadersDetails {
13638
- /**
13639
- * Optional.
13640
- * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.
13641
- */
13642
- ip?: string | undefined;
13714
+ export interface OnBeforeRedirectDetails extends WebRequestDetails {
13643
13715
  /** Indicates if this response was fetched from disk cache. */
13644
13716
  fromCache: boolean;
13645
- }
13646
-
13647
- export interface WebRedirectionResponseDetails extends WebResponseCacheDetails {
13717
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13718
+ ip?: string;
13648
13719
  /** The new URL. */
13649
13720
  redirectUrl: string;
13721
+ /** The HTTP response headers that were received along with this redirect. */
13722
+ responseHeaders?: HttpHeader[];
13723
+ /** Standard HTTP status code returned by the server. */
13724
+ statusCode: number;
13725
+ /** 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.*/
13726
+ statusLine: string;
13650
13727
  }
13651
13728
 
13652
- export interface WebAuthenticationChallengeDetails extends WebResponseHeadersDetails {
13653
- /** The authentication scheme, e.g. Basic or Digest. */
13654
- scheme: string;
13655
- /** The authentication realm provided by the server, if there is one. */
13656
- realm?: string | undefined;
13657
- /** The server requesting authentication. */
13658
- challenger: WebAuthChallenger;
13659
- /** True for Proxy-Authenticate, false for WWW-Authenticate. */
13660
- isProxy: boolean;
13729
+ export interface OnBeforeRequestDetails
13730
+ extends SetPartial<WebRequestDetails, "documentId" | "documentLifecycle" | "frameType">
13731
+ {
13732
+ /** Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'. */
13733
+ requestBody: {
13734
+ /** Errors when obtaining request body data. */
13735
+ error?: string;
13736
+ /** 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'\]}. */
13737
+ formData?: { [key: string]: FormDataItem[] };
13738
+ /** 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. */
13739
+ raw?: UploadData[];
13740
+ } | undefined;
13661
13741
  }
13662
13742
 
13663
- export interface WebResponseErrorDetails extends WebResponseCacheDetails {
13664
- /** The error description. This string is not guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content. */
13665
- error: string;
13743
+ export interface OnBeforeSendHeadersDetails extends WebRequestDetails {
13744
+ /** The HTTP request headers that are going to be sent out with this request. */
13745
+ requestHeaders?: HttpHeader[];
13666
13746
  }
13667
13747
 
13668
- export type WebRequestBodyEvent = WebRequestEvent<
13669
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13670
- (details: WebRequestBodyDetails) => BlockingResponse | void,
13671
- string[]
13672
- >;
13673
-
13674
- export type WebRequestHeadersSynchronousEvent = WebRequestEvent<
13675
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13676
- (details: WebRequestHeadersDetails) => BlockingResponse | void,
13677
- string[]
13678
- >;
13679
-
13680
- export type WebRequestHeadersEvent = WebRequestEvent<
13681
- (details: WebRequestHeadersDetails) => void,
13682
- string[]
13683
- >;
13684
-
13685
- export type _WebResponseHeadersEvent<T extends WebResponseHeadersDetails> = WebRequestEvent<
13686
- (details: T) => void,
13687
- string[]
13688
- >;
13689
-
13690
- export type WebResponseHeadersEvent = WebRequestEvent<
13691
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13692
- (details: WebResponseHeadersDetails) => BlockingResponse | void,
13693
- string[]
13694
- >;
13695
-
13696
- export type WebResponseCacheEvent = _WebResponseHeadersEvent<WebResponseCacheDetails>;
13748
+ export interface OnCompletedDetails extends WebRequestDetails {
13749
+ /** Indicates if this response was fetched from disk cache. */
13750
+ fromCache: boolean;
13751
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13752
+ ip?: string;
13753
+ /** The HTTP response headers that were received along with this response. */
13754
+ responseHeaders?: HttpHeader[];
13755
+ /** Standard HTTP status code returned by the server. */
13756
+ statusCode: number;
13757
+ /** 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.*/
13758
+ statusLine: string;
13759
+ }
13697
13760
 
13698
- export type WebRedirectionResponseEvent = _WebResponseHeadersEvent<WebRedirectionResponseDetails>;
13761
+ export interface OnErrorOccurredDetails extends WebRequestDetails {
13762
+ /** The error description. This string is _not_ guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content. */
13763
+ error: string;
13764
+ /** Indicates if this response was fetched from disk cache. */
13765
+ fromCache: boolean;
13766
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13767
+ ip?: string;
13768
+ }
13699
13769
 
13700
- export type WebAuthenticationChallengeEvent = WebRequestEvent<
13701
- (
13702
- details: WebAuthenticationChallengeDetails,
13703
- callback?: (response: BlockingResponse) => void,
13704
- ) => void,
13705
- string[]
13706
- >;
13770
+ export interface OnHeadersReceivedDetails extends WebRequestDetails {
13771
+ /** The HTTP response headers that have been received with this response. */
13772
+ responseHeaders?: HttpHeader[];
13773
+ /** Standard HTTP status code returned by the server. */
13774
+ statusCode: number;
13775
+ /** 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.*/
13776
+ statusLine: string;
13777
+ }
13707
13778
 
13708
- export interface WebResponseErrorEvent extends _WebResponseHeadersEvent<WebResponseErrorDetails> {}
13779
+ export interface OnResponseStartedDetails extends WebRequestDetails {
13780
+ /** Indicates if this response was fetched from disk cache. */
13781
+ fromCache: boolean;
13782
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13783
+ ip?: string;
13784
+ /** The HTTP response headers that were received along with this response. */
13785
+ responseHeaders?: HttpHeader[];
13786
+ /** Standard HTTP status code returned by the server. */
13787
+ statusCode: number;
13788
+ /** 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. */
13789
+ statusLine: string;
13790
+ }
13709
13791
 
13710
- /**
13711
- * The maximum number of times that handlerBehaviorChanged can be called per 10 minute sustained interval. handlerBehaviorChanged is an expensive function call that shouldn't be called often.
13712
- * @since Chrome 23
13713
- */
13714
- export var MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: number;
13792
+ export interface OnSendHeadersDetails extends WebRequestDetails {
13793
+ /** The HTTP request headers that have been sent out with this request. */
13794
+ requestHeaders?: HttpHeader[];
13795
+ }
13715
13796
 
13716
13797
  /**
13717
13798
  * 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.
@@ -13720,17 +13801,39 @@ declare namespace chrome {
13720
13801
  export function handlerBehaviorChanged(): Promise<void>;
13721
13802
  export function handlerBehaviorChanged(callback: () => void): void;
13722
13803
 
13804
+ export const onActionIgnored: events.Event<
13805
+ (details: {
13806
+ // The proposed action which was ignored.
13807
+ action: `${IgnoredActionType}`;
13808
+ // 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.
13809
+ requestId: string;
13810
+ }) => void
13811
+ >;
13812
+
13723
13813
  /** Fired when a request is about to occur. */
13724
- export const onBeforeRequest: WebRequestBodyEvent;
13814
+ export const onBeforeRequest: WebRequestEvent<
13815
+ (details: OnBeforeRequestDetails) => BlockingResponse | undefined,
13816
+ `${OnBeforeRequestOptions}`[]
13817
+ >;
13725
13818
 
13726
13819
  /** 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. */
13727
- export const onBeforeSendHeaders: WebRequestHeadersSynchronousEvent;
13820
+ export const onBeforeSendHeaders: WebRequestEvent<
13821
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13822
+ (details: OnBeforeSendHeadersDetails) => BlockingResponse | undefined,
13823
+ `${OnBeforeSendHeadersOptions}`[]
13824
+ >;
13728
13825
 
13729
13826
  /** 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). */
13730
- export const onSendHeaders: WebRequestHeadersEvent;
13827
+ export const onSendHeaders: WebRequestEvent<
13828
+ (details: OnSendHeadersDetails) => void,
13829
+ `${OnSendHeadersOptions}`[]
13830
+ >;
13731
13831
 
13732
13832
  /** Fired when HTTP response headers of a request have been received. */
13733
- export const onHeadersReceived: WebResponseHeadersEvent;
13833
+ export const onHeadersReceived: WebRequestEvent<
13834
+ (details: OnHeadersReceivedDetails) => BlockingResponse | undefined,
13835
+ `${OnHeadersReceivedOptions}`[]
13836
+ >;
13734
13837
 
13735
13838
  /**
13736
13839
  * Fired when an authentication failure is received.
@@ -13740,19 +13843,39 @@ declare namespace chrome {
13740
13843
  *
13741
13844
  * Requires the `webRequestAuthProvider` permission.
13742
13845
  */
13743
- export const onAuthRequired: WebAuthenticationChallengeEvent;
13846
+ export const onAuthRequired: WebRequestEvent<
13847
+ (
13848
+ details: OnAuthRequiredDetails,
13849
+ /** @since Chrome 58 */
13850
+ asyncCallback?: (response: BlockingResponse) => void,
13851
+ ) => BlockingResponse | undefined,
13852
+ `${OnAuthRequiredOptions}`[]
13853
+ >;
13854
+ // export const onAuthRequired: WebAuthenticationChallengeEvent;
13744
13855
 
13745
13856
  /** 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. */
13746
- export const onResponseStarted: WebResponseCacheEvent;
13857
+ export const onResponseStarted: WebRequestEvent<
13858
+ (details: OnResponseStartedDetails) => void,
13859
+ `${OnResponseStartedOptions}`[]
13860
+ >;
13747
13861
 
13748
13862
  /** Fired when a server-initiated redirect is about to occur. */
13749
- export const onBeforeRedirect: WebRedirectionResponseEvent;
13863
+ export const onBeforeRedirect: WebRequestEvent<
13864
+ (details: OnBeforeRedirectDetails) => void,
13865
+ `${OnBeforeRedirectOptions}`[]
13866
+ >;
13750
13867
 
13751
13868
  /** Fired when a request is completed. */
13752
- export const onCompleted: WebResponseCacheEvent;
13869
+ export const onCompleted: WebRequestEvent<
13870
+ (details: OnCompletedDetails) => void,
13871
+ `${OnCompletedOptions}`[]
13872
+ >;
13753
13873
 
13754
13874
  /** Fired when an error occurs. */
13755
- export const onErrorOccurred: WebResponseErrorEvent;
13875
+ export const onErrorOccurred: WebRequestEvent<
13876
+ (details: OnErrorOccurredDetails) => void,
13877
+ `${OnErrorOccurredOptions}`[]
13878
+ >;
13756
13879
  }
13757
13880
 
13758
13881
  ////////////////////
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.325",
3
+ "version": "0.0.326",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "c1d7a98a250e307669524f700baba806e6e2a28d0fd1402c7f9e197c29e908c2",
97
+ "typesPublisherContentHash": "66c7a69847a0d0836aad6ce5862b7db40cf49922b3a727ffdf3d72cd4a8ce961",
98
98
  "typeScriptVersion": "5.1"
99
99
  }