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