@types/chrome 0.0.324 → 0.0.326

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. chrome/README.md +1 -1
  2. chrome/index.d.ts +674 -194
  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 00:47:14 GMT
11
+ * Last updated: Sat, 31 May 2025 08:36:55 GMT
12
12
  * Dependencies: [@types/filesystem](https://npmjs.com/package/@types/filesystem), [@types/har-format](https://npmjs.com/package/@types/har-format)
13
13
 
14
14
  # Credits
chrome/index.d.ts CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  // Helpers
6
6
  type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
7
+ type SetPartial<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
7
8
 
8
9
  ////////////////////
9
10
  // Global object
@@ -1383,6 +1384,246 @@ declare namespace chrome {
1383
1384
  export function removeIndexedDB(options: RemovalOptions, callback: () => void): void;
1384
1385
  }
1385
1386
 
1387
+ ////////////////////
1388
+ // Certificate Provider
1389
+ ////////////////////
1390
+ /**
1391
+ * Use this API to expose certificates to the platform which can use these certificates for TLS authentications.
1392
+ *
1393
+ * Manifest: "certificateProvider"
1394
+ * @platform ChromeOS only
1395
+ * @since Chrome 46
1396
+ */
1397
+ export namespace certificateProvider {
1398
+ /** Types of supported cryptographic signature algorithms. */
1399
+ export enum Algorithm {
1400
+ /**
1401
+ * Specifies the RSASSA PKCS#1 v1.5 signature algorithm with the MD5-SHA-1 hashing. The extension must not prepend a DigestInfo prefix but only add PKCS#1 padding.
1402
+ * @deprecated This algorithm is deprecated and will never be requested by Chrome as of version 109.
1403
+ */
1404
+ RSASSA_PKCS1_V1_5_MD5_SHA1 = "RSASSA_PKCS1_v1_5_MD5_SHA1",
1405
+ /** Specifies the RSASSA PKCS#1 v1.5 signature algorithm with the SHA-1 hash function. */
1406
+ RSASSA_PKCS1_V1_5_SHA1 = "RSASSA_PKCS1_v1_5_SHA1",
1407
+ /** Specifies the RSASSA PKCS#1 v1.5 signature algorithm with the SHA-256 hashing function. */
1408
+ RSASSA_PKCS1_V1_5_SHA256 = "RSASSA_PKCS1_v1_5_SHA256",
1409
+ /** Specifies the RSASSA PKCS#1 v1.5 signature algorithm with the SHA-384 hashing function. */
1410
+ RSASSA_PKCS1_V1_5_SHA384 = "RSASSA_PKCS1_v1_5_SHA384",
1411
+ /** Specifies the RSASSA PKCS#1 v1.5 signature algorithm with the SHA-512 hashing function. */
1412
+ RSASSA_PKCS1_V1_5_SHA512 = "RSASSA_PKCS1_v1_5_SHA512",
1413
+ /** Specifies the RSASSA PSS signature algorithm with the SHA-256 hashing function, MGF1 mask generation function and the salt of the same size as the hash. */
1414
+ RSASSA_PSS_SHA256 = "RSASSA_PSS_SHA256",
1415
+ /** Specifies the RSASSA PSS signature algorithm with the SHA-384 hashing function, MGF1 mask generation function and the salt of the same size as the hash. */
1416
+ RSASSA_PSS_SHA384 = "RSASSA_PSS_SHA384",
1417
+ /** Specifies the RSASSA PSS signature algorithm with the SHA-512 hashing function, MGF1 mask generation function and the salt of the same size as the hash. */
1418
+ RSASSA_PSS_SHA512 = "RSASSA_PSS_SHA512",
1419
+ }
1420
+
1421
+ export interface CertificateInfo {
1422
+ /** Must be the DER encoding of a X.509 certificate. Currently, only certificates of RSA keys are supported. */
1423
+ certificate: ArrayBuffer;
1424
+ /** Must be set to all hashes supported for this certificate. This extension will only be asked for signatures of digests calculated with one of these hash algorithms. This should be in order of decreasing hash preference. */
1425
+ supportedHashes: `${Hash}`[];
1426
+ }
1427
+
1428
+ /** @since Chrome 86 */
1429
+ export interface CertificatesUpdateRequest {
1430
+ /** Request identifier to be passed to {@link setCertificates}. */
1431
+ certificatesRequestId: number;
1432
+ }
1433
+
1434
+ /** @since Chrome 86 */
1435
+ export interface ClientCertificateInfo {
1436
+ /**
1437
+ * The array must contain the DER encoding of the X.509 client certificate as its first element.
1438
+ *
1439
+ * This must include exactly one certificate.
1440
+ */
1441
+ certificateChain: ArrayBuffer[];
1442
+ /** All algorithms supported for this certificate. The extension will only be asked for signatures using one of these algorithms. */
1443
+ supportedAlgorithms: `${Algorithm}`[];
1444
+ }
1445
+
1446
+ /**
1447
+ * Types of errors that the extension can report.
1448
+ * @since Chrome 86
1449
+ */
1450
+ export enum Error {
1451
+ GENERAL_ERROR = "GENERAL_ERROR",
1452
+ }
1453
+
1454
+ /** @deprecated Replaced by {@link Algorithm}.*/
1455
+ export enum Hash {
1456
+ /** Specifies the MD5 and SHA1 hashing algorithms. */
1457
+ MD5_SHA1 = "MD5_SHA1",
1458
+ /** Specifies the SHA1 hashing algorithm. */
1459
+ SHA1 = "SHA1",
1460
+ /** Specifies the SHA256 hashing algorithm. */
1461
+ SHA256 = "SHA256",
1462
+ /** Specifies the SHA384 hashing algorithm. */
1463
+ SHA384 = "SHA384",
1464
+ /** Specifies the SHA512 hashing algorithm. */
1465
+ SHA512 = "SHA512",
1466
+ }
1467
+
1468
+ /**
1469
+ * The types of errors that can be presented to the user through the requestPin function.
1470
+ * @since Chrome 57
1471
+ */
1472
+ export enum PinRequestErrorType {
1473
+ /** Specifies the PIN is invalid. */
1474
+ INVALID_PIN = "INVALID_PIN",
1475
+ /** Specifies the PUK is invalid. */
1476
+ INVALID_PUK = "INVALID_PUK",
1477
+ /** Specifies the maximum attempt number has been exceeded. */
1478
+ MAX_ATTEMPTS_EXCEEDED = "MAX_ATTEMPTS_EXCEEDED",
1479
+ /** Specifies that the error cannot be represented by the above types. */
1480
+ UNKNOWN_ERROR = "UNKNOWN_ERROR",
1481
+ }
1482
+
1483
+ /**
1484
+ * The type of code being requested by the extension with requestPin function.
1485
+ * @since Chrome 57
1486
+ */
1487
+ export enum PinRequestType {
1488
+ /** Specifies the requested code is a PIN. */
1489
+ PIN = "PIN",
1490
+ /** Specifies the requested code is a PUK. */
1491
+ PUK = "PUK",
1492
+ }
1493
+
1494
+ /** @since Chrome 57 */
1495
+ export interface PinResponseDetails {
1496
+ /** The code provided by the user. Empty if user closed the dialog or some other error occurred. */
1497
+ userInput?: string | undefined;
1498
+ }
1499
+
1500
+ /** @since Chrome 86 */
1501
+ export interface ReportSignatureDetails {
1502
+ /** Error that occurred while generating the signature, if any. */
1503
+ error?: `${Error}` | undefined;
1504
+ /** Request identifier that was received via the {@link onSignatureRequested} event. */
1505
+ signRequestId: number;
1506
+ /** The signature, if successfully generated. */
1507
+ signature?: ArrayBuffer | undefined;
1508
+ }
1509
+
1510
+ /** @since Chrome 57 */
1511
+ export interface RequestPinDetails {
1512
+ /** The number of attempts left. This is provided so that any UI can present this information to the user. Chrome is not expected to enforce this, instead stopPinRequest should be called by the extension with errorType = MAX_ATTEMPTS_EXCEEDED when the number of pin requests is exceeded. */
1513
+ attemptsLeft?: number | undefined;
1514
+ /** The error template displayed to the user. This should be set if the previous request failed, to notify the user of the failure reason. */
1515
+ errorType?: `${PinRequestErrorType}` | undefined;
1516
+ /** The type of code requested. Default is PIN. */
1517
+ requestType?: `${PinRequestType}` | undefined;
1518
+ /** The ID given by Chrome in SignRequest. */
1519
+ signRequestId: number;
1520
+ }
1521
+
1522
+ /** @since Chrome 86 */
1523
+ export interface SetCertificatesDetails {
1524
+ /** When called in response to {@link onCertificatesUpdateRequested}, should contain the received `certificatesRequestId` value. Otherwise, should be unset. */
1525
+ certificatesRequestId?: number | undefined;
1526
+ /** List of currently available client certificates. */
1527
+ clientCertificates: ClientCertificateInfo[];
1528
+ /** Error that occurred while extracting the certificates, if any. This error will be surfaced to the user when appropriate. */
1529
+ error?: `${Error}` | undefined;
1530
+ }
1531
+
1532
+ /** @since Chrome 86 */
1533
+ export interface SignatureRequest {
1534
+ /** Signature algorithm to be used. */
1535
+ algorithm: `${Algorithm}`;
1536
+ /** The DER encoding of a X.509 certificate. The extension must sign `input` using the associated private key. */
1537
+ certificate: ArrayBuffer;
1538
+ /** Data to be signed. Note that the data is not hashed. */
1539
+ input: ArrayBuffer;
1540
+ /** Request identifier to be passed to {@link reportSignature}. */
1541
+ signRequestId: number;
1542
+ }
1543
+
1544
+ export interface SignRequest {
1545
+ /** The DER encoding of a X.509 certificate. The extension must sign `digest` using the associated private key. */
1546
+ certificate: ArrayBuffer;
1547
+ /** The digest that must be signed. */
1548
+ digest: ArrayBuffer;
1549
+ /** Refers to the hash algorithm that was used to create `digest`. */
1550
+ hash: `${Hash}`;
1551
+ /**
1552
+ * The unique ID to be used by the extension should it need to call a method that requires it, e.g. requestPin.
1553
+ * @since Chrome 57
1554
+ */
1555
+ signRequestId: number;
1556
+ }
1557
+
1558
+ /** @since Chrome 57 */
1559
+ export interface StopPinRequestDetails {
1560
+ /** The error template. If present it is displayed to user. Intended to contain the reason for stopping the flow if it was caused by an error, e.g. MAX\_ATTEMPTS\_EXCEEDED. */
1561
+ errorType?: `${PinRequestErrorType}` | undefined;
1562
+ /** The ID given by Chrome in SignRequest. */
1563
+ signRequestId: number;
1564
+ }
1565
+
1566
+ /**
1567
+ * Should be called as a response to {@link onSignatureRequested}.
1568
+ *
1569
+ * The extension must eventually call this function for every {@link onSignatureRequested} event; the API implementation will stop waiting for this call after some time and respond with a timeout error when this function is called.
1570
+ *
1571
+ * Can return its result via Promise since Chrome 96.
1572
+ * @since Chrome 86
1573
+ */
1574
+ export function reportSignature(details: ReportSignatureDetails): Promise<void>;
1575
+ export function reportSignature(details: ReportSignatureDetails, callback: () => void): void;
1576
+
1577
+ /**
1578
+ * Requests the PIN from the user. Only one ongoing request at a time is allowed. The requests issued while another flow is ongoing are rejected. It's the extension's responsibility to try again later if another flow is in progress.
1579
+ *
1580
+ * Can return its result via Promise since Chrome 96.
1581
+ * @param details Contains the details about the requested dialog.
1582
+ * @since Chrome 57
1583
+ */
1584
+ export function requestPin(details: RequestPinDetails): Promise<PinResponseDetails | undefined>;
1585
+ export function requestPin(
1586
+ details: RequestPinDetails,
1587
+ callback: (details?: PinResponseDetails | undefined) => void,
1588
+ ): void;
1589
+
1590
+ /**
1591
+ * Sets a list of certificates to use in the browser.
1592
+ *
1593
+ * The extension should call this function after initialization and on every change in the set of currently available certificates. The extension should also call this function in response to {@link onCertificatesUpdateRequested} every time this event is received.
1594
+ *
1595
+ * Can return its result via Promise since Chrome 96.
1596
+ * @param details The certificates to set. Invalid certificates will be ignored.
1597
+ * @since Chrome 86
1598
+ */
1599
+ export function setCertificates(details: SetCertificatesDetails): Promise<void>;
1600
+ export function setCertificates(details: SetCertificatesDetails, callback: () => void): void;
1601
+
1602
+ /**
1603
+ * Stops the pin request started by the {@link requestPin} function.
1604
+ *
1605
+ * Can return its result via Promise since Chrome 96.
1606
+ * @param details Contains the details about the reason for stopping the request flow.
1607
+ * @since Chrome 57
1608
+ */
1609
+ export function stopPinRequest(details: StopPinRequestDetails): Promise<void>;
1610
+ export function stopPinRequest(details: StopPinRequestDetails, callback: () => void): void;
1611
+
1612
+ /**
1613
+ * This event fires if the certificates set via {@link setCertificates} are insufficient or the browser requests updated information. The extension must call {@link setCertificates} with the updated list of certificates and the received `certificatesRequestId`.
1614
+ * @since Chrome 86
1615
+ */
1616
+ export const onCertificatesUpdateRequested: events.Event<(request: CertificatesUpdateRequest) => void>;
1617
+
1618
+ /**
1619
+ * This event fires every time the browser needs to sign a message using a certificate provided by this extension via {@link setCertificates}.
1620
+ *
1621
+ * The extension must sign the input data from `request` using the appropriate algorithm and private key and return it by calling {@link reportSignature} with the received `signRequestId`.
1622
+ * @since Chrome 86
1623
+ */
1624
+ export const onSignatureRequested: events.Event<(request: SignatureRequest) => void>;
1625
+ }
1626
+
1386
1627
  ////////////////////
1387
1628
  // Commands
1388
1629
  ////////////////////
@@ -12880,6 +13121,123 @@ declare namespace chrome {
12880
13121
  export function setWallpaper(details: WallpaperDetails, callback: (thumbnail?: ArrayBuffer) => void): void;
12881
13122
  }
12882
13123
 
13124
+ ////////////////////
13125
+ // Web Authentication Proxy
13126
+ ////////////////////
13127
+ /**
13128
+ * The `chrome.webAuthenticationProxy` API lets remote desktop software running on a remote host intercept Web Authentication API (WebAuthn) requests in order to handle them on a local client.
13129
+ *
13130
+ * Permissions: "webAuthenticationProxy"
13131
+ * @since Chrome 115, MV3
13132
+ */
13133
+ export namespace webAuthenticationProxy {
13134
+ export interface CreateRequest {
13135
+ /** The `PublicKeyCredentialCreationOptions` passed to `navigator.credentials.create()`, serialized as a JSON string. The serialization format is compatible with [`PublicKeyCredential.parseCreationOptionsFromJSON()`](https://w3c.github.io/webauthn/#sctn-parseCreationOptionsFromJSON). */
13136
+ requestDetailsJson: string;
13137
+ /** An opaque identifier for the request. */
13138
+ requestId: number;
13139
+ }
13140
+
13141
+ export interface CreateResponseDetails {
13142
+ /** The `DOMException` yielded by the remote request, if any. */
13143
+ error?: DOMExceptionDetails | undefined;
13144
+ /** The `requestId` of the `CreateRequest`. */
13145
+ requestId: number;
13146
+ /** The `PublicKeyCredential`, yielded by the remote request, if any, serialized as a JSON string by calling [`PublicKeyCredential.toJSON()`](https://w3c.github.io/webauthn/#dom-publickeycredential-tojson). */
13147
+ responseJson?: string | undefined;
13148
+ }
13149
+
13150
+ export interface DOMExceptionDetails {
13151
+ name: string;
13152
+ message: string;
13153
+ }
13154
+
13155
+ export interface GetRequest {
13156
+ /** The `PublicKeyCredentialRequestOptions` passed to `navigator.credentials.get()`, serialized as a JSON string. The serialization format is compatible with [`PublicKeyCredential.parseRequestOptionsFromJSON()`](https://w3c.github.io/webauthn/#sctn-parseRequestOptionsFromJSON). */
13157
+ requestDetailsJson: string;
13158
+ /** An opaque identifier for the request. */
13159
+ requestId: number;
13160
+ }
13161
+
13162
+ export interface GetResponseDetails {
13163
+ /** The `DOMException` yielded by the remote request, if any. */
13164
+ error?: DOMExceptionDetails | undefined;
13165
+ /** The `requestId` of the `CreateRequest`. */
13166
+ requestId: number;
13167
+ /** The `PublicKeyCredential`, yielded by the remote request, if any, serialized as a JSON string by calling [`PublicKeyCredential.toJSON()`](https://w3c.github.io/webauthn/#dom-publickeycredential-tojson). */
13168
+ responseJson?: string | undefined;
13169
+ }
13170
+
13171
+ export interface IsUvpaaRequest {
13172
+ /** An opaque identifier for the request. */
13173
+ requestId: number;
13174
+ }
13175
+
13176
+ export interface IsUvpaaResponseDetails {
13177
+ isUvpaa: boolean;
13178
+ requestId: number;
13179
+ }
13180
+
13181
+ /**
13182
+ * Makes this extension the active Web Authentication API request proxy.
13183
+ *
13184
+ * Remote desktop extensions typically call this method after detecting attachment of a remote session to this host. Once this method returns without error, regular processing of WebAuthn requests is suspended, and events from this extension API are raised.
13185
+ *
13186
+ * This method fails with an error if a different extension is already attached.
13187
+ *
13188
+ * The attached extension must call `detach()` once the remote desktop session has ended in order to resume regular WebAuthn request processing. Extensions automatically become detached if they are unloaded.
13189
+ *
13190
+ * Refer to the `onRemoteSessionStateChange` event for signaling a change of remote session attachment from a native application to to the (possibly suspended) extension.
13191
+ */
13192
+ export function attach(): Promise<string | undefined>;
13193
+ export function attach(callback: (error?: string | undefined) => void): void;
13194
+
13195
+ /** Reports the result of a `navigator.credentials.create()` call. The extension must call this for every `onCreateRequest` event it has received, unless the request was canceled (in which case, an `onRequestCanceled` event is fired). */
13196
+ export function completeCreateRequest(details: CreateResponseDetails): Promise<void>;
13197
+ export function completeCreateRequest(details: CreateResponseDetails, callback: () => void): void;
13198
+
13199
+ /** Reports the result of a `navigator.credentials.get()` call. The extension must call this for every `onGetRequest` event it has received, unless the request was canceled (in which case, an `onRequestCanceled` event is fired). */
13200
+ export function completeGetRequest(details: GetResponseDetails): Promise<void>;
13201
+ export function completeGetRequest(details: GetResponseDetails, callback: () => void): void;
13202
+
13203
+ /** Reports the result of a `PublicKeyCredential.isUserVerifyingPlatformAuthenticator()` call. The extension must call this for every `onIsUvpaaRequest` event it has received. */
13204
+ export function completeIsUvpaaRequest(details: IsUvpaaResponseDetails): Promise<void>;
13205
+ export function completeIsUvpaaRequest(details: IsUvpaaResponseDetails, callback: () => void): void;
13206
+
13207
+ /**
13208
+ * Removes this extension from being the active Web Authentication API request proxy.
13209
+ *
13210
+ * This method is typically called when the extension detects that a remote desktop session was terminated. Once this method returns, the extension ceases to be the active Web Authentication API request proxy.
13211
+ *
13212
+ * Refer to the `onRemoteSessionStateChange` event for signaling a change of remote session attachment from a native application to to the (possibly suspended) extension.
13213
+ */
13214
+ export function detach(): Promise<string | undefined>;
13215
+ export function detach(callback: (error?: string | undefined) => void): void;
13216
+
13217
+ /** Fires when a WebAuthn `navigator.credentials.create()` call occurs. The extension must supply a response by calling `completeCreateRequest()` with the `requestId` from `requestInfo`. */
13218
+ export const onCreateRequest: events.Event<(requestInfo: CreateRequest) => void>;
13219
+
13220
+ /** Fires when a WebAuthn `navigator.credentials.get()` call occurs. The extension must supply a response by calling `completeGetRequest()` with the `requestId` from `requestInfo` */
13221
+ export const onGetRequest: events.Event<(requestInfo: GetRequest) => void>;
13222
+
13223
+ /** Fires when a `PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()` call occurs. The extension must supply a response by calling `completeIsUvpaaRequest()` with the `requestId` from `requestInfo` */
13224
+ export const onIsUvpaaRequest: events.Event<(requestInfo: IsUvpaaRequest) => void>;
13225
+
13226
+ /**
13227
+ * A native application associated with this extension can cause this event to be fired by writing to a file with a name equal to the extension's ID in a directory named `WebAuthenticationProxyRemoteSessionStateChange` inside the [default user data directory](https://chromium.googlesource.com/chromium/src/+/main/docs/user_data_dir.md#default-location)
13228
+ *
13229
+ * The contents of the file should be empty. I.e., it is not necessary to change the contents of the file in order to trigger this event.
13230
+ *
13231
+ * The native host application may use this event mechanism to signal a possible remote session state change (i.e. from detached to attached, or vice versa) while the extension service worker is possibly suspended. In the handler for this event, the extension can call the `attach()` or `detach()` API methods accordingly.
13232
+ *
13233
+ * The event listener must be registered synchronously at load time.
13234
+ */
13235
+ export const onRemoteSessionStateChange: events.Event<() => void>;
13236
+
13237
+ /** Fires when a `onCreateRequest` or `onGetRequest` event is canceled (because the WebAuthn request was aborted by the caller, or because it timed out). When receiving this event, the extension should cancel processing of the corresponding request on the client side. Extensions cannot complete a request once it has been canceled. */
13238
+ export const onRequestCanceled: events.Event<(requestId: number) => void>;
13239
+ }
13240
+
12883
13241
  ////////////////////
12884
13242
  // Web Navigation
12885
13243
  ////////////////////
@@ -13107,24 +13465,8 @@ declare namespace chrome {
13107
13465
  interface WebRequestEvent<T extends (...args: any) => void, U extends string[]>
13108
13466
  extends Omit<chrome.events.Event<T>, "addListener">
13109
13467
  {
13110
- addListener(callback: T, filter: RequestFilter, extraInfoSpec?: U): void;
13111
- }
13112
-
13113
- /** How the requested resource will be used. */
13114
- export type ResourceType =
13115
- | "main_frame"
13116
- | "sub_frame"
13117
- | "stylesheet"
13118
- | "script"
13119
- | "image"
13120
- | "font"
13121
- | "object"
13122
- | "xmlhttprequest"
13123
- | "ping"
13124
- | "csp_report"
13125
- | "media"
13126
- | "websocket"
13127
- | "other";
13468
+ addListener(callback: T, filter: RequestFilter, extraInfoSpec?: U | undefined): void;
13469
+ }
13128
13470
 
13129
13471
  export interface AuthCredentials {
13130
13472
  username: string;
@@ -13133,228 +13475,324 @@ declare namespace chrome {
13133
13475
 
13134
13476
  /** An HTTP Header, represented as an object containing a key and either a value or a binaryValue. */
13135
13477
  export interface HttpHeader {
13478
+ /** Name of the HTTP header. */
13136
13479
  name: string;
13480
+ /** Value of the HTTP header if it can be represented by UTF-8. */
13137
13481
  value?: string | undefined;
13482
+ /** Value of the HTTP header if it cannot be represented by UTF-8, stored as individual byte values (0..255). */
13138
13483
  binaryValue?: ArrayBuffer | undefined;
13139
13484
  }
13140
13485
 
13141
13486
  /** Returns value for event handlers that have the 'blocking' extraInfoSpec applied. Allows the event handler to modify network requests. */
13142
13487
  export interface BlockingResponse {
13143
- /** Optional. If true, the request is cancelled. Used in onBeforeRequest, this prevents the request from being sent. */
13488
+ /** If true, the request is cancelled. This prevents the request from being sent. This can be used as a response to the onBeforeRequest, onBeforeSendHeaders, onHeadersReceived and onAuthRequired events. */
13144
13489
  cancel?: boolean | undefined;
13145
- /**
13146
- * Optional.
13147
- * 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.
13148
- */
13490
+ /** Only used as a response to the onBeforeRequest and onHeadersReceived events. If set, the original request is prevented from being sent/completed and is instead redirected to the given URL. Redirections to non-HTTP schemes such as `data:` are allowed. Redirects initiated by a redirect action use the original request method for the redirect, with one exception: If the redirect is initiated at the onHeadersReceived stage, then the redirect will be issued using the GET method. Redirects from URLs with `ws://` and `wss://` schemes are **ignored**. */
13149
13491
  redirectUrl?: string | undefined;
13150
- /**
13151
- * Optional.
13152
- * 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).
13153
- */
13492
+ /** Only used as a response to the onHeadersReceived event. If set, the server is assumed to have responded with these response headers instead. Only return `responseHeaders` if you really want to modify the headers in order to limit the number of conflicts (only one extension may modify `responseHeaders` for each request). */
13154
13493
  responseHeaders?: HttpHeader[] | undefined;
13155
- /** Optional. Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials. */
13494
+ /** Only used as a response to the onAuthRequired event. If set, the request is made using the supplied credentials. */
13156
13495
  authCredentials?: AuthCredentials | undefined;
13157
- /**
13158
- * Optional.
13159
- * Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead.
13160
- */
13496
+ /** Only used as a response to the onBeforeSendHeaders event. If set, the request is made with these request headers instead. */
13161
13497
  requestHeaders?: HttpHeader[] | undefined;
13162
13498
  }
13163
13499
 
13500
+ /**
13501
+ * Contains data passed within form data. For urlencoded form it is stored as string if data is utf-8 string and as ArrayBuffer otherwise. For form-data it is ArrayBuffer. If form-data represents uploading file, it is string with filename, if the filename is provided.
13502
+ * @since Chrome 66
13503
+ */
13504
+ export type FormDataItem = string | ArrayBuffer;
13505
+
13506
+ /** @since Chrome 70 */
13507
+ export enum IgnoredActionType {
13508
+ AUTH_CREDENTIALS = "auth_credentials",
13509
+ REDIRECT = "redirect",
13510
+ REQUEST_HEADERS = "request_headers",
13511
+ RESPONSE_HEADERS = "response_headers",
13512
+ }
13513
+
13514
+ /** @since Chrome 44 */
13515
+ export enum OnAuthRequiredOptions {
13516
+ /** Specifies that the response headers should be included in the event. */
13517
+ RESPONSE_HEADERS = "responseHeaders",
13518
+ /** Specifies the request is blocked until the callback function returns. */
13519
+ BLOCKING = "blocking",
13520
+ /** Specifies that the callback function is handled asynchronously. */
13521
+ ASYNC_BLOCKING = "asyncBlocking",
13522
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13523
+ EXTRA_HEADERS = "extraHeaders",
13524
+ }
13525
+
13526
+ /** @since Chrome 44 */
13527
+ export enum OnBeforeRedirectOptions {
13528
+ /** Specifies that the response headers should be included in the event. */
13529
+ RESPONSE_HEADERS = "responseHeaders",
13530
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13531
+ EXTRA_HEADERS = "extraHeaders",
13532
+ }
13533
+
13534
+ /** @since Chrome 44 */
13535
+ export enum OnBeforeRequestOptions {
13536
+ /** Specifies the request is blocked until the callback function returns. */
13537
+ BLOCKING = "blocking",
13538
+ /** Specifies that the request body should be included in the event. */
13539
+ REQUEST_BODY = "requestBody",
13540
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13541
+ EXTRA_HEADERS = "extraHeaders",
13542
+ }
13543
+
13544
+ /** @since Chrome 44 */
13545
+ export enum OnBeforeSendHeadersOptions {
13546
+ /** Specifies that the request header should be included in the event. */
13547
+ REQUEST_HEADERS = "requestHeaders",
13548
+ /** Specifies the request is blocked until the callback function returns. */
13549
+ BLOCKING = "blocking",
13550
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13551
+ EXTRA_HEADERS = "extraHeaders",
13552
+ }
13553
+
13554
+ /** @since Chrome 44 */
13555
+ export enum OnCompletedOptions {
13556
+ /** Specifies that the response headers should be included in the event. */
13557
+ RESPONSE_HEADERS = "responseHeaders",
13558
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13559
+ EXTRA_HEADERS = "extraHeaders",
13560
+ }
13561
+
13562
+ /** @since Chrome 44 */
13563
+ export enum OnErrorOccurredOptions {
13564
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13565
+ EXTRA_HEADERS = "extraHeaders",
13566
+ }
13567
+
13568
+ /** @since Chrome 44 */
13569
+ export enum OnHeadersReceivedOptions {
13570
+ /** Specifies the request is blocked until the callback function returns. */
13571
+ BLOCKING = "blocking",
13572
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13573
+ EXTRA_HEADERS = "extraHeaders",
13574
+ /** Specifies that the response headers should be included in the event. */
13575
+ RESPONSE_HEADERS = "responseHeaders",
13576
+ }
13577
+
13578
+ /** @since Chrome 44 */
13579
+ export enum OnResponseStartedOptions {
13580
+ /** Specifies that the response headers should be included in the event. */
13581
+ RESPONSE_HEADERS = "responseHeaders",
13582
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13583
+ EXTRA_HEADERS = "extraHeaders",
13584
+ }
13585
+
13586
+ /** @since Chrome 44 */
13587
+ export enum OnSendHeadersOptions {
13588
+ /** Specifies that the request header should be included in the event. */
13589
+ REQUEST_HEADERS = "requestHeaders",
13590
+ /** Specifies that headers can violate Cross-Origin Resource Sharing (CORS). */
13591
+ EXTRA_HEADERS = "extraHeaders",
13592
+ }
13593
+
13164
13594
  /** An object describing filters to apply to webRequest events. */
13165
13595
  export interface RequestFilter {
13166
- /** Optional. */
13167
13596
  tabId?: number | undefined;
13168
- /**
13169
- * A list of request types. Requests that cannot match any of the types will be filtered out.
13170
- */
13171
- types?: ResourceType[] | undefined;
13597
+ /** A list of request types. Requests that cannot match any of the types will be filtered out. */
13598
+ types?: `${ResourceType}`[] | undefined;
13172
13599
  /** A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out. */
13173
13600
  urls: string[];
13174
-
13175
- /** Optional. */
13176
13601
  windowId?: number | undefined;
13177
13602
  }
13178
13603
 
13179
- /**
13180
- * Contains data uploaded in a URL request.
13181
- * @since Chrome 23
13182
- */
13604
+ /** @since Chrome 44 */
13605
+ export enum ResourceType {
13606
+ /** Specifies the resource as the main frame. */
13607
+ MAIN_FRAME = "main_frame",
13608
+ /** Specifies the resource as a sub frame. */
13609
+ SUB_FRAME = "sub_frame",
13610
+ /** Specifies the resource as a stylesheet. */
13611
+ STYLESHEET = "stylesheet",
13612
+ /** Specifies the resource as a script. */
13613
+ SCRIPT = "script",
13614
+ /** Specifies the resource as an image. */
13615
+ IMAGE = "image",
13616
+ /** Specifies the resource as a font. */
13617
+ FONT = "font",
13618
+ /** Specifies the resource as an object. */
13619
+ OBJECT = "object",
13620
+ /** Specifies the resource as an XMLHttpRequest. */
13621
+ XMLHTTPREQUEST = "xmlhttprequest",
13622
+ /** Specifies the resource as a ping. */
13623
+ PING = "ping",
13624
+ /** Specifies the resource as a Content Security Policy (CSP) report. */
13625
+ CSP_REPORT = "csp_report",
13626
+ /** Specifies the resource as a media object. */
13627
+ MEDIA = "media",
13628
+ /** Specifies the resource as a WebSocket. */
13629
+ WEBSOCKET = "websocket",
13630
+ /** Specifies the resource as a WebBundle. */
13631
+ WEBBUNDLE = "webbundle",
13632
+ /** Specifies the resource as a type not included in the listed types. */
13633
+ OTHER = "other",
13634
+ }
13635
+
13636
+ /** Contains data uploaded in a URL request. */
13183
13637
  export interface UploadData {
13184
- /** Optional. An ArrayBuffer with a copy of the data. */
13185
- bytes?: ArrayBuffer | undefined;
13186
- /** Optional. A string with the file's path and name. */
13187
- file?: string | undefined;
13638
+ /** An ArrayBuffer with a copy of the data. */
13639
+ bytes?: ArrayBuffer;
13640
+ /** A string with the file's path and name. */
13641
+ file?: string;
13188
13642
  }
13189
13643
 
13190
- export interface WebRequestBody {
13191
- /** Optional. Errors when obtaining request body data. */
13192
- error?: string | undefined;
13644
+ /** The maximum number of times that `handlerBehaviorChanged` can be called per 10 minute sustained interval. `handlerBehaviorChanged` is an expensive function call that shouldn't be called often. */
13645
+ export const MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: 20;
13646
+
13647
+ /** Common properties for all webRequest events (except {@link onActionIgnored}). */
13648
+ export interface WebRequestDetails {
13193
13649
  /**
13194
- * Optional.
13195
- * If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': ['value1', 'value2']}.
13650
+ * The UUID of the document making the request.
13651
+ * @since Chrome 106
13196
13652
  */
13197
- formData?: { [key: string]: string[] } | undefined;
13653
+ documentId: string;
13198
13654
  /**
13199
- * Optional.
13200
- * If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array.
13655
+ * The lifecycle the document is in.
13656
+ * @since Chrome 106
13201
13657
  */
13202
- raw?: UploadData[] | undefined;
13203
- }
13204
-
13205
- export interface WebAuthChallenger {
13206
- host: string;
13207
- port: number;
13208
- }
13209
-
13210
- export interface ResourceRequest {
13211
- url: string;
13212
- /** 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. */
13213
- requestId: string;
13214
- /** The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (type is main_frame or sub_frame), frameId indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
13658
+ documentLifecycle: extensionTypes.DocumentLifecycle;
13659
+ /** The value 0 indicates that the request happens in the main frame; a positive value indicates the ID of a subframe in which the request happens. If the document of a (sub-)frame is loaded (`type` is `main_frame` or `sub_frame`), `frameId` indicates the ID of this frame, not the ID of the outer frame. Frame IDs are unique within a tab. */
13215
13660
  frameId: number;
13216
- /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
13217
- parentFrameId: number;
13218
- /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
13219
- tabId: number;
13220
13661
  /**
13221
- * How the requested resource will be used.
13662
+ * The type of frame the request occurred in.
13663
+ * @since Chrome 106
13222
13664
  */
13223
- type: ResourceType;
13224
- /** The time when this signal is triggered, in milliseconds since the epoch. */
13225
- timeStamp: number;
13226
- /** The origin where the request was initiated. This does not change through redirects. If this is an opaque origin, the string 'null' will be used.
13665
+ frameType: extensionTypes.FrameType;
13666
+ /**
13667
+ * The origin where the request was initiated. This does not change through redirects. If this is an opaque origin, the string 'null' will be used.
13227
13668
  * @since Chrome 63
13228
13669
  */
13229
- initiator?: string | undefined;
13230
- }
13231
-
13232
- export interface WebRequestDetails extends ResourceRequest {
13670
+ initiator?: string;
13233
13671
  /** Standard HTTP method. */
13234
13672
  method: string;
13235
- }
13236
-
13237
- export interface WebRequestHeadersDetails extends WebRequestDetails {
13238
- /** Optional. The HTTP request headers that are going to be sent out with this request. */
13239
- requestHeaders?: HttpHeader[] | undefined;
13240
- documentId: string;
13241
- documentLifecycle: extensionTypes.DocumentLifecycle;
13242
- frameType: extensionTypes.FrameType;
13243
- frameId: number;
13244
- initiator?: string | undefined;
13245
- parentDocumentId?: string | undefined;
13673
+ /**
13674
+ * The UUID of the parent document owning this frame. This is not set if there is no parent.
13675
+ * @since Chrome 106
13676
+ */
13677
+ parentDocumentId?: string;
13678
+ /** ID of frame that wraps the frame which sent the request. Set to -1 if no parent frame exists. */
13246
13679
  parentFrameId: number;
13680
+ /** The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request. */
13247
13681
  requestId: string;
13682
+ /** The ID of the tab in which the request takes place. Set to -1 if the request isn't related to a tab. */
13248
13683
  tabId: number;
13684
+ /** The time when this signal is triggered, in milliseconds since the epoch. */
13249
13685
  timeStamp: number;
13250
- type: ResourceType;
13686
+ /** How the requested resource will be used. */
13687
+ type: `${ResourceType}`;
13251
13688
  url: string;
13252
13689
  }
13253
13690
 
13254
- export interface WebRequestBodyDetails extends WebRequestDetails {
13255
- /**
13256
- * Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'.
13257
- * @since Chrome 23
13258
- */
13259
- requestBody: WebRequestBody | null;
13260
- }
13261
-
13262
- export interface WebRequestFullDetails extends WebRequestHeadersDetails, WebRequestBodyDetails {}
13263
-
13264
- export interface WebResponseDetails extends ResourceRequest {
13265
- /** 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). */
13266
- statusLine: string;
13691
+ export interface OnAuthRequiredDetails extends WebRequestDetails {
13692
+ /** The server requesting authentication. */
13693
+ challenger: {
13694
+ host: string;
13695
+ port: number;
13696
+ };
13697
+ /** True for Proxy-Authenticate, false for WWW-Authenticate. */
13698
+ isProxy: boolean;
13699
+ /** The authentication realm provided by the server, if there is one. */
13700
+ realm?: string;
13701
+ /** The HTTP response headers that were received along with this response. */
13702
+ responseHeaders?: HttpHeader[];
13703
+ /** The authentication scheme, e.g. Basic or Digest. */
13704
+ scheme: string;
13267
13705
  /**
13268
13706
  * Standard HTTP status code returned by the server.
13269
13707
  * @since Chrome 43
13270
13708
  */
13271
13709
  statusCode: number;
13710
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13711
+ statusLine: string;
13272
13712
  }
13273
13713
 
13274
- export interface WebResponseHeadersDetails extends WebResponseDetails {
13275
- /** Optional. The HTTP response headers that have been received with this response. */
13276
- responseHeaders?: HttpHeader[] | undefined;
13277
- method: string /** standard HTTP method i.e. GET, POST, PUT, etc. */;
13278
- }
13279
-
13280
- export interface WebResponseCacheDetails extends WebResponseHeadersDetails {
13281
- /**
13282
- * Optional.
13283
- * The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address.
13284
- */
13285
- ip?: string | undefined;
13714
+ export interface OnBeforeRedirectDetails extends WebRequestDetails {
13286
13715
  /** Indicates if this response was fetched from disk cache. */
13287
13716
  fromCache: boolean;
13288
- }
13289
-
13290
- export interface WebRedirectionResponseDetails extends WebResponseCacheDetails {
13717
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13718
+ ip?: string;
13291
13719
  /** The new URL. */
13292
13720
  redirectUrl: string;
13721
+ /** The HTTP response headers that were received along with this redirect. */
13722
+ responseHeaders?: HttpHeader[];
13723
+ /** Standard HTTP status code returned by the server. */
13724
+ statusCode: number;
13725
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13726
+ statusLine: string;
13293
13727
  }
13294
13728
 
13295
- export interface WebAuthenticationChallengeDetails extends WebResponseHeadersDetails {
13296
- /** The authentication scheme, e.g. Basic or Digest. */
13297
- scheme: string;
13298
- /** The authentication realm provided by the server, if there is one. */
13299
- realm?: string | undefined;
13300
- /** The server requesting authentication. */
13301
- challenger: WebAuthChallenger;
13302
- /** True for Proxy-Authenticate, false for WWW-Authenticate. */
13303
- isProxy: boolean;
13729
+ export interface OnBeforeRequestDetails
13730
+ extends SetPartial<WebRequestDetails, "documentId" | "documentLifecycle" | "frameType">
13731
+ {
13732
+ /** Contains the HTTP request body data. Only provided if extraInfoSpec contains 'requestBody'. */
13733
+ requestBody: {
13734
+ /** Errors when obtaining request body data. */
13735
+ error?: string;
13736
+ /** If the request method is POST and the body is a sequence of key-value pairs encoded in UTF8, encoded as either multipart/form-data, or application/x-www-form-urlencoded, this dictionary is present and for each key contains the list of all values for that key. If the data is of another media type, or if it is malformed, the dictionary is not present. An example value of this dictionary is {'key': \['value1', 'value2'\]}. */
13737
+ formData?: { [key: string]: FormDataItem[] };
13738
+ /** If the request method is PUT or POST, and the body is not already parsed in formData, then the unparsed request body elements are contained in this array. */
13739
+ raw?: UploadData[];
13740
+ } | undefined;
13304
13741
  }
13305
13742
 
13306
- export interface WebResponseErrorDetails extends WebResponseCacheDetails {
13307
- /** The error description. This string is not guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content. */
13308
- error: string;
13743
+ export interface OnBeforeSendHeadersDetails extends WebRequestDetails {
13744
+ /** The HTTP request headers that are going to be sent out with this request. */
13745
+ requestHeaders?: HttpHeader[];
13309
13746
  }
13310
13747
 
13311
- export type WebRequestBodyEvent = WebRequestEvent<
13312
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13313
- (details: WebRequestBodyDetails) => BlockingResponse | void,
13314
- string[]
13315
- >;
13316
-
13317
- export type WebRequestHeadersSynchronousEvent = WebRequestEvent<
13318
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13319
- (details: WebRequestHeadersDetails) => BlockingResponse | void,
13320
- string[]
13321
- >;
13322
-
13323
- export type WebRequestHeadersEvent = WebRequestEvent<
13324
- (details: WebRequestHeadersDetails) => void,
13325
- string[]
13326
- >;
13327
-
13328
- export type _WebResponseHeadersEvent<T extends WebResponseHeadersDetails> = WebRequestEvent<
13329
- (details: T) => void,
13330
- string[]
13331
- >;
13332
-
13333
- export type WebResponseHeadersEvent = WebRequestEvent<
13334
- // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13335
- (details: WebResponseHeadersDetails) => BlockingResponse | void,
13336
- string[]
13337
- >;
13338
-
13339
- export type WebResponseCacheEvent = _WebResponseHeadersEvent<WebResponseCacheDetails>;
13748
+ export interface OnCompletedDetails extends WebRequestDetails {
13749
+ /** Indicates if this response was fetched from disk cache. */
13750
+ fromCache: boolean;
13751
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13752
+ ip?: string;
13753
+ /** The HTTP response headers that were received along with this response. */
13754
+ responseHeaders?: HttpHeader[];
13755
+ /** Standard HTTP status code returned by the server. */
13756
+ statusCode: number;
13757
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13758
+ statusLine: string;
13759
+ }
13340
13760
 
13341
- export type WebRedirectionResponseEvent = _WebResponseHeadersEvent<WebRedirectionResponseDetails>;
13761
+ export interface OnErrorOccurredDetails extends WebRequestDetails {
13762
+ /** The error description. This string is _not_ guaranteed to remain backwards compatible between releases. You must not parse and act based upon its content. */
13763
+ error: string;
13764
+ /** Indicates if this response was fetched from disk cache. */
13765
+ fromCache: boolean;
13766
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13767
+ ip?: string;
13768
+ }
13342
13769
 
13343
- export type WebAuthenticationChallengeEvent = WebRequestEvent<
13344
- (
13345
- details: WebAuthenticationChallengeDetails,
13346
- callback?: (response: BlockingResponse) => void,
13347
- ) => void,
13348
- string[]
13349
- >;
13770
+ export interface OnHeadersReceivedDetails extends WebRequestDetails {
13771
+ /** The HTTP response headers that have been received with this response. */
13772
+ responseHeaders?: HttpHeader[];
13773
+ /** Standard HTTP status code returned by the server. */
13774
+ statusCode: number;
13775
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers.*/
13776
+ statusLine: string;
13777
+ }
13350
13778
 
13351
- export interface WebResponseErrorEvent extends _WebResponseHeadersEvent<WebResponseErrorDetails> {}
13779
+ export interface OnResponseStartedDetails extends WebRequestDetails {
13780
+ /** Indicates if this response was fetched from disk cache. */
13781
+ fromCache: boolean;
13782
+ /** The server IP address that the request was actually sent to. Note that it may be a literal IPv6 address. */
13783
+ ip?: string;
13784
+ /** The HTTP response headers that were received along with this response. */
13785
+ responseHeaders?: HttpHeader[];
13786
+ /** Standard HTTP status code returned by the server. */
13787
+ statusCode: number;
13788
+ /** HTTP status line of the response or the 'HTTP/0.9 200 OK' string for HTTP/0.9 responses (i.e., responses that lack a status line) or an empty string if there are no headers. */
13789
+ statusLine: string;
13790
+ }
13352
13791
 
13353
- /**
13354
- * 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.
13355
- * @since Chrome 23
13356
- */
13357
- export var MAX_HANDLER_BEHAVIOR_CHANGED_CALLS_PER_10_MINUTES: number;
13792
+ export interface OnSendHeadersDetails extends WebRequestDetails {
13793
+ /** The HTTP request headers that have been sent out with this request. */
13794
+ requestHeaders?: HttpHeader[];
13795
+ }
13358
13796
 
13359
13797
  /**
13360
13798
  * Needs to be called when the behavior of the webRequest handlers has changed to prevent incorrect handling due to caching. This function call is expensive. Don't call it often.
@@ -13363,17 +13801,39 @@ declare namespace chrome {
13363
13801
  export function handlerBehaviorChanged(): Promise<void>;
13364
13802
  export function handlerBehaviorChanged(callback: () => void): void;
13365
13803
 
13804
+ export const onActionIgnored: events.Event<
13805
+ (details: {
13806
+ // The proposed action which was ignored.
13807
+ action: `${IgnoredActionType}`;
13808
+ // The ID of the request. Request IDs are unique within a browser session. As a result, they could be used to relate different events of the same request.
13809
+ requestId: string;
13810
+ }) => void
13811
+ >;
13812
+
13366
13813
  /** Fired when a request is about to occur. */
13367
- export const onBeforeRequest: WebRequestBodyEvent;
13814
+ export const onBeforeRequest: WebRequestEvent<
13815
+ (details: OnBeforeRequestDetails) => BlockingResponse | undefined,
13816
+ `${OnBeforeRequestOptions}`[]
13817
+ >;
13368
13818
 
13369
13819
  /** Fired before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any HTTP data is sent. */
13370
- export const onBeforeSendHeaders: WebRequestHeadersSynchronousEvent;
13820
+ export const onBeforeSendHeaders: WebRequestEvent<
13821
+ // eslint-disable-next-line @typescript-eslint/no-invalid-void-type
13822
+ (details: OnBeforeSendHeadersDetails) => BlockingResponse | undefined,
13823
+ `${OnBeforeSendHeadersOptions}`[]
13824
+ >;
13371
13825
 
13372
13826
  /** Fired just before a request is going to be sent to the server (modifications of previous onBeforeSendHeaders callbacks are visible by the time onSendHeaders is fired). */
13373
- export const onSendHeaders: WebRequestHeadersEvent;
13827
+ export const onSendHeaders: WebRequestEvent<
13828
+ (details: OnSendHeadersDetails) => void,
13829
+ `${OnSendHeadersOptions}`[]
13830
+ >;
13374
13831
 
13375
13832
  /** Fired when HTTP response headers of a request have been received. */
13376
- export const onHeadersReceived: WebResponseHeadersEvent;
13833
+ export const onHeadersReceived: WebRequestEvent<
13834
+ (details: OnHeadersReceivedDetails) => BlockingResponse | undefined,
13835
+ `${OnHeadersReceivedOptions}`[]
13836
+ >;
13377
13837
 
13378
13838
  /**
13379
13839
  * Fired when an authentication failure is received.
@@ -13383,19 +13843,39 @@ declare namespace chrome {
13383
13843
  *
13384
13844
  * Requires the `webRequestAuthProvider` permission.
13385
13845
  */
13386
- export const onAuthRequired: WebAuthenticationChallengeEvent;
13846
+ export const onAuthRequired: WebRequestEvent<
13847
+ (
13848
+ details: OnAuthRequiredDetails,
13849
+ /** @since Chrome 58 */
13850
+ asyncCallback?: (response: BlockingResponse) => void,
13851
+ ) => BlockingResponse | undefined,
13852
+ `${OnAuthRequiredOptions}`[]
13853
+ >;
13854
+ // export const onAuthRequired: WebAuthenticationChallengeEvent;
13387
13855
 
13388
13856
  /** Fired when the first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available. */
13389
- export const onResponseStarted: WebResponseCacheEvent;
13857
+ export const onResponseStarted: WebRequestEvent<
13858
+ (details: OnResponseStartedDetails) => void,
13859
+ `${OnResponseStartedOptions}`[]
13860
+ >;
13390
13861
 
13391
13862
  /** Fired when a server-initiated redirect is about to occur. */
13392
- export const onBeforeRedirect: WebRedirectionResponseEvent;
13863
+ export const onBeforeRedirect: WebRequestEvent<
13864
+ (details: OnBeforeRedirectDetails) => void,
13865
+ `${OnBeforeRedirectOptions}`[]
13866
+ >;
13393
13867
 
13394
13868
  /** Fired when a request is completed. */
13395
- export const onCompleted: WebResponseCacheEvent;
13869
+ export const onCompleted: WebRequestEvent<
13870
+ (details: OnCompletedDetails) => void,
13871
+ `${OnCompletedOptions}`[]
13872
+ >;
13396
13873
 
13397
13874
  /** Fired when an error occurs. */
13398
- export const onErrorOccurred: WebResponseErrorEvent;
13875
+ export const onErrorOccurred: WebRequestEvent<
13876
+ (details: OnErrorOccurredDetails) => void,
13877
+ `${OnErrorOccurredOptions}`[]
13878
+ >;
13399
13879
  }
13400
13880
 
13401
13881
  ////////////////////
@@ -13932,7 +14412,7 @@ declare namespace chrome {
13932
14412
  tabId: number;
13933
14413
 
13934
14414
  /** The resource type of the request. */
13935
- type: ResourceType;
14415
+ type: `${ResourceType}`;
13936
14416
 
13937
14417
  /** The URL of the request. */
13938
14418
  url: string;
@@ -13974,7 +14454,7 @@ declare namespace chrome {
13974
14454
  responseHeaders?: ModifyHeaderInfo[] | undefined;
13975
14455
 
13976
14456
  /** The type of action to perform. */
13977
- type: RuleActionType;
14457
+ type: `${RuleActionType}`;
13978
14458
  }
13979
14459
 
13980
14460
  export interface RuleCondition {
@@ -13982,7 +14462,7 @@ declare namespace chrome {
13982
14462
  * Specifies whether the network request is first-party or third-party to the domain from which it originated.
13983
14463
  * If omitted, all requests are accepted.
13984
14464
  */
13985
- domainType?: DomainType | undefined;
14465
+ domainType?: `${DomainType}` | undefined;
13986
14466
 
13987
14467
  /**
13988
14468
  * @deprecated since Chrome 101. Use initiatorDomains instead.
@@ -14069,7 +14549,7 @@ declare namespace chrome {
14069
14549
  * Only one of requestMethods and excludedRequestMethods should be specified.
14070
14550
  * If neither of them is specified, all request methods are matched.
14071
14551
  */
14072
- excludedRequestMethods?: RequestMethod[] | undefined;
14552
+ excludedRequestMethods?: `${RequestMethod}`[] | undefined;
14073
14553
 
14074
14554
  /**
14075
14555
  * List of resource types which the rule won't match.
@@ -14077,7 +14557,7 @@ declare namespace chrome {
14077
14557
  * and {@link chrome.declarativeNetRequest.RuleCondition.excludedResourceTypes} should be specified.
14078
14558
  * If neither of them is specified, all resource types except "main_frame" are blocked.
14079
14559
  */
14080
- excludedResourceTypes?: ResourceType[] | undefined;
14560
+ excludedResourceTypes?: `${ResourceType}`[] | undefined;
14081
14561
 
14082
14562
  /**
14083
14563
  * List of {@link chrome.tabs.Tab.id} which the rule should not match.
@@ -14108,7 +14588,7 @@ declare namespace chrome {
14108
14588
  * Note: Specifying a {@link chrome.declarativeNetRequest.RuleCondition.requestMethods} rule condition will also exclude non-HTTP(s) requests,
14109
14589
  * whereas specifying {@link chrome.declarativeNetRequest.RuleCondition.excludedRequestMethods} will not.
14110
14590
  */
14111
- requestMethods?: RequestMethod[];
14591
+ requestMethods?: `${RequestMethod}`[] | undefined;
14112
14592
 
14113
14593
  /**
14114
14594
  * List of {@link chrome.tabs.Tab.id} which the rule should not match.
@@ -14150,7 +14630,7 @@ declare namespace chrome {
14150
14630
  *
14151
14631
  * Note: this must be specified for allowAllRequests rules and may only include the sub_frame and main_frame resource types.
14152
14632
  */
14153
- resourceTypes?: ResourceType[] | undefined;
14633
+ resourceTypes?: `${ResourceType}`[] | undefined;
14154
14634
 
14155
14635
  /**
14156
14636
  * Rule does not match if the request matches any response header condition in this list (if specified). If both `excludedResponseHeaders` and `responseHeaders` are specified, then the `excludedResponseHeaders` property takes precedence.
@@ -14220,7 +14700,7 @@ declare namespace chrome {
14220
14700
  header: string;
14221
14701
 
14222
14702
  /** The operation to be performed on a header. */
14223
- operation: HeaderOperation;
14703
+ operation: `${HeaderOperation}`;
14224
14704
 
14225
14705
  /** The new value for the header.
14226
14706
  * Must be specified for append and set operations.
@@ -14302,7 +14782,7 @@ declare namespace chrome {
14302
14782
  /** Specifies the reason why the regular expression is not supported.
14303
14783
  * Only provided if isSupported is false.
14304
14784
  */
14305
- reason?: UnsupportedRegexReason | undefined;
14785
+ reason?: `${UnsupportedRegexReason}` | undefined;
14306
14786
  }
14307
14787
 
14308
14788
  export interface TabActionCountUpdate {
chrome/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/chrome",
3
- "version": "0.0.324",
3
+ "version": "0.0.326",
4
4
  "description": "TypeScript definitions for chrome",
5
5
  "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chrome",
6
6
  "license": "MIT",
@@ -94,6 +94,6 @@
94
94
  "@types/har-format": "*"
95
95
  },
96
96
  "peerDependencies": {},
97
- "typesPublisherContentHash": "3608251c1dcc614ccdb865ee939d2bd75468aba9bd27570e630bf6de852dce15",
97
+ "typesPublisherContentHash": "66c7a69847a0d0836aad6ce5862b7db40cf49922b3a727ffdf3d72cd4a8ce961",
98
98
  "typeScriptVersion": "5.1"
99
99
  }