@types/chrome 0.0.325 → 0.0.327

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