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